1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 module test_commonmark_lists
is test
19 class TestCommonmarkLists
20 super TestMarkdownHtml
23 fun test264
is test
do
24 var md
= """- foo\n- bar\n+ baz\n"""
25 var html
= """<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<ul>\n<li>baz</li>\n</ul>\n"""
26 assert md_to_html
(md
) == html
29 fun test265
is test
do
30 var md
= """1. foo\n2. bar\n3) baz\n"""
31 var html
= """<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>\n<ol start="3">\n<li>baz</li>\n</ol>\n"""
32 assert md_to_html
(md
) == html
35 fun test266
is test
do
36 var md
= """Foo\n- bar\n- baz\n"""
37 var html
= """<p>Foo</p>\n<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n"""
38 assert md_to_html
(md
) == html
41 fun test267
is test
do
42 var md
= """The number of windows in my house is\n14. The number of doors is 6.\n"""
43 var html
= """<p>The number of windows in my house is\n14. The number of doors is 6.</p>\n"""
44 assert md_to_html
(md
) == html
47 fun test268
is test
do
48 var md
= """The number of windows in my house is\n1. The number of doors is 6.\n"""
49 var html
= """<p>The number of windows in my house is</p>\n<ol>\n<li>The number of doors is 6.</li>\n</ol>\n"""
50 assert md_to_html
(md
) == html
53 fun test269
is test
do
54 var md
= """- foo\n\n- bar\n\n\n- baz\n"""
55 var html
= """<ul>\n<li>\n<p>foo</p>\n</li>\n<li>\n<p>bar</p>\n</li>\n<li>\n<p>baz</p>\n</li>\n</ul>\n"""
56 assert md_to_html
(md
) == html
59 fun test270
is test
do
60 var md
= """- foo\n - bar\n - baz\n\n\n bim\n"""
61 var html
= """<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>\n<p>baz</p>\n<p>bim</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n"""
62 assert md_to_html
(md
) == html
65 fun test271
is test
do
66 var md
= """- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim\n"""
67 var html
= """<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<!-- -->\n<ul>\n<li>baz</li>\n<li>bim</li>\n</ul>\n"""
68 assert md_to_html
(md
) == html
71 fun test272
is test
do
72 var md
= """- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code\n"""
73 var html
= """<ul>\n<li>\n<p>foo</p>\n<p>notcode</p>\n</li>\n<li>\n<p>foo</p>\n</li>\n</ul>\n<!-- -->\n<pre><code>code\n</code></pre>\n"""
74 assert md_to_html
(md
) == html
77 fun test273
is test
do
78 var md
= """- a\n - b\n - c\n - d\n - e\n - f\n- g\n"""
79 var html
= """<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d</li>\n<li>e</li>\n<li>f</li>\n<li>g</li>\n</ul>\n"""
80 assert md_to_html
(md
) == html
83 fun test274
is test
do
84 var md
= """1. a\n\n 2. b\n\n 3. c\n"""
85 var html
= """<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ol>\n"""
86 assert md_to_html
(md
) == html
89 fun test277
is test
do
90 var md
= """- a\n- b\n\n- c\n"""
91 var html
= """<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ul>\n"""
92 assert md_to_html
(md
) == html
95 fun test278
is test
do
96 var md
= """* a\n*\n\n* c\n"""
97 var html
= """<ul>\n<li>\n<p>a</p>\n</li>\n<li></li>\n<li>\n<p>c</p>\n</li>\n</ul>\n"""
98 assert md_to_html
(md
) == html
101 fun test279
is test
do
102 var md
= """- a\n- b\n\n c\n- d\n"""
103 var html
= """<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>\n"""
104 assert md_to_html
(md
) == html
107 fun test280
is test
do
108 var md
= """- a\n- b\n\n [ref]: /url\n- d\n"""
109 var html
= """<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>\n"""
110 assert md_to_html
(md
) == html
113 fun test281
is test
do
114 var md
= """- a\n- ```\n b\n\n\n ```\n- c\n"""
115 var html
= """<ul>\n<li>a</li>\n<li>\n<pre><code>b\n\n\n</code></pre>\n</li>\n<li>c</li>\n</ul>\n"""
116 assert md_to_html
(md
) == html
119 fun test282
is test
do
120 var md
= """- a\n - b\n\n c\n- d\n"""
121 var html
= """<ul>\n<li>a\n<ul>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n</ul>\n</li>\n<li>d</li>\n</ul>\n"""
122 assert md_to_html
(md
) == html
125 fun test283
is test
do
126 var md
= """* a\n > b\n >\n* c\n"""
127 var html
= """<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>\n"""
128 assert md_to_html
(md
) == html
131 fun test284
is test
do
132 var md
= """- a\n > b\n ```\n c\n ```\n- d\n"""
133 var html
= """<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n<pre><code>c\n</code></pre>\n</li>\n<li>d</li>\n</ul>\n"""
134 assert md_to_html
(md
) == html
137 fun test285
is test
do
139 var html
= """<ul>\n<li>a</li>\n</ul>\n"""
140 assert md_to_html
(md
) == html
143 fun test286
is test
do
144 var md
= """- a\n - b\n"""
145 var html
= """<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>\n"""
146 assert md_to_html
(md
) == html
149 fun test287
is test
do
150 var md
= """1. ```\n foo\n ```\n\n bar\n"""
151 var html
= """<ol>\n<li>\n<pre><code>foo\n</code></pre>\n<p>bar</p>\n</li>\n</ol>\n"""
152 assert md_to_html
(md
) == html
155 fun test288
is test
do
156 var md
= """* foo\n * bar\n\n baz\n"""
157 var html
= """<ul>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n<p>baz</p>\n</li>\n</ul>\n"""
158 assert md_to_html
(md
) == html
161 fun test289
is test
do
162 var md
= """- a\n - b\n - c\n\n- d\n - e\n - f\n"""
163 var html
= """<ul>\n<li>\n<p>a</p>\n<ul>\n<li>b</li>\n<li>c</li>\n</ul>\n</li>\n<li>\n<p>d</p>\n<ul>\n<li>e</li>\n<li>f</li>\n</ul>\n</li>\n</ul>\n"""
164 assert md_to_html
(md
) == html