mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #6299: rst:directive directive generates waste space
This commit is contained in:
parent
11a4e47d62
commit
1900c729a3
1
CHANGES
1
CHANGES
@ -79,6 +79,7 @@ Bugs fixed
|
|||||||
is consisted by non-ASCII characters
|
is consisted by non-ASCII characters
|
||||||
* #6213: ifconfig: contents after headings are not shown
|
* #6213: ifconfig: contents after headings are not shown
|
||||||
* commented term in glossary directive is wrongly recognized
|
* commented term in glossary directive is wrongly recognized
|
||||||
|
* #6299: rst domain: rst:directive directive generates waste space
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -80,7 +80,10 @@ def parse_directive(d):
|
|||||||
if not m:
|
if not m:
|
||||||
return (dir, '')
|
return (dir, '')
|
||||||
parsed_dir, parsed_args = m.groups()
|
parsed_dir, parsed_args = m.groups()
|
||||||
return (parsed_dir.strip(), ' ' + parsed_args.strip())
|
if parsed_args.strip():
|
||||||
|
return (parsed_dir.strip(), ' ' + parsed_args.strip())
|
||||||
|
else:
|
||||||
|
return (parsed_dir.strip(), '')
|
||||||
|
|
||||||
|
|
||||||
class ReSTDirective(ReSTMarkup):
|
class ReSTDirective(ReSTMarkup):
|
||||||
|
@ -23,7 +23,7 @@ def test_parse_directive():
|
|||||||
assert s == ('foö', '')
|
assert s == ('foö', '')
|
||||||
|
|
||||||
s = parse_directive(' .. foö :: ')
|
s = parse_directive(' .. foö :: ')
|
||||||
assert s == ('foö', ' ')
|
assert s == ('foö', '')
|
||||||
|
|
||||||
s = parse_directive('.. foö:: args1 args2')
|
s = parse_directive('.. foö:: args1 args2')
|
||||||
assert s == ('foö', ' args1 args2')
|
assert s == ('foö', ' args1 args2')
|
||||||
@ -48,8 +48,7 @@ def test_rst_directive(app):
|
|||||||
text = ".. rst:directive:: .. toctree::"
|
text = ".. rst:directive:: .. toctree::"
|
||||||
doctree = restructuredtext.parse(app, text)
|
doctree = restructuredtext.parse(app, text)
|
||||||
assert_node(doctree, (addnodes.index,
|
assert_node(doctree, (addnodes.index,
|
||||||
[desc, ([desc_signature, ([desc_name, ".. toctree::"],
|
[desc, ([desc_signature, desc_name, ".. toctree::"],
|
||||||
[desc_addname, " "])],
|
|
||||||
[desc_content, ()])]))
|
[desc_content, ()])]))
|
||||||
assert_node(doctree[0],
|
assert_node(doctree[0],
|
||||||
entries=[("single", "toctree (directive)", "directive-toctree", "", None)])
|
entries=[("single", "toctree (directive)", "directive-toctree", "", None)])
|
||||||
|
Loading…
Reference in New Issue
Block a user