summary refs log tree commit diff stats
path: root/tests/stdlib/trstgen.nim
diff options
context:
space:
mode:
authorAndrey Makarov <ph.makarov@gmail.com>2020-12-31 13:20:04 +0300
committerGitHub <noreply@github.com>2020-12-31 11:20:04 +0100
commit5984f7a7dda5e6fb3119cd5705d5758e1b8f3fc7 (patch)
tree1a6b36185ba46ee8f846eb5e985245fcd91b7b36 /tests/stdlib/trstgen.nim
parent17992fca1dc0b3674dce123296b277551bbca1db (diff)
downloadNim-5984f7a7dda5e6fb3119cd5705d5758e1b8f3fc7.tar.gz
RST: improve line blocks (#16518)
Diffstat (limited to 'tests/stdlib/trstgen.nim')
-rw-r--r--tests/stdlib/trstgen.nim38
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 """
n38' href='#n38'>38 39 40 41 42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85