Skip to content

Commit 2494a55

Browse files
fix nav-bar text and links (#56)
* fix nav-bar text and links * add css path * add css path using pathlib * Update src/pyansys_sphinx_theme/__init__.py Co-authored-by: Alex Kaszynski <akascap@gmail.com> * Update theme path Co-authored-by: Alex Kaszynski <akascap@gmail.com> * Update path using pathlib Co-authored-by: Alex Kaszynski <akascap@gmail.com> * update path using pathlib Co-authored-by: Alex Kaszynski <akascap@gmail.com>
1 parent e824e66 commit 2494a55

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/pyansys_sphinx_theme/__init__.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""This is the pyansys-sphinx-theme module."""
22
import os
3+
from pathlib import Path
34

45
__version__ = "0.3.0"
56

@@ -16,21 +17,22 @@
1617

1718
html_logo = pyansys_logo_black
1819

20+
CSS_FILENAME = "pyansys_sphinx_theme.css"
21+
1922

2023
def get_html_theme_path():
2124
"""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()
2426

2527

2628
def setup(app):
2729
"""Connect to the sphinx theme app."""
28-
theme_path = get_html_theme_path()[0]
30+
theme_path = get_html_theme_path()
2931
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():
3234
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")))
3436

3537
# add templates for autosummary
3638
path_templates = os.path.join(_this_path, "_templates")

0 commit comments

Comments
 (0)