Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 009bbc00 authored by Deepak Khatri's avatar Deepak Khatri :dog:
Browse files

Add sphinx git versioning

parent 9385a77e
Branches
No related merge requests found
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
</dl> </dl>
<dl> <dl>
<dt>{{ _('Downloads') }}</dt> <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>
<dl> <dl>
<dt>{{ _('BeagleBoard.org Links') }}</dt> <dt>{{ _('BeagleBoard.org Links') }}</dt>
......
...@@ -10,7 +10,7 @@ from pathlib import Path ...@@ -10,7 +10,7 @@ from pathlib import Path
import re import re
# sys.path.insert(0, os.path.abspath('.')) # sys.path.insert(0, os.path.abspath('.'))
# sys.path.append('.') # sys.path.append('.')
from sphinx.cmd.build import get_parser
import sphinx_rtd_theme import sphinx_rtd_theme
BBDOCS_BASE = Path(__file__).resolve().parents[0] BBDOCS_BASE = Path(__file__).resolve().parents[0]
...@@ -25,7 +25,8 @@ author = 'BeagleBoard.org Foundation' ...@@ -25,7 +25,8 @@ author = 'BeagleBoard.org Foundation'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
extensions = [ extensions = [
"sphinxcontrib.rsvgconverter", "sphinx_design" "sphinxcontrib.rsvgconverter",
"sphinx_design"
] ]
templates_path = ['_templates'] templates_path = ['_templates']
...@@ -39,9 +40,6 @@ navigation_with_keys = True ...@@ -39,9 +40,6 @@ navigation_with_keys = True
# This pattern also affects html_static_path and html_extra_path. # This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
html_theme = 'sphinx_rtd_theme' html_theme = 'sphinx_rtd_theme'
html_show_sphinx = False html_show_sphinx = False
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
...@@ -56,8 +54,7 @@ html_static_path = [str(BBDOCS_BASE / "_static")] ...@@ -56,8 +54,7 @@ html_static_path = [str(BBDOCS_BASE / "_static")]
html_last_updated_fmt = "%b %d, %Y" html_last_updated_fmt = "%b %d, %Y"
html_domain_indices = False html_domain_indices = False
html_split_index = True html_split_index = True
html_show_sourcelink = True html_show_sourcelink = False
html_baseurl = 'https://docs.beagleboard.io/'
# parse version from 'VERSION' file # parse version from 'VERSION' file
with open(BBDOCS_BASE / "VERSION") as f: with open(BBDOCS_BASE / "VERSION") as f:
...@@ -84,15 +81,21 @@ with open(BBDOCS_BASE / "VERSION") as f: ...@@ -84,15 +81,21 @@ with open(BBDOCS_BASE / "VERSION") as f:
release = version 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 = { html_context = {
"display_gitlab": True, "display_gitlab": True,
"gitlab_host": "git.beagleboard.org", "show_license": True,
"gitlab_user": "docs", "docs_title": docs_title,
"gitlab_repo": "docs.beagleboard.io", "is_release": is_release,
"gitlab_version": "main", "current_version": version,
"conf_py_path": "/",
"versions": ( "versions": (
("latest", "/"), ("latest", "/"),
("0.0.7", "/0.0.7/"),
) )
} }
...@@ -119,6 +122,10 @@ latex_documents = [ ...@@ -119,6 +122,10 @@ latex_documents = [
("index-tex", "beagleboard-docs.tex", "BeagleBoard Docs", author, "manual"), ("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): def setup(app):
# theme customizations # theme customizations
app.add_css_file("css/custom.css") app.add_css_file("css/custom.css")
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment