Skip to content

Commit

Permalink
fix nav-bar text and links (#56)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update theme path

Co-authored-by: Alex Kaszynski <[email protected]>

* Update path using pathlib

Co-authored-by: Alex Kaszynski <[email protected]>

* update path using pathlib

Co-authored-by: Alex Kaszynski <[email protected]>
  • Loading branch information
Revathyvenugopal162 and akaszynski committed May 27, 2022
1 parent e824e66 commit 2494a55
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pyansys_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This is the pyansys-sphinx-theme module."""
import os
from pathlib import Path

__version__ = "0.3.0"

Expand All @@ -16,21 +17,22 @@

html_logo = pyansys_logo_black

CSS_FILENAME = "pyansys_sphinx_theme.css"


def get_html_theme_path():
"""Return list of HTML theme paths."""
theme_path = os.path.abspath(os.path.dirname(__file__))
return [theme_path]
return Path(__file__).parents[0].absolute()


def setup(app):
"""Connect to the sphinx theme app."""
theme_path = get_html_theme_path()[0]
theme_path = get_html_theme_path()
app.add_html_theme("pyansys_sphinx_theme", theme_path)
theme_css_path = os.path.join(theme_path, "static", "css", "pyansys_sphinx_theme.css")
if not os.path.isfile(theme_css_path):
theme_css_path = theme_path / "static" / "css" / CSS_FILENAME
if not theme_css_path.exists():
raise FileNotFoundError(f"Unable to locate pyansys-sphinx theme at {theme_css_path}")
app.add_css_file(theme_css_path)
app.add_css_file(str(theme_css_path.relative_to(theme_path / "static")))

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

0 comments on commit 2494a55

Please sign in to comment.