diff options
author | Andrey Makarov <ph.makarov@gmail.com> | 2020-12-31 13:20:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-31 11:20:04 +0100 |
commit | 5984f7a7dda5e6fb3119cd5705d5758e1b8f3fc7 (patch) | |
tree | 1a6b36185ba46ee8f846eb5e985245fcd91b7b36 /tests/stdlib/trstgen.nim | |
parent | 17992fca1dc0b3674dce123296b277551bbca1db (diff) | |
download | Nim-5984f7a7dda5e6fb3119cd5705d5758e1b8f3fc7.tar.gz |
RST: improve line blocks (#16518)
Diffstat (limited to 'tests/stdlib/trstgen.nim')
-rw-r--r-- | tests/stdlib/trstgen.nim | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/tests/stdlib/trstgen.nim b/tests/stdlib/trstgen.nim index 54a3db202..7acb23c5b 100644 --- a/tests/stdlib/trstgen.nim +++ b/tests/stdlib/trstgen.nim @@ -355,11 +355,41 @@ Test1 rstGenera.renderRstToOut(rstParse(input1, "", 1, 1, option, {}), output1) doAssert rstGenera.meta[metaTitle] == "Test1" # check that title was not overwritten to '|' - doAssert "line block<br />" in output1 - doAssert "other line<br />" in output1 + doAssert output1 == "<p><br/><br/>line block<br/>other line<br/></p>" let output1l = rstToLatex(input1, {}) - doAssert "line block\\\\" in output1l - doAssert "other line\\\\" in output1l + doAssert "line block\n\n" in output1l + doAssert "other line\n\n" in output1l + doAssert output1l.count("\\vspace") == 2 + 2 # +2 surrounding paddings + + let input2 = dedent""" + Paragraph1 + + | + + Paragraph2""" + + let output2 = rstToHtml(input2, {roSupportMarkdown}, defaultConfig()) + doAssert "Paragraph1<p><br/></p> <p>Paragraph2</p>\n" == output2 + + let input3 = dedent""" + | xxx + | yyy + | zzz""" + + let output3 = rstToHtml(input3, {roSupportMarkdown}, defaultConfig()) + doAssert "xxx<br/>" in output3 + doAssert "<span style=\"margin-left: 1.0em\">yyy</span><br/>" in output3 + doAssert "<span style=\"margin-left: 2.0em\">zzz</span><br/>" in output3 + + # check that '| ' with a few spaces is still parsed as new line + let input4 = dedent""" + | xxx + | + | zzz""" + + let output4 = rstToHtml(input4, {roSupportMarkdown}, defaultConfig()) + doAssert "xxx<br/><br/>" in output4 + doAssert "<span style=\"margin-left: 2.0em\">zzz</span><br/>" in output4 test "RST enumerated lists": let input1 = dedent """ |