Merge "fix other versions sidebar links"
This commit is contained in:
commit
dc8baacfbd
|
@ -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
|
||||
|
||||
|
|
|
@ -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 %}
|
||||
|
|
Loading…
Reference in New Issue