diff options
Diffstat (limited to 'tyrian_sphinx_theme/__init__.py')
-rw-r--r-- | tyrian_sphinx_theme/__init__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tyrian_sphinx_theme/__init__.py b/tyrian_sphinx_theme/__init__.py new file mode 100644 index 0000000..5304f18 --- /dev/null +++ b/tyrian_sphinx_theme/__init__.py @@ -0,0 +1,23 @@ +import os + +from tyrian_sphinx_theme import _version as version + +def get_path(): + """ + Shortcut for users whose theme is next to their conf.py. + """ + # Theme directory is defined as our parent directory + return os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + + +def update_context(app, pagename, templatename, context, doctree): + context["tyrian_version"] = version.__version__ + + +def setup(app): + # add_html_theme is new in Sphinx 1.6+ + if hasattr(app, "add_html_theme"): + theme_path = os.path.abspath(os.path.dirname(__file__)) + app.add_html_theme("tyrian_sphinx_theme", theme_path) + app.connect("html-page-context", update_context) + return {"version": version.__version__, "parallel_read_safe": True}
\ No newline at end of file |