5 changed files with 67 additions and 9 deletions
@ -0,0 +1,27 @@ |
|||||||
|
{%- if current_version %} |
||||||
|
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> |
||||||
|
<span class="rst-current-version" data-toggle="rst-current-version"> |
||||||
|
<span class="fa fa-book">Autres versions</span> |
||||||
|
v: {{ current_version.name }} |
||||||
|
<span class="fa fa-caret-down"></span> |
||||||
|
</span> |
||||||
|
<div class="rst-other-versions"> |
||||||
|
{%- if versions.tags %} |
||||||
|
<dl> |
||||||
|
<dt>Versions</dt> |
||||||
|
{%- for item in versions.tags %} |
||||||
|
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd> |
||||||
|
{%- endfor %} |
||||||
|
</dl> |
||||||
|
{%- endif %} |
||||||
|
{%- if versions.branches %} |
||||||
|
<dl> |
||||||
|
<dt>Branches</dt> |
||||||
|
{%- for item in versions.branches %} |
||||||
|
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd> |
||||||
|
{%- endfor %} |
||||||
|
</dl> |
||||||
|
{%- endif %} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{%- endif %} |
@ -0,0 +1,14 @@ |
|||||||
|
# This tiny sphinx extension will simply copy the current_version (generated by sphinx_multiversion) to the 'version' entry in html_context, so that it is correctly displayed by the ReadTheDocs template |
||||||
|
# You need to have the sphinx_multiversion extension as well |
||||||
|
|
||||||
|
def setup(app): |
||||||
|
app.connect('config-inited', config_inited) |
||||||
|
|
||||||
|
def config_inited(app, config): |
||||||
|
app.connect('html-page-context', html_page_context) |
||||||
|
|
||||||
|
def html_page_context(app, pagename, templatename, context, doctree): |
||||||
|
try: |
||||||
|
context['version'] = context['current_version'].name |
||||||
|
except: |
||||||
|
context['version'] = 'no_version_found' |
Loading…
Reference in new issue