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_setext_headings
is test
19 class TestCommonmarkSetextHeadings
20 super TestMarkdownHtml
24 var md
= """Foo *bar*\n=========\n\nFoo *bar*\n---------\n"""
25 var html
= """<h1>Foo <em>bar</em></h1>\n<h2>Foo <em>bar</em></h2>\n"""
26 assert md_to_html
(md
) == html
30 var md
= """Foo *bar\nbaz*\n====\n"""
31 var html
= """<h1>Foo <em>bar\nbaz</em></h1>\n"""
32 assert md_to_html
(md
) == html
36 var md
= """Foo\n-------------------------\n\nFoo\n=\n"""
37 var html
= """<h2>Foo</h2>\n<h1>Foo</h1>\n"""
38 assert md_to_html
(md
) == html
42 var md
= """ Foo\n---\n\n Foo\n-----\n\n Foo\n ===\n"""
43 var html
= """<h2>Foo</h2>\n<h2>Foo</h2>\n<h1>Foo</h1>\n"""
44 assert md_to_html
(md
) == html
48 var md
= """ Foo\n ---\n\n Foo\n---\n"""
49 var html
= """<pre><code>Foo\n---\n\nFoo\n</code></pre>\n<hr />\n"""
50 assert md_to_html
(md
) == html
54 var md
= """Foo\n ---- \n"""
55 var html
= """<h2>Foo</h2>\n"""
56 assert md_to_html
(md
) == html
60 var md
= """Foo\n ---\n"""
61 var html
= """<p>Foo\n---</p>\n"""
62 assert md_to_html
(md
) == html
66 var md
= """Foo\n= =\n\nFoo\n--- -\n"""
67 var html
= """<p>Foo\n= =</p>\n<p>Foo</p>\n<hr />\n"""
68 assert md_to_html
(md
) == html
72 var md
= """Foo \n-----\n"""
73 var html
= """<h2>Foo</h2>\n"""
74 assert md_to_html
(md
) == html
78 var md
= """Foo\\\n----\n"""
79 var html
= """<h2>Foo\\</h2>\n"""
80 assert md_to_html
(md
) == html
84 var md
= """`Foo\n----\n`\n\n<a title="a lot\n---\nof dashes"/>\n"""
85 var html
= """<h2>`Foo</h2>\n<p>`</p>\n<h2><a title="a lot</h2>\n<p>of dashes"/></p>\n"""
86 assert md_to_html
(md
) == html
90 var md
= """> Foo\n---\n"""
91 var html
= """<blockquote>\n<p>Foo</p>\n</blockquote>\n<hr />\n"""
92 assert md_to_html
(md
) == html
96 var md
= """> foo\nbar\n===\n"""
97 var html
= """<blockquote>\n<p>foo\nbar\n===</p>\n</blockquote>\n"""
98 assert md_to_html
(md
) == html
101 fun test63
is test
do
102 var md
= """- Foo\n---\n"""
103 var html
= """<ul>\n<li>Foo</li>\n</ul>\n<hr />\n"""
104 assert md_to_html
(md
) == html
107 fun test64
is test
do
108 var md
= """Foo\nBar\n---\n"""
109 var html
= """<h2>Foo\nBar</h2>\n"""
110 assert md_to_html
(md
) == html
113 fun test65
is test
do
114 var md
= """---\nFoo\n---\nBar\n---\nBaz\n"""
115 var html
= """<hr />\n<h2>Foo</h2>\n<h2>Bar</h2>\n<p>Baz</p>\n"""
116 assert md_to_html
(md
) == html
119 fun test66
is test
do
120 var md
= """\n====\n"""
121 var html
= """<p>====</p>\n"""
122 assert md_to_html
(md
) == html
125 fun test67
is test
do
126 var md
= """---\n---\n"""
127 var html
= """<hr />\n<hr />\n"""
128 assert md_to_html
(md
) == html
131 fun test68
is test
do
132 var md
= """- foo\n-----\n"""
133 var html
= """<ul>\n<li>foo</li>\n</ul>\n<hr />\n"""
134 assert md_to_html
(md
) == html
137 fun test69
is test
do
138 var md
= """ foo\n---\n"""
139 var html
= """<pre><code>foo\n</code></pre>\n<hr />\n"""
140 assert md_to_html
(md
) == html
143 fun test70
is test
do
144 var md
= """> foo\n-----\n"""
145 var html
= """<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />\n"""
146 assert md_to_html
(md
) == html
149 fun test71
is test
do
150 var md
= """\\> foo\n------\n"""
151 var html
= """<h2>> foo</h2>\n"""
152 assert md_to_html
(md
) == html
155 fun test72
is test
do
156 var md
= """Foo\n\nbar\n---\nbaz\n"""
157 var html
= """<p>Foo</p>\n<h2>bar</h2>\n<p>baz</p>\n"""
158 assert md_to_html
(md
) == html
161 fun test73
is test
do
162 var md
= """Foo\nbar\n\n---\n\nbaz\n"""
163 var html
= """<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n"""
164 assert md_to_html
(md
) == html
167 fun test74
is test
do
168 var md
= """Foo\nbar\n* * *\nbaz\n"""
169 var html
= """<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n"""
170 assert md_to_html
(md
) == html
173 fun test75
is test
do
174 var md
= """Foo\nbar\n\\---\nbaz\n"""
175 var html
= """<p>Foo\nbar\n---\nbaz</p>\n"""
176 assert md_to_html
(md
) == html