Skip to content

Commit

Permalink
add regression test & improve enumeration warning
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mr committed Mar 11, 2021
1 parent f9c427a commit 76fb6b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/packages/docutils/rst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ proc parseEnumList(p: var RstParser): PRstNode =
or no escaping \ at the beginning of line $1
(if lines $1..$2 are a normal paragraph, not enum. list)""".
unindent(8)
rstMessage(p, mwRstStyle, msg % [$(n-1), $n])
rstMessage(p, mwRstStyle, msg % [$(n-1), $n], p.tok[j].line, col)
result = false
else:
result = true
Expand Down
16 changes: 10 additions & 6 deletions tests/stdlib/trstgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -749,17 +749,21 @@ Test1
let input8 = dedent """
Paragraph.
A. string1
A. stringA
B. stringB
C. string1
string2
"""
let output8 = input8.toHtml(
expectWarnings = @["input(3, 0) Warning: RST style: \n" &
expectWarnings = @["input(6, 0) Warning: RST style: \n" &
"""
not enough indentation on line 4
not enough indentation on line 6
(if it's continuation of enumeration list),
or no blank line after line 3 (if it should be the next paragraph),
or no escaping \ at the beginning of line 3
(if lines 3..4 are a normal paragraph, not enum. list)""".unindent(10)])
or no blank line after line 5 (if it should be the next paragraph),
or no escaping \ at the beginning of line 5
(if lines 5..6 are a normal paragraph, not enum. list)""".unindent(10)])
doAssert output8 == "Paragraph.<ol class=\"upperalpha simple\">" &
"<li>stringA</li>\n<li>stringB</li>\n</ol>\n<p>C. string1 string2 </p>\n"

test "Markdown enumerated lists":
let input1 = dedent """
Expand Down

0 comments on commit 76fb6b9

Please sign in to comment.