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_indented_code_blocks
is test
19 class TestCommonmarkIndentedCodeBlocks
20 super TestMarkdownHtml
24 var md
= """ a simple\n indented code block\n"""
25 var html
= """<pre><code>a simple\n indented code block\n</code></pre>\n"""
26 assert md_to_html
(md
) == html
30 var md
= """ - foo\n\n bar\n"""
31 var html
= """<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n"""
32 assert md_to_html
(md
) == html
36 var md
= """1. foo\n\n - bar\n"""
37 var html
= """<ol>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>\n"""
38 assert md_to_html
(md
) == html
42 var md
= """ <a/>\n *hi*\n\n - one\n"""
43 var html
= """<pre><code><a/>\n*hi*\n\n- one\n</code></pre>\n"""
44 assert md_to_html
(md
) == html
48 var md
= """ chunk1\n\n chunk2\n \n \n \n chunk3\n"""
49 var html
= """<pre><code>chunk1\n\nchunk2\n\n\n\nchunk3\n</code></pre>\n"""
50 assert md_to_html
(md
) == html
54 var md
= """ chunk1\n \n chunk2\n"""
55 var html
= """<pre><code>chunk1\n \n chunk2\n</code></pre>\n"""
56 assert md_to_html
(md
) == html
60 var md
= """Foo\n bar\n\n"""
61 var html
= """<p>Foo\nbar</p>\n"""
62 assert md_to_html
(md
) == html
66 var md
= """ foo\nbar\n"""
67 var html
= """<pre><code>foo\n</code></pre>\n<p>bar</p>\n"""
68 assert md_to_html
(md
) == html
72 var md
= """# Heading\n foo\nHeading\n------\n foo\n----\n"""
73 var html
= """<h1>Heading</h1>\n<pre><code>foo\n</code></pre>\n<h2>Heading</h2>\n<pre><code>foo\n</code></pre>\n<hr />\n"""
74 assert md_to_html
(md
) == html
78 var md
= """ foo\n bar\n"""
79 var html
= """<pre><code> foo\nbar\n</code></pre>\n"""
80 assert md_to_html
(md
) == html
84 var md
= """\n \n foo\n \n\n"""
85 var html
= """<pre><code>foo\n</code></pre>\n"""
86 assert md_to_html
(md
) == html
90 var md
= """ foo \n"""
91 var html
= """<pre><code>foo \n</code></pre>\n"""
92 assert md_to_html
(md
) == html