Skip to content

Commit ab58bba

Browse files
authored
Merge pull request #10502 from AA-Turner/ifconfig-fix
`ifconfig`: Add a meta node to fix iteration
2 parents 2a50b2e + c4458e3 commit ab58bba

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

sphinx/ext/ifconfig.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def process_ifconfig_nodes(app: Sphinx, doctree: nodes.document, docname: str) -
5151
ns = {confval.name: confval.value for confval in app.config}
5252
ns.update(app.config.__dict__.copy())
5353
ns['builder'] = app.builder.name
54-
for node in doctree.findall(ifconfig):
54+
for node in list(doctree.findall(ifconfig)):
5555
try:
5656
res = eval(node['expr'], ns)
5757
except Exception as err:

tests/roots/test-ext-ifconfig/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
def setup(app):
88
app.add_config_value('confval1', False, None)
99
app.add_config_value('confval2', False, None)
10+
app.add_config_value('false_config', False, None)

tests/roots/test-ext-ifconfig/index.rst

+10
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ ifconfig
99

1010
egg
1111

12+
Issue 10496 regression test
13+
===========================
14+
15+
.. ifconfig:: false_config
16+
17+
`Link 1 <https://link1.example>`__
18+
19+
.. ifconfig:: false_config
20+
21+
`Link 2 <https://link2.example>`__

0 commit comments

Comments
 (0)