diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-06-02 20:15:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-02 20:15:50 +0300 |
commit | ab58bbaed71293bf8f5738f386b853b17b4190eb (patch) | |
tree | af00d8754415033c672b88dffb6cb79a55343d3e | |
parent | 2a50b2e5a3b76d708dfb61d46bd78847353189a7 (diff) | |
parent | c4458e3adbcffced2248fb3d05a283e1754d3b7c (diff) |
Merge pull request #10502 from AA-Turner/ifconfig-fix
`ifconfig`: Add a meta node to fix iteration
-rw-r--r-- | sphinx/ext/ifconfig.py | 2 | ||||
-rw-r--r-- | tests/roots/test-ext-ifconfig/conf.py | 1 | ||||
-rw-r--r-- | tests/roots/test-ext-ifconfig/index.rst | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/sphinx/ext/ifconfig.py b/sphinx/ext/ifconfig.py index bffaa49ff..f0d115077 100644 --- a/sphinx/ext/ifconfig.py +++ b/sphinx/ext/ifconfig.py @@ -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.update(app.config.__dict__.copy()) ns['builder'] = app.builder.name - for node in doctree.findall(ifconfig): + for node in list(doctree.findall(ifconfig)): try: res = eval(node['expr'], ns) except Exception as err: diff --git a/tests/roots/test-ext-ifconfig/conf.py b/tests/roots/test-ext-ifconfig/conf.py index 565f6bcb3..e82ec79f2 100644 --- a/tests/roots/test-ext-ifconfig/conf.py +++ b/tests/roots/test-ext-ifconfig/conf.py @@ -7,3 +7,4 @@ confval1 = True def setup(app): app.add_config_value('confval1', False, None) app.add_config_value('confval2', False, None) + app.add_config_value('false_config', False, None) diff --git a/tests/roots/test-ext-ifconfig/index.rst b/tests/roots/test-ext-ifconfig/index.rst index ab08aabef..f7fabcc78 100644 --- a/tests/roots/test-ext-ifconfig/index.rst +++ b/tests/roots/test-ext-ifconfig/index.rst @@ -9,3 +9,13 @@ ifconfig egg +Issue 10496 regression test +=========================== + +.. ifconfig:: false_config + + `Link 1 <https://link1.example>`__ + +.. ifconfig:: false_config + + `Link 2 <https://link2.example>`__ |