# 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'