gnunet-handbook

The GNUnet Handbook
Log | Files | Refs

commit 7be88746baf89972d24055959c683e74804b13e0
parent 5dde35573cfc8e22bbf2810fb5bacc22726ac74c
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Sat, 24 Feb 2024 10:15:28 +0100

Update to rtd with versioning

Diffstat:
M.buildbot/build.sh | 2+-
A_templates/versions.html | 28++++++++++++++++++++++++++++
Mconf.py | 52++++++++++++++++++++++++----------------------------
3 files changed, 53 insertions(+), 29 deletions(-)

diff --git a/.buildbot/build.sh b/.buildbot/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -make clean html +sphinx-multiversion . _build diff --git a/_templates/versions.html b/_templates/versions.html @@ -0,0 +1,28 @@ +{%- if current_version %} +<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> Other Versions</span> + v: {{ current_version.name }} + <span class="fa fa-caret-down"></span> + </span> + <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> +</div> +{%- endif %} + diff --git a/conf.py b/conf.py @@ -20,7 +20,7 @@ import sys import os project = 'GNUnet' -copyright = '2023, GNUnet Project' +copyright = '2024, GNUnet Project' author = 'GNUnet Project' sys.path.append(os.path.abspath("_exts")) @@ -34,6 +34,7 @@ extensions = [ 'httpdomain.httpdomain', 'typescriptdomain', 'sphinx.ext.todo', + 'sphinx_multiversion' #'sphinx_book_theme', #'breathe' ] @@ -58,39 +59,16 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'pydata_sphinx_theme' +html_theme = 'sphinx_rtd_theme' html_sidebars = { - "**": ["sidebar-nav-bs"] + "**": ["globaltoc.html", "versioning.html"] } html_theme_options = { #'logo_only': True, - #'display_version': False, - #'prev_next_buttons_location': 'bottom', - #'style_external_links': False, - #'vcs_pageview_mode': '', - #'style_nav_header_background': 'transparent', # Possibly problematic with our CSP - # Toc options + 'display_version': True, 'collapse_navigation': True, - #'sticky_navigation': True, - #'navigation_depth': 4, - #'includehidden': True, - #'titles_only': False - #"navbar_start": ["navbar-logo"], - "header_links_before_dropdown": 8, - "article_header_start": ["breadcrumbs.html"], - "show_toc_level": 3, - "show_nav_level": 2, - #"navbar_center": ["navbar-nav"], - #"navbar_end": [], - #"navbar_persistent": [], - "switcher": { - "json_url": "https://docs.gnunet.org/latest/_static/versions.json", - "version_match": "latest" - }, - "primary_sidebar_end": ["version-switcher"], - "check_switcher": False } man_make_section_directory = False @@ -140,8 +118,26 @@ rst_prolog = f""" :class: bolditalic """ - if os.environ.get("GNUNET_VERSION"): rst_prolog = ".. |gnunet_version| replace:: " + os.environ["GNUNET_VERSION"] else: rst_prolog = ".. |gnunet_version| replace:: latest" + +# Whitelist pattern for tags (set to None to ignore all tags) +smv_tag_whitelist = r'^.*$' + +# Whitelist pattern for branches (set to None to ignore all branches) +#smv_branch_whitelist = r'^.*$' +smv_branch_whitelist = 'master' + +# Whitelist pattern for remotes (set to None to use local branches only) +smv_remote_whitelist = None + +# Pattern for released versions +smv_released_pattern = r'^tags/.*$' + +# Format for versioned output directories inside the build directory +smv_outputdir_format = '{ref.name}' + +# Determines whether remote or local git branches/tags are preferred if their output dirs conflict +smv_prefer_remote_refs = False