You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
927 B
21 lines
927 B
# This module can read data from a python file in the source folder. This will read data from the version being built (as opposed to standard sphinx-multiversion behavior that executes python from the working copy) |
|
# All global variables defined in file current_version_data.py will be put in html_context['current_version_data'] which allows to use them in HTML templates. |
|
|
|
import sys |
|
|
|
current_version_data = {} |
|
|
|
def setup(app): |
|
app.add_config_value("version_sourcedir", '', "html") |
|
app.connect('config-inited', config_inited) |
|
|
|
def config_inited(app, config): |
|
app.connect('html-page-context', html_page_context) |
|
try: |
|
exec(open(app.config.version_sourcedir + '/current_version_data.py').read(), globals(), current_version_data) |
|
except: |
|
print('No file current_version_data.py found') |
|
pass |
|
|
|
def html_page_context(app, pagename, templatename, context, doctree): |
|
context['current_version_data'] = current_version_data
|
|
|