File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
"""This is the pyansys-sphinx-theme module."""
2
2
import os
3
+ from pathlib import Path
3
4
4
5
__version__ = "0.3.0"
5
6
16
17
17
18
html_logo = pyansys_logo_black
18
19
20
+ CSS_FILENAME = "pyansys_sphinx_theme.css"
21
+
19
22
20
23
def get_html_theme_path ():
21
24
"""Return list of HTML theme paths."""
22
- theme_path = os .path .abspath (os .path .dirname (__file__ ))
23
- return [theme_path ]
25
+ return Path (__file__ ).parents [0 ].absolute ()
24
26
25
27
26
28
def setup (app ):
27
29
"""Connect to the sphinx theme app."""
28
- theme_path = get_html_theme_path ()[ 0 ]
30
+ theme_path = get_html_theme_path ()
29
31
app .add_html_theme ("pyansys_sphinx_theme" , theme_path )
30
- theme_css_path = os . path . join ( theme_path , "static" , "css" , "pyansys_sphinx_theme. css")
31
- if not os . path . isfile ( theme_css_path ):
32
+ theme_css_path = theme_path / "static" / " css" / CSS_FILENAME
33
+ if not theme_css_path . exists ( ):
32
34
raise FileNotFoundError (f"Unable to locate pyansys-sphinx theme at { theme_css_path } " )
33
- app .add_css_file (theme_css_path )
35
+ app .add_css_file (str ( theme_css_path . relative_to ( theme_path / "static" )) )
34
36
35
37
# add templates for autosummary
36
38
path_templates = os .path .join (_this_path , "_templates" )
You can’t perform that action at this time.
0 commit comments