Merge pull request #10502 from AA-Turner/ifconfig-fix

`ifconfig`: Add a meta node to fix iteration
This commit is contained in:
Takeshi KOMIYA 2022-06-03 02:15:50 +09:00 committed by GitHub
commit ab58bbaed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -51,7 +51,7 @@ def process_ifconfig_nodes(app: Sphinx, doctree: nodes.document, docname: str) -
ns = {confval.name: confval.value for confval in app.config} ns = {confval.name: confval.value for confval in app.config}
ns.update(app.config.__dict__.copy()) ns.update(app.config.__dict__.copy())
ns['builder'] = app.builder.name ns['builder'] = app.builder.name
for node in doctree.findall(ifconfig): for node in list(doctree.findall(ifconfig)):
try: try:
res = eval(node['expr'], ns) res = eval(node['expr'], ns)
except Exception as err: except Exception as err:

View File

@ -7,3 +7,4 @@ confval1 = True
def setup(app): def setup(app):
app.add_config_value('confval1', False, None) app.add_config_value('confval1', False, None)
app.add_config_value('confval2', False, None) app.add_config_value('confval2', False, None)
app.add_config_value('false_config', False, None)

View File

@ -9,3 +9,13 @@ ifconfig
egg egg
Issue 10496 regression test
===========================
.. ifconfig:: false_config
`Link 1 <https://link1.example>`__
.. ifconfig:: false_config
`Link 2 <https://link2.example>`__