diff options
author | John Dickinson <me@not.mn> | 2016-06-01 09:57:57 -0700 |
---|---|---|
committer | Joel Wright <joel.wright@sohonet.com> | 2016-06-20 23:07:17 +0100 |
commit | 3fc15a50f63bfd1e99a1474a162d8eaa2d3aa350 (patch) | |
tree | 5f0888be95a0b16abc7eb082992ac7550e6dbf44 /oslosphinx | |
parent | d901a7bd61db6a60e909978ffa9cd0e340519cfc (diff) | |
download | oslosphinx-3fc15a50f63bfd1e99a1474a162d8eaa2d3aa350.tar.gz |
fix other versions sidebar links
Make the first one link to the current docs and the others
link with the appropriate prefix.
Filtered out previous versions that include "rc".
The number of versions is kept at 5 (current + 4 recent).
Closes-Bug: #1589731
Change-Id: I3a2e219913fc2c89634bcc2a757ccb4d3510883a
Diffstat (limited to 'oslosphinx')
-rw-r--r-- | oslosphinx/__init__.py | 8 | ||||
-rw-r--r-- | oslosphinx/theme/openstack/layout.html | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/oslosphinx/__init__.py b/oslosphinx/__init__.py index 8afd029..9a97c36 100644 --- a/oslosphinx/__init__.py +++ b/oslosphinx/__init__.py @@ -56,8 +56,12 @@ def _html_page_context(app, pagename, templatename, context, doctree): # grab last five that start with a number and reverse the order if six.PY3: raw_version_list = raw_version_list.decode("utf8") - other_versions = [t for t in raw_version_list.split('\n') - if t and t[0] in string.digits][:-6:-1] + _tags = [t.strip("'") for t in raw_version_list.split('\n')] + other_versions = [ + t for t in _tags if t and t[0] in string.digits + # Don't show alpha, beta or release candidate tags + and 'rc' not in t and 'a' not in t and 'b' not in t + ][:-5:-1] context['other_versions'] = other_versions return None diff --git a/oslosphinx/theme/openstack/layout.html b/oslosphinx/theme/openstack/layout.html index ab8e7db..c3878eb 100644 --- a/oslosphinx/theme/openstack/layout.html +++ b/oslosphinx/theme/openstack/layout.html @@ -34,9 +34,10 @@ {%- if other_versions %} <h3>{{ _('Other Versions') }}</h3> <ul class="this-page-menu"> - {%- for ver in other_versions: %} - <li><a href="/{{ver}}" rel="nofollow">{{ ver }}</a></li> - {%- endfor %} + <li><a href="{{ pathto(master_doc) }}" rel="nofollow">Current</a></li> + {%- for ver in other_versions: %} + <li><a href="{{ pathto(ver, 1) }}" rel="nofollow">{{ ver }}</a></li> + {%- endfor %} </ul> {%- endif %} {%- endblock %} |