Skip to content

Commit

Permalink
Find inherited stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
guyer committed Sep 11, 2023
1 parent 7d8514b commit 60f4e6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("{inherited_theme}.css");
@import url("{inherited_css}");


.dropbtn {{
Expand Down
17 changes: 16 additions & 1 deletion ntd2d/ntd2d_action/sphinxdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import pathlib
import shlex
import shutil
from sphinx.application import Sphinx
from sphinx.theming import HTMLThemeFactory
import subprocess
import tempfile

Expand Down Expand Up @@ -45,6 +47,18 @@ def epub_file(self):
def pdf_file(self):
return self.build_dir / "latex" / f"{self.conf.project.lower()}.pdf"

@property
def stylesheet(self):
app = Sphinx(srcdir=self.source_dir,
confdir=self.source_dir,
outdir=self.build_dir,
doctreedir=self.build_dir / "doctrees",
buildername="html")
theme_factory = HTMLThemeFactory(app)
theme = theme_factory.create(app.config.html_theme)

return theme.get_config("theme", "stylesheet")

def build_docs(self, build_command):
"""Build Sphinx Documentation
Expand Down Expand Up @@ -129,7 +143,8 @@ def assimilate_theme(self, name):

self.theme = TemplateHierarchy(name=name,
destination_dir=self.conf.theme_path,
inherited_theme=self.inherited_theme)
inherited_theme=self.inherited_theme,
inherited_css=self.stylesheet)
self.theme.write()

self.conf.set_html_theme(name=name)
Expand Down

0 comments on commit 60f4e6c

Please sign in to comment.