docs: use sphinx-multiversion for version selector

This commit is contained in:
Anand Balakrishnan 2023-10-13 14:27:17 -07:00
parent a7431ce424
commit 2ed91f6a74
6 changed files with 58 additions and 48 deletions

30
docs/_templates/versions.html vendored Normal file
View file

@ -0,0 +1,30 @@
{%- if current_version %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<details open="true">
<summary>
<span class="fa fa-book"> Current Version</span>
{{ current_version.name }}
<span class="fa fa-caret-down"></span>
</summary>
<div class="rst-other-versions">
{%- if versions.tags %}
<dl>
<dt>Tags</dt>
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
{%- if versions.branches %}
<dl>
<dt>Branches</dt>
{%- for item in versions.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</details>
</div>
{%- endif %}

View file

@ -27,29 +27,29 @@ extensions = [
"myst_parser",
"sphinx_copybutton",
"sphinx.ext.inheritance_diagram",
"sphinx_multiversion",
]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
html_theme = "pydata_sphinx_theme"
html_theme = "furo"
html_static_path = ["_static"]
html_theme_options = {
"use_edit_page_button": True,
"github_url": "https://github.com/anand-bala/argus",
"switcher": {
"json_url": "https://anand-bala.github.io/argus/dev/_static/switcher.json",
"version_match": version,
},
"check_switcher": False,
"navbar_align": "left", # [left, content, right] For testing that the navbar items align properly
"navbar_center": ["version-switcher", "navbar-nav"],
"source_repository": "https://github.com/anand-bala/argus/",
"source_branch": "dev",
"source_directory": "docs/",
}
html_context = {
"github_user": "anand-bala",
"github_repo": "argus",
"github_version": "v0.1.1",
"doc_path": "docs",
html_sidebars = {
"**": [
"sidebar/brand.html",
"sidebar/search.html",
"sidebar/scroll-start.html",
"sidebar/navigation.html",
"sidebar/ethical-ads.html",
"sidebar/scroll-end.html",
"versions.html",
]
}
source_suffix = {
@ -58,6 +58,10 @@ source_suffix = {
".md": "markdown",
}
# Whitelist pattern for branches (set to None to ignore all branches)
smv_branch_whitelist = r"^dev$"
autoapi_dirs = ["../pyargus/argus"]
autoapi_root = "api"