mirror of
https://github.com/vale981/recommonmark
synced 2025-03-04 17:41:38 -05:00
Merge pull request #126 from molpako/fix-contents-directive
Fix contents directive
This commit is contained in:
commit
eebb02c77a
3 changed files with 18 additions and 1 deletions
|
@ -243,7 +243,7 @@ class AutoStructify(transforms.Transform):
|
|||
node = nodes.section()
|
||||
self.state_machine.state.nested_parse(
|
||||
StringList(content, source=original_node.source),
|
||||
0, node=node, match_titles=False)
|
||||
0, node=node, match_titles=True)
|
||||
return node.children[:]
|
||||
else:
|
||||
match = re.search('[ ]?[\w_-]+::.*', language)
|
||||
|
|
|
@ -13,3 +13,10 @@ A paragraph
|
|||
|
||||
Another paragraph
|
||||
|
||||
|
||||
```eval_rst
|
||||
.. contents:: Contents
|
||||
```
|
||||
|
||||
Header 2
|
||||
----------
|
||||
|
|
|
@ -210,3 +210,13 @@ class CustomExtensionTests(SphinxIntegrationTests):
|
|||
self.assertIn('<th class="head">abc</th>', output)
|
||||
self.assertIn('<th class="head">data</th>', output)
|
||||
self.assertIn('</table>', output)
|
||||
|
||||
self.assertIn(
|
||||
('<div class="contents topic" id="contents">\n'
|
||||
'<p class="topic-title first">Contents</p>\n'
|
||||
'<ul class="simple">\n'
|
||||
'<li><a class="reference internal" href="#header" id="id1">Header</a><ul>\n'
|
||||
'<li><a class="reference internal" href="#header-2" id="id2">Header 2</a></li>\n'
|
||||
'</ul>\n</li>\n</ul>'),
|
||||
output
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue