fix RST parsing after option lists (#17442)
This commit is contained in:
parent
045400ad92
commit
46364e63cd
2 changed files with 121 additions and 1 deletions
|
|
@ -1277,6 +1277,55 @@ Test1
|
|||
let refline = "Ref. " & ref1 & "! and " & ref2 & ";and " & ref3 & "."
|
||||
doAssert refline in output1
|
||||
|
||||
test "Option lists 1":
|
||||
# check that "* b" is not consumed by previous bullet item because of
|
||||
# incorrect indentation handling in option lists
|
||||
let input = dedent """
|
||||
* a
|
||||
-m desc
|
||||
-n very long
|
||||
desc
|
||||
* b"""
|
||||
let output = input.toHtml
|
||||
check(output.count("<ul") == 1)
|
||||
check(output.count("<li>") == 2)
|
||||
check(output.count("<table") == 1)
|
||||
check("""<th align="left">-m</th><td align="left">desc</td>""" in output)
|
||||
check("""<th align="left">-n</th><td align="left">very long desc</td>""" in
|
||||
output)
|
||||
|
||||
test "Option lists 2":
|
||||
# check that 2nd option list is not united with the 1st
|
||||
let input = dedent """
|
||||
* a
|
||||
-m desc
|
||||
-n very long
|
||||
desc
|
||||
-d option"""
|
||||
let output = input.toHtml
|
||||
check(output.count("<ul") == 1)
|
||||
check(output.count("<table") == 2)
|
||||
check("""<th align="left">-m</th><td align="left">desc</td>""" in output)
|
||||
check("""<th align="left">-n</th><td align="left">very long desc</td>""" in
|
||||
output)
|
||||
check("""<th align="left">-d</th><td align="left">option</td>""" in
|
||||
output)
|
||||
|
||||
test "Option list 3 (double /)":
|
||||
let input = dedent """
|
||||
* a
|
||||
//compile compile1
|
||||
//doc doc1
|
||||
cont
|
||||
-d option"""
|
||||
let output = input.toHtml
|
||||
check(output.count("<ul") == 1)
|
||||
check(output.count("<table") == 2)
|
||||
check("""<th align="left">compile</th><td align="left">compile1</td>""" in output)
|
||||
check("""<th align="left">doc</th><td align="left">doc1 cont</td>""" in
|
||||
output)
|
||||
check("""<th align="left">-d</th><td align="left">option</td>""" in
|
||||
output)
|
||||
suite "RST/Code highlight":
|
||||
test "Basic Python code highlight":
|
||||
let pythonCode = """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue