RST opt.list to have priority over def.list (#17845)
This commit is contained in:
parent
1568ae23c6
commit
3824fd3f9a
2 changed files with 28 additions and 2 deletions
|
|
@ -1867,10 +1867,10 @@ proc whichSection(p: RstParser): RstNodeKind =
|
||||||
elif match(p, p.idx, "(e) ") or match(p, p.idx, "e) ") or
|
elif match(p, p.idx, "(e) ") or match(p, p.idx, "e) ") or
|
||||||
match(p, p.idx, "e. "):
|
match(p, p.idx, "e. "):
|
||||||
result = rnEnumList
|
result = rnEnumList
|
||||||
elif isDefList(p):
|
|
||||||
result = rnDefList
|
|
||||||
elif isOptionList(p):
|
elif isOptionList(p):
|
||||||
result = rnOptionList
|
result = rnOptionList
|
||||||
|
elif isDefList(p):
|
||||||
|
result = rnDefList
|
||||||
else:
|
else:
|
||||||
result = rnParagraph
|
result = rnParagraph
|
||||||
of tkWord, tkOther, tkWhite:
|
of tkWord, tkOther, tkWhite:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''
|
output: '''
|
||||||
|
|
||||||
|
[Suite] RST parsing
|
||||||
|
|
||||||
[Suite] RST indentation
|
[Suite] RST indentation
|
||||||
|
|
||||||
[Suite] RST include directive
|
[Suite] RST include directive
|
||||||
|
|
@ -55,6 +57,30 @@ proc toAst(input: string,
|
||||||
except EParseError:
|
except EParseError:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
suite "RST parsing":
|
||||||
|
test "option list has priority over definition list":
|
||||||
|
check(dedent"""
|
||||||
|
--defusages
|
||||||
|
file
|
||||||
|
-o set
|
||||||
|
""".toAst ==
|
||||||
|
dedent"""
|
||||||
|
rnOptionList
|
||||||
|
rnOptionListItem order=1
|
||||||
|
rnOptionGroup
|
||||||
|
rnLeaf '--'
|
||||||
|
rnLeaf 'defusages'
|
||||||
|
rnDescription
|
||||||
|
rnInner
|
||||||
|
rnLeaf 'file'
|
||||||
|
rnOptionListItem order=2
|
||||||
|
rnOptionGroup
|
||||||
|
rnLeaf '-'
|
||||||
|
rnLeaf 'o'
|
||||||
|
rnDescription
|
||||||
|
rnLeaf 'set'
|
||||||
|
""")
|
||||||
|
|
||||||
suite "RST indentation":
|
suite "RST indentation":
|
||||||
test "nested bullet lists":
|
test "nested bullet lists":
|
||||||
let input = dedent """
|
let input = dedent """
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue