diff --git a/_templates/versions.html b/_templates/versions.html index cc0dc9cf7050c66cac151022f3debe5eb70b552b..8cee4f7a7293d5575d35cc04c3c260ee14a1a4b7 100644 --- a/_templates/versions.html +++ b/_templates/versions.html @@ -14,7 +14,8 @@ </dl> <dl> <dt>{{ _('Downloads') }}</dt> - <dd><a href="{{ url }}/beagleboard-docs.pdf">PDF</a></dd> + {% set prefix = current_version if is_release else "latest" %} + <dd><a href="/{{ prefix }}/beagleboard-docs.pdf">PDF</a></dd> </dl> <dl> <dt>{{ _('BeagleBoard.org Links') }}</dt> diff --git a/conf.py b/conf.py index 7a53167563f8d3fb10c31fe2cb90bf2099e3f5fa..ecc2552d258d8abaf7cab781122eefc4dff719e9 100644 --- a/conf.py +++ b/conf.py @@ -10,7 +10,7 @@ from pathlib import Path import re # sys.path.insert(0, os.path.abspath('.')) # sys.path.append('.') - +from sphinx.cmd.build import get_parser import sphinx_rtd_theme BBDOCS_BASE = Path(__file__).resolve().parents[0] @@ -25,7 +25,8 @@ author = 'BeagleBoard.org Foundation' # -- General configuration --------------------------------------------------- extensions = [ - "sphinxcontrib.rsvgconverter", "sphinx_design" + "sphinxcontrib.rsvgconverter", + "sphinx_design" ] templates_path = ['_templates'] @@ -39,9 +40,6 @@ navigation_with_keys = True # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - -# -- Options for HTML output ------------------------------------------------- - html_theme = 'sphinx_rtd_theme' html_show_sphinx = False html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] @@ -56,8 +54,7 @@ html_static_path = [str(BBDOCS_BASE / "_static")] html_last_updated_fmt = "%b %d, %Y" html_domain_indices = False html_split_index = True -html_show_sourcelink = True -html_baseurl = 'https://docs.beagleboard.io/' +html_show_sourcelink = False # parse version from 'VERSION' file with open(BBDOCS_BASE / "VERSION") as f: @@ -84,15 +81,21 @@ with open(BBDOCS_BASE / "VERSION") as f: release = version +is_release = tags.has("release") # pylint: disable=undefined-variable +reference_prefix = "" +if tags.has("publish"): # pylint: disable=undefined-variable + reference_prefix = f"/{version}" if is_release else "/latest" +docs_title = "Docs / {}".format(version if is_release else "Latest") + html_context = { "display_gitlab": True, - "gitlab_host": "git.beagleboard.org", - "gitlab_user": "docs", - "gitlab_repo": "docs.beagleboard.io", - "gitlab_version": "main", - "conf_py_path": "/", + "show_license": True, + "docs_title": docs_title, + "is_release": is_release, + "current_version": version, "versions": ( ("latest", "/"), + ("0.0.7", "/0.0.7/"), ) } @@ -119,6 +122,10 @@ latex_documents = [ ("index-tex", "beagleboard-docs.tex", "BeagleBoard Docs", author, "manual"), ] +vcs_link_version = f"v{version}" if is_release else "main" +vcs_link_base_url = f"https://git.beagleboard.org/docs/docs.beagleboard.io/blob/{vcs_link_version}" + + def setup(app): # theme customizations app.add_css_file("css/custom.css")