Forum | Documentation | Website | Blog

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

Fix PDF and version links

parent dd6de631
Branches
Tags
No related merge requests found
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
<div class="rst-other-versions"> <div class="rst-other-versions">
<dl> <dl>
<dt>{{ _('Document Release Versions') }}</dt> <dt>{{ _('Document Release Versions') }}</dt>
<dd><a class="reference internal" href="">latest</a></dd> <dd><a href="{{pages_url}}">latest</a></dd>
<dd><a class="reference internal" href="0.0.7">0.0.7</a></dd> <dd><a href="{{pages_url}}/0.0">0.0</a></dd>
<dd><a class="reference internal" href="0.1.0">0.1.0</a></dd> <dd><a href="{{pages_url}}/0.1">0.1</a></dd>
</dl> </dl>
<dl> <dl>
<dt>{{ _('Downloads') }}</dt> <dt>{{ _('Downloads') }}</dt>
<dd><a class="reference internal" href="beagleboard-docs.pdf">PDF</a></dd> <dd><a href="{{docs_url}}/beagleboard-docs.pdf">PDF</a></dd>
</dl> </dl>
<dl> <dl>
<dt>{{ _('BeagleBoard.org Links') }}</dt> <dt>{{ _('BeagleBoard.org Links') }}</dt>
......
...@@ -71,7 +71,7 @@ with open(BBDOCS_BASE / "VERSION") as f: ...@@ -71,7 +71,7 @@ with open(BBDOCS_BASE / "VERSION") as f:
) )
if not m: if not m:
sys.stderr.write("Warning: Could not extract kernel version\n") sys.stderr.write("Warning: Could not extract docs version\n")
version = "Unknown" version = "Unknown"
else: else:
major, minor, patch, extra = m.groups(1) major, minor, patch, extra = m.groups(1)
...@@ -81,11 +81,26 @@ with open(BBDOCS_BASE / "VERSION") as f: ...@@ -81,11 +81,26 @@ with open(BBDOCS_BASE / "VERSION") as f:
release = version release = version
is_release = tags.has("release") # pylint: disable=undefined-variable # parse pages details from 'PAGES' file
reference_prefix = "" with open(BBDOCS_BASE / "PAGES") as f:
if tags.has("publish"): # pylint: disable=undefined-variable m = re.match(
reference_prefix = f"/{version}" if is_release else "/latest" (
docs_title = "Docs / {}".format(version if is_release else "Latest") r"^PAGES_URL\s*=\s*(\S+)$\n"
+ r"^PAGES_SLUG\s*=\s*(\S+)$\n"
),
f.read(),
re.MULTILINE,
)
if not m:
sys.stderr.write("Warning: Could not extract pages information\n")
pages_url = "Unknown"
pages_slug = "Unknown"
else:
url, slug = m.groups(1)
pages_url = url
pages_slug = slug
docs_url = "/".join((url, slug))
html_context = { html_context = {
"display_gitlab": True, "display_gitlab": True,
...@@ -95,8 +110,9 @@ html_context = { ...@@ -95,8 +110,9 @@ html_context = {
"gitlab_version": "main", "gitlab_version": "main",
"conf_py_path": "/", "conf_py_path": "/",
"show_license": True, "show_license": True,
"docs_title": docs_title, "pages_url": pages_url,
"is_release": is_release, "pages_slug": pages_slug,
"docs_url": docs_url,
"current_version": version "current_version": version
} }
......
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
env env
cat << EOF > PAGES
PAGES_URL = $CI_PAGES_URL
PAGES_SLUG = $CI_COMMIT_BRANCH
EOF
if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then
rm -rf public rm -rf public
......
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