Fix #6213: ifconfig: contents after headings are not shown

This commit is contained in:
Takeshi KOMIYA 2019-04-05 02:34:23 +09:00
parent b9153ef027
commit 338941a49a
3 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,7 @@ Bugs fixed
* #6230: Inappropriate node_id has been generated by glossary directive if term * #6230: Inappropriate node_id has been generated by glossary directive if term
is consisted by non-ASCII characters is consisted by non-ASCII characters
* #6213: ifconfig: contents after headings are not shown
Testing Testing
-------- --------

View File

@ -8,6 +8,11 @@
This extension is quite simple, and features only one directive: This extension is quite simple, and features only one directive:
.. warning::
This directive is designed to control only content of document. It could
not control sections, labels and so on.
.. rst:directive:: ifconfig .. rst:directive:: ifconfig
Include content of the directive only if the Python expression given as an Include content of the directive only if the Python expression given as an

View File

@ -23,6 +23,7 @@ from docutils import nodes
import sphinx import sphinx
from sphinx.util.docutils import SphinxDirective from sphinx.util.docutils import SphinxDirective
from sphinx.util.nodes import nested_parse_with_titles
if False: if False:
# For type annotation # For type annotation
@ -48,8 +49,7 @@ class IfConfig(SphinxDirective):
node.document = self.state.document node.document = self.state.document
self.set_source_info(node) self.set_source_info(node)
node['expr'] = self.arguments[0] node['expr'] = self.arguments[0]
self.state.nested_parse(self.content, self.content_offset, nested_parse_with_titles(self.state, self.content, node)
node, match_titles=True)
return [node] return [node]