Configuration de sphinx-multiversion
Installation : pip install sphinx-multiversion Utilisation : make html_versions
This commit is contained in:
parent
06d5b55bf4
commit
c5a2a6e495
5 changed files with 67 additions and 9 deletions
14
source/exts/rtd_current_version.py
Normal file
14
source/exts/rtd_current_version.py
Normal file
|
|
@ -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…
Add table
Add a link
Reference in a new issue