|
| 1 | +"""Configuration file for the Sphinx documentation builder. |
| 2 | +
|
| 3 | +For the full list of built-in configuration values, see the documentation: |
| 4 | +https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 5 | +""" |
| 6 | + |
| 7 | +import os |
| 8 | +from urllib.parse import urlparse |
| 9 | + |
| 10 | + |
| 11 | +# -- Project information ----------------------------------------------------- |
| 12 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
| 13 | + |
| 14 | +project = "machine-access-control" |
| 15 | +copyright = "2024, Jason Antman" |
| 16 | +author = "Jason Antman" |
| 17 | + |
| 18 | +# -- General configuration --------------------------------------------------- |
| 19 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
| 20 | + |
| 21 | +extensions = [ |
| 22 | + "sphinx.ext.githubpages", |
| 23 | + "sphinx.ext.todo", |
| 24 | + "sphinx.ext.intersphinx", |
| 25 | + "sphinx_last_updated_by_git", |
| 26 | +] |
| 27 | + |
| 28 | +templates_path = ["_templates"] |
| 29 | +exclude_patterns = [] |
| 30 | + |
| 31 | +# If true, `todo` and `todoList` produce output, else they produce nothing. |
| 32 | +todo_include_todos = True |
| 33 | + |
| 34 | +# -- Options for HTML output ------------------------------------------------- |
| 35 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 36 | + |
| 37 | +html_theme = "sphinx_rtd_theme" |
| 38 | +html_theme_options = { |
| 39 | + "navigation_depth": 4, |
| 40 | + "collapse_navigation": False, |
| 41 | + "sticky_navigation": False, |
| 42 | +} |
| 43 | +html_static_path = ["_static"] |
| 44 | + |
| 45 | +html_context = {"theme_vcs_pageview_mode": "edit", "conf_py_path": "/source/"} |
| 46 | + |
| 47 | +if os.environ.get("GITHUB_ACTIONS") == "true": |
| 48 | + html_context["display_github"] = True |
| 49 | + html_context["github_user"], html_context["github_repo"] = os.environ[ |
| 50 | + "GITHUB_REPOSITORY" |
| 51 | + ].split("/") |
| 52 | + html_context["github_host"] = urlparse(os.environ["GITHUB_API_URL"]).hostname |
| 53 | + html_context["github_version"] = os.environ.get( |
| 54 | + "GITHUB_REF_NAME", |
| 55 | + os.environ.get("GITHUB_HEAD_REF", os.environ.get("GITHUB_SHA")), |
| 56 | + ) |
| 57 | + |
| 58 | +html_css_files = [ |
| 59 | + # thanks to: https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html |
| 60 | + "theme_overrides.css" # override wide tables in RTD theme |
| 61 | +] |
0 commit comments