mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #10502 from AA-Turner/ifconfig-fix
`ifconfig`: Add a meta node to fix iteration
This commit is contained in:
commit
ab58bbaed7
@ -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:
|
||||||
|
@ -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)
|
||||||
|
@ -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>`__
|
||||||
|
Loading…
Reference in New Issue
Block a user