--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Generate Nitunit tests from commonmark specification.
+#
+# See the full specification and the test cases at <http://commonmark.org/>.
+#
+# Usage:
+#
+# ~~~sh
+# commonmark_gen <commonmark_tests.json> <output directory>
+# ~~~
+module commonmark_gen
+
+import json
+import json::static
+import template
+
+# Generate the test cases from the JSON testfile.
+class TestGenerator
+
+ # Input file in containing the tests in JSON format
+ var json_file: String
+
+ # Output directory where the Nitunit files will be generated
+ var output_dir: String
+
+ # Ignored tests
+ #
+ # We ignore some tests for two reasons:
+ # * because `nitmd` does not fully support UTF-8
+ # * because somes tests are wrong
+ var ignored_tests: Array[Int] do
+ var ignored = new Array[Int]
+ ignored.add_all([171, 304, 305, 306, 311, 312, 313, 477, 514]) # utf-8 tests
+ ignored.add_all([275, 276]) # spec is wrong compared to reference implementation
+ return ignored
+ end
+
+ # Load the tests files from the JSON input
+ fun load_tests: Map[String, Array[TestCase]] do
+ var json = json_file.to_path.read_all.parse_json
+ var tests = new HashMap[String, Array[TestCase]]
+
+ for obj in json.as(JsonArray) do
+ if not obj isa JsonObject then continue
+
+ var number = obj["example"].as(Int)
+ if ignored_tests.has(number) then continue
+
+ var name = "test{number}"
+
+ var section = obj["section"].as(String)
+ if not tests.has_key(section) then
+ tests[section] = new Array[TestCase]
+ end
+
+ var markdown = obj["markdown"].as(String)
+ markdown = markdown.replace("\\", "\\\\")
+ markdown = markdown.replace("\n", "\\n")
+ markdown = markdown.replace("\t", "\\t")
+
+ # fix missing chars in some tests
+ if number == 162 then
+ markdown = markdown.replace("my url", "my%20url")
+ else if number == 467 then
+ markdown = markdown.replace("my uri", "my%20uri")
+ end
+
+ var html = obj["html"].as(String)
+ html = html.replace("\\", "\\\\")
+ html = html.replace("\n", "\\n")
+ html = html.replace("\t", "\\t")
+
+ tests[section].add(new TestCase(name, markdown, html))
+ end
+
+ return tests
+ end
+
+ # Generate the Nitunit test files
+ fun gen_tests do
+ var tests = load_tests
+
+ for section, test_cases in tests do
+ var test_file = new TestFile("test_commonmark_{strip_module_name(section)}")
+ var test_class = new TestClass("TestCommonmark{strip_class_name(section)}")
+ test_class.test_cases.add_all test_cases
+ test_file.test_classes.add test_class
+ test_file.save(output_dir)
+ end
+ end
+
+ # Strip module name
+ #
+ # Used to create a Nitunit module name from a CommonMark section title.
+ fun strip_module_name(name: String): String do
+ var b = new FlatBuffer
+ for c in name do
+ if c == ' ' then
+ b.add '_'
+ else
+ if not c.is_letter and
+ not c.is_digit and
+ not allowed_id_chars.has(c) then continue
+ b.add c.to_lower
+ end
+ end
+ return b.to_s
+ end
+
+ # Strip class name
+ #
+ # Used to create a Nitunit test class name from a CommonMark section title.
+ fun strip_class_name(name: String): String do
+ var b = new FlatBuffer
+ var was_space = false
+ for c in name do
+ if c == ' ' then
+ was_space = true
+ else
+ if not c.is_letter and
+ not c.is_digit and
+ not allowed_id_chars.has(c) then continue
+ if was_space then
+ b.add c.to_upper
+ was_space = false
+ else
+ b.add c
+ end
+ end
+ end
+ return b.to_s
+ end
+
+ private var allowed_id_chars: Array[Char] = ['-', '_', ':', '.']
+end
+
+# A Nitunit test file
+class TestFile
+
+ # Test module name
+ var test_file_name: String
+
+ # Test classes in this module
+ var test_classes = new Array[TestClass]
+
+ # Copyright header and module declaration
+ fun header: String do
+ return """
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module {{{test_file_name}}} is test
+
+import test_markdown
+"""
+ end
+
+ # Render the test module as a Nit string
+ fun render: String do
+ var tpl = new Template
+ tpl.add header
+ for test_class in test_classes do
+ tpl.add test_class.render
+ end
+ return tpl.write_to_string
+ end
+
+ # Save the test module in `directory
+ fun save(directory: String) do
+ render.write_to_file(directory / "{test_file_name}.nit")
+ end
+end
+
+# A Nitunit test class
+class TestClass
+
+ # Test class name
+ var test_class_name: String
+
+ # Test cases in this test class
+ var test_cases = new Array[TestCase]
+
+ # Render the test class as a Nit string
+ fun render: String do
+ var tpl = new Template
+ tpl.addn "\nclass {test_class_name}"
+ tpl.addn "\tsuper TestMarkdownHtml"
+ tpl.addn "\ttest"
+ for test_case in test_cases do
+ tpl.add test_case.render
+ end
+ tpl.addn "end"
+ return tpl.write_to_string
+ end
+end
+
+# A Nitunit test case
+class TestCase
+
+ # Test method name
+ var test_name: String
+
+ # Markdown input
+ var markdown: String
+
+ # Expected html output
+ var html: String
+
+ # Render the test case as a Nit string
+ fun render: String do
+ var tpl = new Template
+ tpl.addn "\n\tfun {test_name} is test do"
+ tpl.addn "\t\tvar md = \"\"\"{markdown}\"\"\""
+ tpl.addn "\t\tvar html = \"\"\"{html}\"\"\""
+ tpl.addn "\t\tassert md_to_html(md) == html"
+ tpl.addn "\tend"
+ return tpl.write_to_string
+ end
+end
+
+if args.length != 2 then
+ print "Usage: commonmark_gen <tests.json> <output_dir>"
+ exit 1
+end
+
+var gen = new TestGenerator(args.first, args.last)
+gen.gen_tests
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_atx_headings is test
+
+import test_markdown
+
+class TestCommonmarkATXHeadings
+ super TestMarkdownHtml
+ test
+
+ fun test32 is test do
+ var md = """# foo\n## foo\n### foo\n#### foo\n##### foo\n###### foo\n"""
+ var html = """<h1>foo</h1>\n<h2>foo</h2>\n<h3>foo</h3>\n<h4>foo</h4>\n<h5>foo</h5>\n<h6>foo</h6>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test33 is test do
+ var md = """####### foo\n"""
+ var html = """<p>####### foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test34 is test do
+ var md = """#5 bolt\n\n#hashtag\n"""
+ var html = """<p>#5 bolt</p>\n<p>#hashtag</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test35 is test do
+ var md = """\\## foo\n"""
+ var html = """<p>## foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test36 is test do
+ var md = """# foo *bar* \\*baz\\*\n"""
+ var html = """<h1>foo <em>bar</em> *baz*</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test37 is test do
+ var md = """# foo \n"""
+ var html = """<h1>foo</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test38 is test do
+ var md = """ ### foo\n ## foo\n # foo\n"""
+ var html = """<h3>foo</h3>\n<h2>foo</h2>\n<h1>foo</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test39 is test do
+ var md = """ # foo\n"""
+ var html = """<pre><code># foo\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test40 is test do
+ var md = """foo\n # bar\n"""
+ var html = """<p>foo\n# bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test41 is test do
+ var md = """## foo ##\n ### bar ###\n"""
+ var html = """<h2>foo</h2>\n<h3>bar</h3>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test42 is test do
+ var md = """# foo ##################################\n##### foo ##\n"""
+ var html = """<h1>foo</h1>\n<h5>foo</h5>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test43 is test do
+ var md = """### foo ### \n"""
+ var html = """<h3>foo</h3>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test44 is test do
+ var md = """### foo ### b\n"""
+ var html = """<h3>foo ### b</h3>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test45 is test do
+ var md = """# foo#\n"""
+ var html = """<h1>foo#</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test46 is test do
+ var md = """### foo \\###\n## foo #\\##\n# foo \\#\n"""
+ var html = """<h3>foo ###</h3>\n<h2>foo ###</h2>\n<h1>foo #</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test47 is test do
+ var md = """****\n## foo\n****\n"""
+ var html = """<hr />\n<h2>foo</h2>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test48 is test do
+ var md = """Foo bar\n# baz\nBar foo\n"""
+ var html = """<p>Foo bar</p>\n<h1>baz</h1>\n<p>Bar foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test49 is test do
+ var md = """## \n#\n### ###\n"""
+ var html = """<h2></h2>\n<h1></h1>\n<h3></h3>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_autolinks is test
+
+import test_markdown
+
+class TestCommonmarkAutolinks
+ super TestMarkdownHtml
+ test
+
+ fun test568 is test do
+ var md = """<http://foo.bar.baz>\n"""
+ var html = """<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test569 is test do
+ var md = """<http://foo.bar.baz/test?q=hello&id=22&boolean>\n"""
+ var html = """<p><a href="http://foo.bar.baz/test?q=hello&id=22&boolean">http://foo.bar.baz/test?q=hello&id=22&boolean</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test570 is test do
+ var md = """<irc://foo.bar:2233/baz>\n"""
+ var html = """<p><a href="irc://foo.bar:2233/baz">irc://foo.bar:2233/baz</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test571 is test do
+ var md = """<MAILTO:FOO@BAR.BAZ>\n"""
+ var html = """<p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test572 is test do
+ var md = """<a+b+c:d>\n"""
+ var html = """<p><a href="a+b+c:d">a+b+c:d</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test573 is test do
+ var md = """<made-up-scheme://foo,bar>\n"""
+ var html = """<p><a href="made-up-scheme://foo,bar">made-up-scheme://foo,bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test574 is test do
+ var md = """<http://../>\n"""
+ var html = """<p><a href="http://../">http://../</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test575 is test do
+ var md = """<localhost:5001/foo>\n"""
+ var html = """<p><a href="localhost:5001/foo">localhost:5001/foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test576 is test do
+ var md = """<http://foo.bar/baz bim>\n"""
+ var html = """<p><http://foo.bar/baz bim></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test577 is test do
+ var md = """<http://example.com/\\[\\>\n"""
+ var html = """<p><a href="http://example.com/%5C%5B%5C">http://example.com/\\[\\</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test578 is test do
+ var md = """<foo@bar.example.com>\n"""
+ var html = """<p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test579 is test do
+ var md = """<foo+special@Bar.baz-bar0.com>\n"""
+ var html = """<p><a href="mailto:foo+special@Bar.baz-bar0.com">foo+special@Bar.baz-bar0.com</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test580 is test do
+ var md = """<foo\\+@bar.example.com>\n"""
+ var html = """<p><foo+@bar.example.com></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test581 is test do
+ var md = """<>\n"""
+ var html = """<p><></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test582 is test do
+ var md = """< http://foo.bar >\n"""
+ var html = """<p>< http://foo.bar ></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test583 is test do
+ var md = """<m:abc>\n"""
+ var html = """<p><m:abc></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test584 is test do
+ var md = """<foo.bar.baz>\n"""
+ var html = """<p><foo.bar.baz></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test585 is test do
+ var md = """http://example.com\n"""
+ var html = """<p>http://example.com</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test586 is test do
+ var md = """foo@bar.example.com\n"""
+ var html = """<p>foo@bar.example.com</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_backslash_escapes is test
+
+import test_markdown
+
+class TestCommonmarkBackslashEscapes
+ super TestMarkdownHtml
+ test
+
+ fun test291 is test do
+ var md = """\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\n"""
+ var html = """<p>!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test292 is test do
+ var md = """\\\t\\A\\a\\ \\3\\φ\\«\n"""
+ var html = """<p>\\\t\\A\\a\\ \\3\\φ\\«</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test293 is test do
+ var md = """\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url "not a reference"\n"""
+ var html = """<p>*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test294 is test do
+ var md = """\\\\*emphasis*\n"""
+ var html = """<p>\\<em>emphasis</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test295 is test do
+ var md = """foo\\\nbar\n"""
+ var html = """<p>foo<br />\nbar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test296 is test do
+ var md = """`` \\[\\` ``\n"""
+ var html = """<p><code>\\[\\`</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test297 is test do
+ var md = """ \\[\\]\n"""
+ var html = """<pre><code>\\[\\]\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test298 is test do
+ var md = """~~~\n\\[\\]\n~~~\n"""
+ var html = """<pre><code>\\[\\]\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test299 is test do
+ var md = """<http://example.com?find=\\*>\n"""
+ var html = """<p><a href="http://example.com?find=%5C*">http://example.com?find=\\*</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test300 is test do
+ var md = """<a href="/bar\\/)">\n"""
+ var html = """<a href="/bar\\/)">\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test301 is test do
+ var md = """[foo](/bar\\* "ti\\*tle")\n"""
+ var html = """<p><a href="/bar*" title="ti*tle">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test302 is test do
+ var md = """[foo]\n\n[foo]: /bar\\* "ti\\*tle"\n"""
+ var html = """<p><a href="/bar*" title="ti*tle">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test303 is test do
+ var md = """``` foo\\+bar\nfoo\n```\n"""
+ var html = """<pre><code class="language-foo+bar">foo\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_blank_lines is test
+
+import test_markdown
+
+class TestCommonmarkBlankLines
+ super TestMarkdownHtml
+ test
+
+ fun test190 is test do
+ var md = """ \n\naaa\n \n\n# aaa\n\n \n"""
+ var html = """<p>aaa</p>\n<h1>aaa</h1>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_block_quotes is test
+
+import test_markdown
+
+class TestCommonmarkBlockQuotes
+ super TestMarkdownHtml
+ test
+
+ fun test191 is test do
+ var md = """> # Foo\n> bar\n> baz\n"""
+ var html = """<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test192 is test do
+ var md = """># Foo\n>bar\n> baz\n"""
+ var html = """<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test193 is test do
+ var md = """ > # Foo\n > bar\n > baz\n"""
+ var html = """<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test194 is test do
+ var md = """ > # Foo\n > bar\n > baz\n"""
+ var html = """<pre><code>> # Foo\n> bar\n> baz\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test195 is test do
+ var md = """> # Foo\n> bar\nbaz\n"""
+ var html = """<blockquote>\n<h1>Foo</h1>\n<p>bar\nbaz</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test196 is test do
+ var md = """> bar\nbaz\n> foo\n"""
+ var html = """<blockquote>\n<p>bar\nbaz\nfoo</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test197 is test do
+ var md = """> foo\n---\n"""
+ var html = """<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test198 is test do
+ var md = """> - foo\n- bar\n"""
+ var html = """<blockquote>\n<ul>\n<li>foo</li>\n</ul>\n</blockquote>\n<ul>\n<li>bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test199 is test do
+ var md = """> foo\n bar\n"""
+ var html = """<blockquote>\n<pre><code>foo\n</code></pre>\n</blockquote>\n<pre><code>bar\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test200 is test do
+ var md = """> ```\nfoo\n```\n"""
+ var html = """<blockquote>\n<pre><code></code></pre>\n</blockquote>\n<p>foo</p>\n<pre><code></code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test201 is test do
+ var md = """> foo\n - bar\n"""
+ var html = """<blockquote>\n<p>foo\n- bar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test202 is test do
+ var md = """>\n"""
+ var html = """<blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test203 is test do
+ var md = """>\n> \n> \n"""
+ var html = """<blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test204 is test do
+ var md = """>\n> foo\n> \n"""
+ var html = """<blockquote>\n<p>foo</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test205 is test do
+ var md = """> foo\n\n> bar\n"""
+ var html = """<blockquote>\n<p>foo</p>\n</blockquote>\n<blockquote>\n<p>bar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test206 is test do
+ var md = """> foo\n> bar\n"""
+ var html = """<blockquote>\n<p>foo\nbar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test207 is test do
+ var md = """> foo\n>\n> bar\n"""
+ var html = """<blockquote>\n<p>foo</p>\n<p>bar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test208 is test do
+ var md = """foo\n> bar\n"""
+ var html = """<p>foo</p>\n<blockquote>\n<p>bar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test209 is test do
+ var md = """> aaa\n***\n> bbb\n"""
+ var html = """<blockquote>\n<p>aaa</p>\n</blockquote>\n<hr />\n<blockquote>\n<p>bbb</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test210 is test do
+ var md = """> bar\nbaz\n"""
+ var html = """<blockquote>\n<p>bar\nbaz</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test211 is test do
+ var md = """> bar\n\nbaz\n"""
+ var html = """<blockquote>\n<p>bar</p>\n</blockquote>\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test212 is test do
+ var md = """> bar\n>\nbaz\n"""
+ var html = """<blockquote>\n<p>bar</p>\n</blockquote>\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test213 is test do
+ var md = """> > > foo\nbar\n"""
+ var html = """<blockquote>\n<blockquote>\n<blockquote>\n<p>foo\nbar</p>\n</blockquote>\n</blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test214 is test do
+ var md = """>>> foo\n> bar\n>>baz\n"""
+ var html = """<blockquote>\n<blockquote>\n<blockquote>\n<p>foo\nbar\nbaz</p>\n</blockquote>\n</blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test215 is test do
+ var md = """> code\n\n> not code\n"""
+ var html = """<blockquote>\n<pre><code>code\n</code></pre>\n</blockquote>\n<blockquote>\n<p>not code</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_code_spans is test
+
+import test_markdown
+
+class TestCommonmarkCodeSpans
+ super TestMarkdownHtml
+ test
+
+ fun test316 is test do
+ var md = """`foo`\n"""
+ var html = """<p><code>foo</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test317 is test do
+ var md = """`` foo ` bar ``\n"""
+ var html = """<p><code>foo ` bar</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test318 is test do
+ var md = """` `` `\n"""
+ var html = """<p><code>``</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test319 is test do
+ var md = """``\nfoo\n``\n"""
+ var html = """<p><code>foo</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test320 is test do
+ var md = """`foo bar\n baz`\n"""
+ var html = """<p><code>foo bar baz</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test321 is test do
+ var md = """`a b`\n"""
+ var html = """<p><code>a b</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test322 is test do
+ var md = """`foo `` bar`\n"""
+ var html = """<p><code>foo `` bar</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test323 is test do
+ var md = """`foo\\`bar`\n"""
+ var html = """<p><code>foo\\</code>bar`</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test324 is test do
+ var md = """*foo`*`\n"""
+ var html = """<p>*foo<code>*</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test325 is test do
+ var md = """[not a `link](/foo`)\n"""
+ var html = """<p>[not a <code>link](/foo</code>)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test326 is test do
+ var md = """`<a href="`">`\n"""
+ var html = """<p><code><a href="</code>">`</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test327 is test do
+ var md = """<a href="`">`\n"""
+ var html = """<p><a href="`">`</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test328 is test do
+ var md = """`<http://foo.bar.`baz>`\n"""
+ var html = """<p><code><http://foo.bar.</code>baz>`</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test329 is test do
+ var md = """<http://foo.bar.`baz>`\n"""
+ var html = """<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test330 is test do
+ var md = """```foo``\n"""
+ var html = """<p>```foo``</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test331 is test do
+ var md = """`foo\n"""
+ var html = """<p>`foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test332 is test do
+ var md = """`foo``bar``\n"""
+ var html = """<p>`foo<code>bar</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_emphasis_and_strong_emphasis is test
+
+import test_markdown
+
+class TestCommonmarkEmphasisAndStrongEmphasis
+ super TestMarkdownHtml
+ test
+
+ fun test333 is test do
+ var md = """*foo bar*\n"""
+ var html = """<p><em>foo bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test334 is test do
+ var md = """a * foo bar*\n"""
+ var html = """<p>a * foo bar*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test335 is test do
+ var md = """a*"foo"*\n"""
+ var html = """<p>a*"foo"*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test336 is test do
+ var md = """* a *\n"""
+ var html = """<p>* a *</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test337 is test do
+ var md = """foo*bar*\n"""
+ var html = """<p>foo<em>bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test338 is test do
+ var md = """5*6*78\n"""
+ var html = """<p>5<em>6</em>78</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test339 is test do
+ var md = """_foo bar_\n"""
+ var html = """<p><em>foo bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test340 is test do
+ var md = """_ foo bar_\n"""
+ var html = """<p>_ foo bar_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test341 is test do
+ var md = """a_"foo"_\n"""
+ var html = """<p>a_"foo"_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test342 is test do
+ var md = """foo_bar_\n"""
+ var html = """<p>foo_bar_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test343 is test do
+ var md = """5_6_78\n"""
+ var html = """<p>5_6_78</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test344 is test do
+ var md = """пристаням_стремятся_\n"""
+ var html = """<p>пристаням_стремятся_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test345 is test do
+ var md = """aa_"bb"_cc\n"""
+ var html = """<p>aa_"bb"_cc</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test346 is test do
+ var md = """foo-_(bar)_\n"""
+ var html = """<p>foo-<em>(bar)</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test347 is test do
+ var md = """_foo*\n"""
+ var html = """<p>_foo*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test348 is test do
+ var md = """*foo bar *\n"""
+ var html = """<p>*foo bar *</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test349 is test do
+ var md = """*foo bar\n*\n"""
+ var html = """<p>*foo bar\n*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test350 is test do
+ var md = """*(*foo)\n"""
+ var html = """<p>*(*foo)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test351 is test do
+ var md = """*(*foo*)*\n"""
+ var html = """<p><em>(<em>foo</em>)</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test352 is test do
+ var md = """*foo*bar\n"""
+ var html = """<p><em>foo</em>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test353 is test do
+ var md = """_foo bar _\n"""
+ var html = """<p>_foo bar _</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test354 is test do
+ var md = """_(_foo)\n"""
+ var html = """<p>_(_foo)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test355 is test do
+ var md = """_(_foo_)_\n"""
+ var html = """<p><em>(<em>foo</em>)</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test356 is test do
+ var md = """_foo_bar\n"""
+ var html = """<p>_foo_bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test357 is test do
+ var md = """_пристаням_стремятся\n"""
+ var html = """<p>_пристаням_стремятся</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test358 is test do
+ var md = """_foo_bar_baz_\n"""
+ var html = """<p><em>foo_bar_baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test359 is test do
+ var md = """_(bar)_.\n"""
+ var html = """<p><em>(bar)</em>.</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test360 is test do
+ var md = """**foo bar**\n"""
+ var html = """<p><strong>foo bar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test361 is test do
+ var md = """** foo bar**\n"""
+ var html = """<p>** foo bar**</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test362 is test do
+ var md = """a**"foo"**\n"""
+ var html = """<p>a**"foo"**</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test363 is test do
+ var md = """foo**bar**\n"""
+ var html = """<p>foo<strong>bar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test364 is test do
+ var md = """__foo bar__\n"""
+ var html = """<p><strong>foo bar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test365 is test do
+ var md = """__ foo bar__\n"""
+ var html = """<p>__ foo bar__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test366 is test do
+ var md = """__\nfoo bar__\n"""
+ var html = """<p>__\nfoo bar__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test367 is test do
+ var md = """a__"foo"__\n"""
+ var html = """<p>a__"foo"__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test368 is test do
+ var md = """foo__bar__\n"""
+ var html = """<p>foo__bar__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test369 is test do
+ var md = """5__6__78\n"""
+ var html = """<p>5__6__78</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test370 is test do
+ var md = """пристаням__стремятся__\n"""
+ var html = """<p>пристаням__стремятся__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test371 is test do
+ var md = """__foo, __bar__, baz__\n"""
+ var html = """<p><strong>foo, <strong>bar</strong>, baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test372 is test do
+ var md = """foo-__(bar)__\n"""
+ var html = """<p>foo-<strong>(bar)</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test373 is test do
+ var md = """**foo bar **\n"""
+ var html = """<p>**foo bar **</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test374 is test do
+ var md = """**(**foo)\n"""
+ var html = """<p>**(**foo)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test375 is test do
+ var md = """*(**foo**)*\n"""
+ var html = """<p><em>(<strong>foo</strong>)</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test376 is test do
+ var md = """**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**\n"""
+ var html = """<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn.\n<em>Asclepias physocarpa</em>)</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test377 is test do
+ var md = """**foo "*bar*" foo**\n"""
+ var html = """<p><strong>foo "<em>bar</em>" foo</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test378 is test do
+ var md = """**foo**bar\n"""
+ var html = """<p><strong>foo</strong>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test379 is test do
+ var md = """__foo bar __\n"""
+ var html = """<p>__foo bar __</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test380 is test do
+ var md = """__(__foo)\n"""
+ var html = """<p>__(__foo)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test381 is test do
+ var md = """_(__foo__)_\n"""
+ var html = """<p><em>(<strong>foo</strong>)</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test382 is test do
+ var md = """__foo__bar\n"""
+ var html = """<p>__foo__bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test383 is test do
+ var md = """__пристаням__стремятся\n"""
+ var html = """<p>__пристаням__стремятся</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test384 is test do
+ var md = """__foo__bar__baz__\n"""
+ var html = """<p><strong>foo__bar__baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test385 is test do
+ var md = """__(bar)__.\n"""
+ var html = """<p><strong>(bar)</strong>.</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test386 is test do
+ var md = """*foo [bar](/url)*\n"""
+ var html = """<p><em>foo <a href="/url">bar</a></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test387 is test do
+ var md = """*foo\nbar*\n"""
+ var html = """<p><em>foo\nbar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test388 is test do
+ var md = """_foo __bar__ baz_\n"""
+ var html = """<p><em>foo <strong>bar</strong> baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test389 is test do
+ var md = """_foo _bar_ baz_\n"""
+ var html = """<p><em>foo <em>bar</em> baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test390 is test do
+ var md = """__foo_ bar_\n"""
+ var html = """<p><em><em>foo</em> bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test391 is test do
+ var md = """*foo *bar**\n"""
+ var html = """<p><em>foo <em>bar</em></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test392 is test do
+ var md = """*foo **bar** baz*\n"""
+ var html = """<p><em>foo <strong>bar</strong> baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test393 is test do
+ var md = """*foo**bar**baz*\n"""
+ var html = """<p><em>foo<strong>bar</strong>baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test394 is test do
+ var md = """*foo**bar*\n"""
+ var html = """<p><em>foo**bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test395 is test do
+ var md = """***foo** bar*\n"""
+ var html = """<p><em><strong>foo</strong> bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test396 is test do
+ var md = """*foo **bar***\n"""
+ var html = """<p><em>foo <strong>bar</strong></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test397 is test do
+ var md = """*foo**bar***\n"""
+ var html = """<p><em>foo<strong>bar</strong></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test398 is test do
+ var md = """*foo **bar *baz* bim** bop*\n"""
+ var html = """<p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test399 is test do
+ var md = """*foo [*bar*](/url)*\n"""
+ var html = """<p><em>foo <a href="/url"><em>bar</em></a></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test400 is test do
+ var md = """** is not an empty emphasis\n"""
+ var html = """<p>** is not an empty emphasis</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test401 is test do
+ var md = """**** is not an empty strong emphasis\n"""
+ var html = """<p>**** is not an empty strong emphasis</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test402 is test do
+ var md = """**foo [bar](/url)**\n"""
+ var html = """<p><strong>foo <a href="/url">bar</a></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test403 is test do
+ var md = """**foo\nbar**\n"""
+ var html = """<p><strong>foo\nbar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test404 is test do
+ var md = """__foo _bar_ baz__\n"""
+ var html = """<p><strong>foo <em>bar</em> baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test405 is test do
+ var md = """__foo __bar__ baz__\n"""
+ var html = """<p><strong>foo <strong>bar</strong> baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test406 is test do
+ var md = """____foo__ bar__\n"""
+ var html = """<p><strong><strong>foo</strong> bar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test407 is test do
+ var md = """**foo **bar****\n"""
+ var html = """<p><strong>foo <strong>bar</strong></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test408 is test do
+ var md = """**foo *bar* baz**\n"""
+ var html = """<p><strong>foo <em>bar</em> baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test409 is test do
+ var md = """**foo*bar*baz**\n"""
+ var html = """<p><strong>foo<em>bar</em>baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test410 is test do
+ var md = """***foo* bar**\n"""
+ var html = """<p><strong><em>foo</em> bar</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test411 is test do
+ var md = """**foo *bar***\n"""
+ var html = """<p><strong>foo <em>bar</em></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test412 is test do
+ var md = """**foo *bar **baz**\nbim* bop**\n"""
+ var html = """<p><strong>foo <em>bar <strong>baz</strong>\nbim</em> bop</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test413 is test do
+ var md = """**foo [*bar*](/url)**\n"""
+ var html = """<p><strong>foo <a href="/url"><em>bar</em></a></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test414 is test do
+ var md = """__ is not an empty emphasis\n"""
+ var html = """<p>__ is not an empty emphasis</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test415 is test do
+ var md = """____ is not an empty strong emphasis\n"""
+ var html = """<p>____ is not an empty strong emphasis</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test416 is test do
+ var md = """foo ***\n"""
+ var html = """<p>foo ***</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test417 is test do
+ var md = """foo *\\**\n"""
+ var html = """<p>foo <em>*</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test418 is test do
+ var md = """foo *_*\n"""
+ var html = """<p>foo <em>_</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test419 is test do
+ var md = """foo *****\n"""
+ var html = """<p>foo *****</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test420 is test do
+ var md = """foo **\\***\n"""
+ var html = """<p>foo <strong>*</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test421 is test do
+ var md = """foo **_**\n"""
+ var html = """<p>foo <strong>_</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test422 is test do
+ var md = """**foo*\n"""
+ var html = """<p>*<em>foo</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test423 is test do
+ var md = """*foo**\n"""
+ var html = """<p><em>foo</em>*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test424 is test do
+ var md = """***foo**\n"""
+ var html = """<p>*<strong>foo</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test425 is test do
+ var md = """****foo*\n"""
+ var html = """<p>***<em>foo</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test426 is test do
+ var md = """**foo***\n"""
+ var html = """<p><strong>foo</strong>*</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test427 is test do
+ var md = """*foo****\n"""
+ var html = """<p><em>foo</em>***</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test428 is test do
+ var md = """foo ___\n"""
+ var html = """<p>foo ___</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test429 is test do
+ var md = """foo _\\__\n"""
+ var html = """<p>foo <em>_</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test430 is test do
+ var md = """foo _*_\n"""
+ var html = """<p>foo <em>*</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test431 is test do
+ var md = """foo _____\n"""
+ var html = """<p>foo _____</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test432 is test do
+ var md = """foo __\\___\n"""
+ var html = """<p>foo <strong>_</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test433 is test do
+ var md = """foo __*__\n"""
+ var html = """<p>foo <strong>*</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test434 is test do
+ var md = """__foo_\n"""
+ var html = """<p>_<em>foo</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test435 is test do
+ var md = """_foo__\n"""
+ var html = """<p><em>foo</em>_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test436 is test do
+ var md = """___foo__\n"""
+ var html = """<p>_<strong>foo</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test437 is test do
+ var md = """____foo_\n"""
+ var html = """<p>___<em>foo</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test438 is test do
+ var md = """__foo___\n"""
+ var html = """<p><strong>foo</strong>_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test439 is test do
+ var md = """_foo____\n"""
+ var html = """<p><em>foo</em>___</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test440 is test do
+ var md = """**foo**\n"""
+ var html = """<p><strong>foo</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test441 is test do
+ var md = """*_foo_*\n"""
+ var html = """<p><em><em>foo</em></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test442 is test do
+ var md = """__foo__\n"""
+ var html = """<p><strong>foo</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test443 is test do
+ var md = """_*foo*_\n"""
+ var html = """<p><em><em>foo</em></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test444 is test do
+ var md = """****foo****\n"""
+ var html = """<p><strong><strong>foo</strong></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test445 is test do
+ var md = """____foo____\n"""
+ var html = """<p><strong><strong>foo</strong></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test446 is test do
+ var md = """******foo******\n"""
+ var html = """<p><strong><strong><strong>foo</strong></strong></strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test447 is test do
+ var md = """***foo***\n"""
+ var html = """<p><em><strong>foo</strong></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test448 is test do
+ var md = """_____foo_____\n"""
+ var html = """<p><em><strong><strong>foo</strong></strong></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test449 is test do
+ var md = """*foo _bar* baz_\n"""
+ var html = """<p><em>foo _bar</em> baz_</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test450 is test do
+ var md = """*foo __bar *baz bim__ bam*\n"""
+ var html = """<p><em>foo <strong>bar *baz bim</strong> bam</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test451 is test do
+ var md = """**foo **bar baz**\n"""
+ var html = """<p>**foo <strong>bar baz</strong></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test452 is test do
+ var md = """*foo *bar baz*\n"""
+ var html = """<p>*foo <em>bar baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test453 is test do
+ var md = """*[bar*](/url)\n"""
+ var html = """<p>*<a href="/url">bar*</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test454 is test do
+ var md = """_foo [bar_](/url)\n"""
+ var html = """<p>_foo <a href="/url">bar_</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test455 is test do
+ var md = """*<img src="foo" title="*"/>\n"""
+ var html = """<p>*<img src="foo" title="*"/></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test456 is test do
+ var md = """**<a href="**">\n"""
+ var html = """<p>**<a href="**"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test457 is test do
+ var md = """__<a href="__">\n"""
+ var html = """<p>__<a href="__"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test458 is test do
+ var md = """*a `*`*\n"""
+ var html = """<p><em>a <code>*</code></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test459 is test do
+ var md = """_a `_`_\n"""
+ var html = """<p><em>a <code>_</code></em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test460 is test do
+ var md = """**a<http://foo.bar/?q=**>\n"""
+ var html = """<p>**a<a href="http://foo.bar/?q=**">http://foo.bar/?q=**</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test461 is test do
+ var md = """__a<http://foo.bar/?q=__>\n"""
+ var html = """<p>__a<a href="http://foo.bar/?q=__">http://foo.bar/?q=__</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_entity_and_numeric_character_references is test
+
+import test_markdown
+
+class TestCommonmarkEntityAndNumericCharacterReferences
+ super TestMarkdownHtml
+ test
+
+ fun test307 is test do
+ var md = """  &x; &#; &#x;\n�\n&#abcdef0;\n&ThisIsNotDefined; &hi?;\n"""
+ var html = """<p>&nbsp &x; &#; &#x;\n&#987654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test308 is test do
+ var md = """©\n"""
+ var html = """<p>&copy</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test309 is test do
+ var md = """&MadeUpEntity;\n"""
+ var html = """<p>&MadeUpEntity;</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test310 is test do
+ var md = """<a href="öö.html">\n"""
+ var html = """<a href="öö.html">\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test314 is test do
+ var md = """`föö`\n"""
+ var html = """<p><code>f&ouml;&ouml;</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test315 is test do
+ var md = """ föfö\n"""
+ var html = """<pre><code>f&ouml;f&ouml;\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_fenced_code_blocks is test
+
+import test_markdown
+
+class TestCommonmarkFencedCodeBlocks
+ super TestMarkdownHtml
+ test
+
+ fun test88 is test do
+ var md = """```\n<\n >\n```\n"""
+ var html = """<pre><code><\n >\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test89 is test do
+ var md = """~~~\n<\n >\n~~~\n"""
+ var html = """<pre><code><\n >\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test90 is test do
+ var md = """``\nfoo\n``\n"""
+ var html = """<p><code>foo</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test91 is test do
+ var md = """```\naaa\n~~~\n```\n"""
+ var html = """<pre><code>aaa\n~~~\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test92 is test do
+ var md = """~~~\naaa\n```\n~~~\n"""
+ var html = """<pre><code>aaa\n```\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test93 is test do
+ var md = """````\naaa\n```\n``````\n"""
+ var html = """<pre><code>aaa\n```\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test94 is test do
+ var md = """~~~~\naaa\n~~~\n~~~~\n"""
+ var html = """<pre><code>aaa\n~~~\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test95 is test do
+ var md = """```\n"""
+ var html = """<pre><code></code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test96 is test do
+ var md = """`````\n\n```\naaa\n"""
+ var html = """<pre><code>\n```\naaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test97 is test do
+ var md = """> ```\n> aaa\n\nbbb\n"""
+ var html = """<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test98 is test do
+ var md = """```\n\n \n```\n"""
+ var html = """<pre><code>\n \n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test99 is test do
+ var md = """```\n```\n"""
+ var html = """<pre><code></code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test100 is test do
+ var md = """ ```\n aaa\naaa\n```\n"""
+ var html = """<pre><code>aaa\naaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test101 is test do
+ var md = """ ```\naaa\n aaa\naaa\n ```\n"""
+ var html = """<pre><code>aaa\naaa\naaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test102 is test do
+ var md = """ ```\n aaa\n aaa\n aaa\n ```\n"""
+ var html = """<pre><code>aaa\n aaa\naaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test103 is test do
+ var md = """ ```\n aaa\n ```\n"""
+ var html = """<pre><code>```\naaa\n```\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test104 is test do
+ var md = """```\naaa\n ```\n"""
+ var html = """<pre><code>aaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test105 is test do
+ var md = """ ```\naaa\n ```\n"""
+ var html = """<pre><code>aaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test106 is test do
+ var md = """```\naaa\n ```\n"""
+ var html = """<pre><code>aaa\n ```\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test107 is test do
+ var md = """``` ```\naaa\n"""
+ var html = """<p><code></code>\naaa</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test108 is test do
+ var md = """~~~~~~\naaa\n~~~ ~~\n"""
+ var html = """<pre><code>aaa\n~~~ ~~\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test109 is test do
+ var md = """foo\n```\nbar\n```\nbaz\n"""
+ var html = """<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test110 is test do
+ var md = """foo\n---\n~~~\nbar\n~~~\n# baz\n"""
+ var html = """<h2>foo</h2>\n<pre><code>bar\n</code></pre>\n<h1>baz</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test111 is test do
+ var md = """```ruby\ndef foo(x)\n return 3\nend\n```\n"""
+ var html = """<pre><code class="language-ruby">def foo(x)\n return 3\nend\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test112 is test do
+ var md = """~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~\n"""
+ var html = """<pre><code class="language-ruby">def foo(x)\n return 3\nend\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test113 is test do
+ var md = """````;\n````\n"""
+ var html = """<pre><code class="language-;"></code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test114 is test do
+ var md = """``` aa ```\nfoo\n"""
+ var html = """<p><code>aa</code>\nfoo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test115 is test do
+ var md = """```\n``` aaa\n```\n"""
+ var html = """<pre><code>``` aaa\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_hard_line_breaks is test
+
+import test_markdown
+
+class TestCommonmarkHardLineBreaks
+ super TestMarkdownHtml
+ test
+
+ fun test608 is test do
+ var md = """foo \nbaz\n"""
+ var html = """<p>foo<br />\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test609 is test do
+ var md = """foo\\\nbaz\n"""
+ var html = """<p>foo<br />\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test610 is test do
+ var md = """foo \nbaz\n"""
+ var html = """<p>foo<br />\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test611 is test do
+ var md = """foo \n bar\n"""
+ var html = """<p>foo<br />\nbar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test612 is test do
+ var md = """foo\\\n bar\n"""
+ var html = """<p>foo<br />\nbar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test613 is test do
+ var md = """*foo \nbar*\n"""
+ var html = """<p><em>foo<br />\nbar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test614 is test do
+ var md = """*foo\\\nbar*\n"""
+ var html = """<p><em>foo<br />\nbar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test615 is test do
+ var md = """`code \nspan`\n"""
+ var html = """<p><code>code span</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test616 is test do
+ var md = """`code\\\nspan`\n"""
+ var html = """<p><code>code\\ span</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test617 is test do
+ var md = """<a href="foo \nbar">\n"""
+ var html = """<p><a href="foo \nbar"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test618 is test do
+ var md = """<a href="foo\\\nbar">\n"""
+ var html = """<p><a href="foo\\\nbar"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test619 is test do
+ var md = """foo\\\n"""
+ var html = """<p>foo\\</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test620 is test do
+ var md = """foo \n"""
+ var html = """<p>foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test621 is test do
+ var md = """### foo\\\n"""
+ var html = """<h3>foo\\</h3>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test622 is test do
+ var md = """### foo \n"""
+ var html = """<h3>foo</h3>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_html_blocks is test
+
+import test_markdown
+
+class TestCommonmarkHTMLBlocks
+ super TestMarkdownHtml
+ test
+
+ fun test116 is test do
+ var md = """<table><tr><td>\n<pre>\n**Hello**,\n\n_world_.\n</pre>\n</td></tr></table>\n"""
+ var html = """<table><tr><td>\n<pre>\n**Hello**,\n<p><em>world</em>.\n</pre></p>\n</td></tr></table>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test117 is test do
+ var md = """<table>\n <tr>\n <td>\n hi\n </td>\n </tr>\n</table>\n\nokay.\n"""
+ var html = """<table>\n <tr>\n <td>\n hi\n </td>\n </tr>\n</table>\n<p>okay.</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test118 is test do
+ var md = """ <div>\n *hello*\n <foo><a>\n"""
+ var html = """ <div>\n *hello*\n <foo><a>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test119 is test do
+ var md = """</div>\n*foo*\n"""
+ var html = """</div>\n*foo*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test120 is test do
+ var md = """<DIV CLASS="foo">\n\n*Markdown*\n\n</DIV>\n"""
+ var html = """<DIV CLASS="foo">\n<p><em>Markdown</em></p>\n</DIV>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test121 is test do
+ var md = """<div id="foo"\n class="bar">\n</div>\n"""
+ var html = """<div id="foo"\n class="bar">\n</div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test122 is test do
+ var md = """<div id="foo" class="bar\n baz">\n</div>\n"""
+ var html = """<div id="foo" class="bar\n baz">\n</div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test123 is test do
+ var md = """<div>\n*foo*\n\n*bar*\n"""
+ var html = """<div>\n*foo*\n<p><em>bar</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test124 is test do
+ var md = """<div id="foo"\n*hi*\n"""
+ var html = """<div id="foo"\n*hi*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test125 is test do
+ var md = """<div class\nfoo\n"""
+ var html = """<div class\nfoo\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test126 is test do
+ var md = """<div *???-&&&-<---\n*foo*\n"""
+ var html = """<div *???-&&&-<---\n*foo*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test127 is test do
+ var md = """<div><a href="bar">*foo*</a></div>\n"""
+ var html = """<div><a href="bar">*foo*</a></div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test128 is test do
+ var md = """<table><tr><td>\nfoo\n</td></tr></table>\n"""
+ var html = """<table><tr><td>\nfoo\n</td></tr></table>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test129 is test do
+ var md = """<div></div>\n``` c\nint x = 33;\n```\n"""
+ var html = """<div></div>\n``` c\nint x = 33;\n```\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test130 is test do
+ var md = """<a href="foo">\n*bar*\n</a>\n"""
+ var html = """<a href="foo">\n*bar*\n</a>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test131 is test do
+ var md = """<Warning>\n*bar*\n</Warning>\n"""
+ var html = """<Warning>\n*bar*\n</Warning>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test132 is test do
+ var md = """<i class="foo">\n*bar*\n</i>\n"""
+ var html = """<i class="foo">\n*bar*\n</i>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test133 is test do
+ var md = """</ins>\n*bar*\n"""
+ var html = """</ins>\n*bar*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test134 is test do
+ var md = """<del>\n*foo*\n</del>\n"""
+ var html = """<del>\n*foo*\n</del>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test135 is test do
+ var md = """<del>\n\n*foo*\n\n</del>\n"""
+ var html = """<del>\n<p><em>foo</em></p>\n</del>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test136 is test do
+ var md = """<del>*foo*</del>\n"""
+ var html = """<p><del><em>foo</em></del></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test137 is test do
+ var md = """<pre language="haskell"><code>\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n</code></pre>\nokay\n"""
+ var html = """<pre language="haskell"><code>\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n</code></pre>\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test138 is test do
+ var md = """<script type="text/javascript">\n// JavaScript example\n\ndocument.getElementById("demo").innerHTML = "Hello JavaScript!";\n</script>\nokay\n"""
+ var html = """<script type="text/javascript">\n// JavaScript example\n\ndocument.getElementById("demo").innerHTML = "Hello JavaScript!";\n</script>\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test139 is test do
+ var md = """<style\n type="text/css">\nh1 {color:red;}\n\np {color:blue;}\n</style>\nokay\n"""
+ var html = """<style\n type="text/css">\nh1 {color:red;}\n\np {color:blue;}\n</style>\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test140 is test do
+ var md = """<style\n type="text/css">\n\nfoo\n"""
+ var html = """<style\n type="text/css">\n\nfoo\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test141 is test do
+ var md = """> <div>\n> foo\n\nbar\n"""
+ var html = """<blockquote>\n<div>\nfoo\n</blockquote>\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test142 is test do
+ var md = """- <div>\n- foo\n"""
+ var html = """<ul>\n<li>\n<div>\n</li>\n<li>foo</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test143 is test do
+ var md = """<style>p{color:red;}</style>\n*foo*\n"""
+ var html = """<style>p{color:red;}</style>\n<p><em>foo</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test144 is test do
+ var md = """<!-- foo -->*bar*\n*baz*\n"""
+ var html = """<!-- foo -->*bar*\n<p><em>baz</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test145 is test do
+ var md = """<script>\nfoo\n</script>1. *bar*\n"""
+ var html = """<script>\nfoo\n</script>1. *bar*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test146 is test do
+ var md = """<!-- Foo\n\nbar\n baz -->\nokay\n"""
+ var html = """<!-- Foo\n\nbar\n baz -->\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test147 is test do
+ var md = """<?php\n\n echo '>';\n\n?>\nokay\n"""
+ var html = """<?php\n\n echo '>';\n\n?>\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test148 is test do
+ var md = """<!DOCTYPE html>\n"""
+ var html = """<!DOCTYPE html>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test149 is test do
+ var md = """<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\nokay\n"""
+ var html = """<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\n<p>okay</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test150 is test do
+ var md = """ <!-- foo -->\n\n <!-- foo -->\n"""
+ var html = """ <!-- foo -->\n<pre><code><!-- foo -->\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test151 is test do
+ var md = """ <div>\n\n <div>\n"""
+ var html = """ <div>\n<pre><code><div>\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test152 is test do
+ var md = """Foo\n<div>\nbar\n</div>\n"""
+ var html = """<p>Foo</p>\n<div>\nbar\n</div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test153 is test do
+ var md = """<div>\nbar\n</div>\n*foo*\n"""
+ var html = """<div>\nbar\n</div>\n*foo*\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test154 is test do
+ var md = """Foo\n<a href="bar">\nbaz\n"""
+ var html = """<p>Foo\n<a href="bar">\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test155 is test do
+ var md = """<div>\n\n*Emphasized* text.\n\n</div>\n"""
+ var html = """<div>\n<p><em>Emphasized</em> text.</p>\n</div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test156 is test do
+ var md = """<div>\n*Emphasized* text.\n</div>\n"""
+ var html = """<div>\n*Emphasized* text.\n</div>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test157 is test do
+ var md = """<table>\n\n<tr>\n\n<td>\nHi\n</td>\n\n</tr>\n\n</table>\n"""
+ var html = """<table>\n<tr>\n<td>\nHi\n</td>\n</tr>\n</table>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test158 is test do
+ var md = """<table>\n\n <tr>\n\n <td>\n Hi\n </td>\n\n </tr>\n\n</table>\n"""
+ var html = """<table>\n <tr>\n<pre><code><td>\n Hi\n</td>\n</code></pre>\n </tr>\n</table>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_images is test
+
+import test_markdown
+
+class TestCommonmarkImages
+ super TestMarkdownHtml
+ test
+
+ fun test546 is test do
+ var md = """![foo](/url "title")\n"""
+ var html = """<p><img src="/url" alt="foo" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test547 is test do
+ var md = """![foo *bar*]\n\n[foo *bar*]: train.jpg "train & tracks"\n"""
+ var html = """<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test548 is test do
+ var md = """![foo ![bar](/url)](/url2)\n"""
+ var html = """<p><img src="/url2" alt="foo bar" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test549 is test do
+ var md = """![foo [bar](/url)](/url2)\n"""
+ var html = """<p><img src="/url2" alt="foo bar" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test550 is test do
+ var md = """![foo *bar*][]\n\n[foo *bar*]: train.jpg "train & tracks"\n"""
+ var html = """<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test551 is test do
+ var md = """![foo *bar*][foobar]\n\n[FOOBAR]: train.jpg "train & tracks"\n"""
+ var html = """<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test552 is test do
+ var md = """![foo](train.jpg)\n"""
+ var html = """<p><img src="train.jpg" alt="foo" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test553 is test do
+ var md = """My ![foo bar](/path/to/train.jpg "title" )\n"""
+ var html = """<p>My <img src="/path/to/train.jpg" alt="foo bar" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test554 is test do
+ var md = """![foo](<url>)\n"""
+ var html = """<p><img src="url" alt="foo" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test555 is test do
+ var md = """![](/url)\n"""
+ var html = """<p><img src="/url" alt="" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test556 is test do
+ var md = """![foo][bar]\n\n[bar]: /url\n"""
+ var html = """<p><img src="/url" alt="foo" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test557 is test do
+ var md = """![foo][bar]\n\n[BAR]: /url\n"""
+ var html = """<p><img src="/url" alt="foo" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test558 is test do
+ var md = """![foo][]\n\n[foo]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="foo" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test559 is test do
+ var md = """![*foo* bar][]\n\n[*foo* bar]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="foo bar" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test560 is test do
+ var md = """![Foo][]\n\n[foo]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="Foo" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test561 is test do
+ var md = """![foo] \n[]\n\n[foo]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="foo" title="title" />\n[]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test562 is test do
+ var md = """![foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="foo" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test563 is test do
+ var md = """![*foo* bar]\n\n[*foo* bar]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="foo bar" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test564 is test do
+ var md = """![[foo]]\n\n[[foo]]: /url "title"\n"""
+ var html = """<p>![[foo]]</p>\n<p>[[foo]]: /url "title"</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test565 is test do
+ var md = """![Foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p><img src="/url" alt="Foo" title="title" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test566 is test do
+ var md = """!\\[foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p>![foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test567 is test do
+ var md = """\\![foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p>!<a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_indented_code_blocks is test
+
+import test_markdown
+
+class TestCommonmarkIndentedCodeBlocks
+ super TestMarkdownHtml
+ test
+
+ fun test76 is test do
+ var md = """ a simple\n indented code block\n"""
+ var html = """<pre><code>a simple\n indented code block\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test77 is test do
+ var md = """ - foo\n\n bar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test78 is test do
+ var md = """1. foo\n\n - bar\n"""
+ var html = """<ol>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test79 is test do
+ var md = """ <a/>\n *hi*\n\n - one\n"""
+ var html = """<pre><code><a/>\n*hi*\n\n- one\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test80 is test do
+ var md = """ chunk1\n\n chunk2\n \n \n \n chunk3\n"""
+ var html = """<pre><code>chunk1\n\nchunk2\n\n\n\nchunk3\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test81 is test do
+ var md = """ chunk1\n \n chunk2\n"""
+ var html = """<pre><code>chunk1\n \n chunk2\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test82 is test do
+ var md = """Foo\n bar\n\n"""
+ var html = """<p>Foo\nbar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test83 is test do
+ var md = """ foo\nbar\n"""
+ var html = """<pre><code>foo\n</code></pre>\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test84 is test do
+ var md = """# Heading\n foo\nHeading\n------\n foo\n----\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test85 is test do
+ var md = """ foo\n bar\n"""
+ var html = """<pre><code> foo\nbar\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test86 is test do
+ var md = """\n \n foo\n \n\n"""
+ var html = """<pre><code>foo\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test87 is test do
+ var md = """ foo \n"""
+ var html = """<pre><code>foo \n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_inlines is test
+
+import test_markdown
+
+class TestCommonmarkInlines
+ super TestMarkdownHtml
+ test
+
+ fun test290 is test do
+ var md = """`hi`lo`\n"""
+ var html = """<p><code>hi</code>lo`</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_link_reference_definitions is test
+
+import test_markdown
+
+class TestCommonmarkLinkReferenceDefinitions
+ super TestMarkdownHtml
+ test
+
+ fun test159 is test do
+ var md = """[foo]: /url "title"\n\n[foo]\n"""
+ var html = """<p><a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test160 is test do
+ var md = """ [foo]: \n /url \n 'the title' \n\n[foo]\n"""
+ var html = """<p><a href="/url" title="the title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test161 is test do
+ var md = """[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]\n"""
+ var html = """<p><a href="my_(url)" title="title (with parens)">Foo*bar]</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test162 is test do
+ var md = """[Foo bar]:\n<my%20url>\n'title'\n\n[Foo bar]\n"""
+ var html = """<p><a href="my%20url" title="title">Foo bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test163 is test do
+ var md = """[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]\n"""
+ var html = """<p><a href="/url" title="\ntitle\nline1\nline2\n">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test164 is test do
+ var md = """[foo]: /url 'title\n\nwith blank line'\n\n[foo]\n"""
+ var html = """<p>[foo]: /url 'title</p>\n<p>with blank line'</p>\n<p>[foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test165 is test do
+ var md = """[foo]:\n/url\n\n[foo]\n"""
+ var html = """<p><a href="/url">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test166 is test do
+ var md = """[foo]:\n\n[foo]\n"""
+ var html = """<p>[foo]:</p>\n<p>[foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test167 is test do
+ var md = """[foo]: /url\\bar\\*baz "foo\\"bar\\baz"\n\n[foo]\n"""
+ var html = """<p><a href="/url%5Cbar*baz" title="foo"bar\\baz">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test168 is test do
+ var md = """[foo]\n\n[foo]: url\n"""
+ var html = """<p><a href="url">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test169 is test do
+ var md = """[foo]\n\n[foo]: first\n[foo]: second\n"""
+ var html = """<p><a href="first">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test170 is test do
+ var md = """[FOO]: /url\n\n[Foo]\n"""
+ var html = """<p><a href="/url">Foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test172 is test do
+ var md = """[foo]: /url\n"""
+ var html = """"""
+ assert md_to_html(md) == html
+ end
+
+ fun test173 is test do
+ var md = """[\nfoo\n]: /url\nbar\n"""
+ var html = """<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test174 is test do
+ var md = """[foo]: /url "title" ok\n"""
+ var html = """<p>[foo]: /url "title" ok</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test175 is test do
+ var md = """[foo]: /url\n"title" ok\n"""
+ var html = """<p>"title" ok</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test176 is test do
+ var md = """ [foo]: /url "title"\n\n[foo]\n"""
+ var html = """<pre><code>[foo]: /url "title"\n</code></pre>\n<p>[foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test177 is test do
+ var md = """```\n[foo]: /url\n```\n\n[foo]\n"""
+ var html = """<pre><code>[foo]: /url\n</code></pre>\n<p>[foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test178 is test do
+ var md = """Foo\n[bar]: /baz\n\n[bar]\n"""
+ var html = """<p>Foo\n[bar]: /baz</p>\n<p>[bar]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test179 is test do
+ var md = """# [Foo]\n[foo]: /url\n> bar\n"""
+ var html = """<h1><a href="/url">Foo</a></h1>\n<blockquote>\n<p>bar</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test180 is test do
+ var md = """[foo]: /foo-url "foo"\n[bar]: /bar-url\n "bar"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]\n"""
+ var html = """<p><a href="/foo-url" title="foo">foo</a>,\n<a href="/bar-url" title="bar">bar</a>,\n<a href="/baz-url">baz</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test181 is test do
+ var md = """[foo]\n\n> [foo]: /url\n"""
+ var html = """<p><a href="/url">foo</a></p>\n<blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_links is test
+
+import test_markdown
+
+class TestCommonmarkLinks
+ super TestMarkdownHtml
+ test
+
+ fun test462 is test do
+ var md = """[link](/uri "title")\n"""
+ var html = """<p><a href="/uri" title="title">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test463 is test do
+ var md = """[link](/uri)\n"""
+ var html = """<p><a href="/uri">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test464 is test do
+ var md = """[link]()\n"""
+ var html = """<p><a href="">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test465 is test do
+ var md = """[link](<>)\n"""
+ var html = """<p><a href="">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test466 is test do
+ var md = """[link](/my uri)\n"""
+ var html = """<p>[link](/my uri)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test467 is test do
+ var md = """[link](</my%20uri>)\n"""
+ var html = """<p><a href="/my%20uri">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test468 is test do
+ var md = """[link](foo\nbar)\n"""
+ var html = """<p>[link](foo\nbar)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test469 is test do
+ var md = """[link](<foo\nbar>)\n"""
+ var html = """<p>[link](<foo\nbar>)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test470 is test do
+ var md = """[link](\\(foo\\))\n"""
+ var html = """<p><a href="(foo)">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test471 is test do
+ var md = """[link](foo(and(bar)))\n"""
+ var html = """<p><a href="foo(and(bar))">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test472 is test do
+ var md = """[link](foo\\(and\\(bar\\))\n"""
+ var html = """<p><a href="foo(and(bar)">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test473 is test do
+ var md = """[link](<foo(and(bar)>)\n"""
+ var html = """<p><a href="foo(and(bar)">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test474 is test do
+ var md = """[link](foo\\)\\:)\n"""
+ var html = """<p><a href="foo):">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test475 is test do
+ var md = """[link](#fragment)\n\n[link](http://example.com#fragment)\n\n[link](http://example.com?foo=3#frag)\n"""
+ var html = """<p><a href="#fragment">link</a></p>\n<p><a href="http://example.com#fragment">link</a></p>\n<p><a href="http://example.com?foo=3#frag">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test476 is test do
+ var md = """[link](foo\\bar)\n"""
+ var html = """<p><a href="foo%5Cbar">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test478 is test do
+ var md = """[link]("title")\n"""
+ var html = """<p><a href="%22title%22">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test479 is test do
+ var md = """[link](/url "title")\n[link](/url 'title')\n[link](/url (title))\n"""
+ var html = """<p><a href="/url" title="title">link</a>\n<a href="/url" title="title">link</a>\n<a href="/url" title="title">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test480 is test do
+ var md = """[link](/url "title \\""")\n"""
+ var html = """<p><a href="/url" title="title """>link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test481 is test do
+ var md = """[link](/url "title")\n"""
+ var html = """<p><a href="/url%C2%A0%22title%22">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test482 is test do
+ var md = """[link](/url "title "and" title")\n"""
+ var html = """<p>[link](/url "title "and" title")</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test483 is test do
+ var md = """[link](/url 'title "and" title')\n"""
+ var html = """<p><a href="/url" title="title "and" title">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test484 is test do
+ var md = """[link]( /uri\n "title" )\n"""
+ var html = """<p><a href="/uri" title="title">link</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test485 is test do
+ var md = """[link] (/uri)\n"""
+ var html = """<p>[link] (/uri)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test486 is test do
+ var md = """[link [foo [bar]]](/uri)\n"""
+ var html = """<p><a href="/uri">link [foo [bar]]</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test487 is test do
+ var md = """[link] bar](/uri)\n"""
+ var html = """<p>[link] bar](/uri)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test488 is test do
+ var md = """[link [bar](/uri)\n"""
+ var html = """<p>[link <a href="/uri">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test489 is test do
+ var md = """[link \\[bar](/uri)\n"""
+ var html = """<p><a href="/uri">link [bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test490 is test do
+ var md = """[link *foo **bar** `#`*](/uri)\n"""
+ var html = """<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test491 is test do
+ var md = """[![moon](moon.jpg)](/uri)\n"""
+ var html = """<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test492 is test do
+ var md = """[foo [bar](/uri)](/uri)\n"""
+ var html = """<p>[foo <a href="/uri">bar</a>](/uri)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test493 is test do
+ var md = """[foo *[bar [baz](/uri)](/uri)*](/uri)\n"""
+ var html = """<p>[foo <em>[bar <a href="/uri">baz</a>](/uri)</em>](/uri)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test494 is test do
+ var md = """![[[foo](uri1)](uri2)](uri3)\n"""
+ var html = """<p><img src="uri3" alt="[foo](uri2)" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test495 is test do
+ var md = """*[foo*](/uri)\n"""
+ var html = """<p>*<a href="/uri">foo*</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test496 is test do
+ var md = """[foo *bar](baz*)\n"""
+ var html = """<p><a href="baz*">foo *bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test497 is test do
+ var md = """*foo [bar* baz]\n"""
+ var html = """<p><em>foo [bar</em> baz]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test498 is test do
+ var md = """[foo <bar attr="](baz)">\n"""
+ var html = """<p>[foo <bar attr="](baz)"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test499 is test do
+ var md = """[foo`](/uri)`\n"""
+ var html = """<p>[foo<code>](/uri)</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test500 is test do
+ var md = """[foo<http://example.com/?search=](uri)>\n"""
+ var html = """<p>[foo<a href="http://example.com/?search=%5D(uri)">http://example.com/?search=](uri)</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test501 is test do
+ var md = """[foo][bar]\n\n[bar]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test502 is test do
+ var md = """[link [foo [bar]]][ref]\n\n[ref]: /uri\n"""
+ var html = """<p><a href="/uri">link [foo [bar]]</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test503 is test do
+ var md = """[link \\[bar][ref]\n\n[ref]: /uri\n"""
+ var html = """<p><a href="/uri">link [bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test504 is test do
+ var md = """[link *foo **bar** `#`*][ref]\n\n[ref]: /uri\n"""
+ var html = """<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test505 is test do
+ var md = """[![moon](moon.jpg)][ref]\n\n[ref]: /uri\n"""
+ var html = """<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test506 is test do
+ var md = """[foo [bar](/uri)][ref]\n\n[ref]: /uri\n"""
+ var html = """<p>[foo <a href="/uri">bar</a>]<a href="/uri">ref</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test507 is test do
+ var md = """[foo *bar [baz][ref]*][ref]\n\n[ref]: /uri\n"""
+ var html = """<p>[foo <em>bar <a href="/uri">baz</a></em>]<a href="/uri">ref</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test508 is test do
+ var md = """*[foo*][ref]\n\n[ref]: /uri\n"""
+ var html = """<p>*<a href="/uri">foo*</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test509 is test do
+ var md = """[foo *bar][ref]\n\n[ref]: /uri\n"""
+ var html = """<p><a href="/uri">foo *bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test510 is test do
+ var md = """[foo <bar attr="][ref]">\n\n[ref]: /uri\n"""
+ var html = """<p>[foo <bar attr="][ref]"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test511 is test do
+ var md = """[foo`][ref]`\n\n[ref]: /uri\n"""
+ var html = """<p>[foo<code>][ref]</code></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test512 is test do
+ var md = """[foo<http://example.com/?search=][ref]>\n\n[ref]: /uri\n"""
+ var html = """<p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test513 is test do
+ var md = """[foo][BaR]\n\n[bar]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test515 is test do
+ var md = """[Foo\n bar]: /url\n\n[Baz][Foo bar]\n"""
+ var html = """<p><a href="/url">Baz</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test516 is test do
+ var md = """[foo] [bar]\n\n[bar]: /url "title"\n"""
+ var html = """<p>[foo] <a href="/url" title="title">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test517 is test do
+ var md = """[foo]\n[bar]\n\n[bar]: /url "title"\n"""
+ var html = """<p>[foo]\n<a href="/url" title="title">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test518 is test do
+ var md = """[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]\n"""
+ var html = """<p><a href="/url1">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test519 is test do
+ var md = """[bar][foo\\!]\n\n[foo!]: /url\n"""
+ var html = """<p>[bar][foo!]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test520 is test do
+ var md = """[foo][ref[]\n\n[ref[]: /uri\n"""
+ var html = """<p>[foo][ref[]</p>\n<p>[ref[]: /uri</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test521 is test do
+ var md = """[foo][ref[bar]]\n\n[ref[bar]]: /uri\n"""
+ var html = """<p>[foo][ref[bar]]</p>\n<p>[ref[bar]]: /uri</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test522 is test do
+ var md = """[[[foo]]]\n\n[[[foo]]]: /url\n"""
+ var html = """<p>[[[foo]]]</p>\n<p>[[[foo]]]: /url</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test523 is test do
+ var md = """[foo][ref\\[]\n\n[ref\\[]: /uri\n"""
+ var html = """<p><a href="/uri">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test524 is test do
+ var md = """[bar\\\\]: /uri\n\n[bar\\\\]\n"""
+ var html = """<p><a href="/uri">bar\\</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test525 is test do
+ var md = """[]\n\n[]: /uri\n"""
+ var html = """<p>[]</p>\n<p>[]: /uri</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test526 is test do
+ var md = """[\n ]\n\n[\n ]: /uri\n"""
+ var html = """<p>[\n]</p>\n<p>[\n]: /uri</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test527 is test do
+ var md = """[foo][]\n\n[foo]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test528 is test do
+ var md = """[*foo* bar][]\n\n[*foo* bar]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title"><em>foo</em> bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test529 is test do
+ var md = """[Foo][]\n\n[foo]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">Foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test530 is test do
+ var md = """[foo] \n[]\n\n[foo]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">foo</a>\n[]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test531 is test do
+ var md = """[foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test532 is test do
+ var md = """[*foo* bar]\n\n[*foo* bar]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title"><em>foo</em> bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test533 is test do
+ var md = """[[*foo* bar]]\n\n[*foo* bar]: /url "title"\n"""
+ var html = """<p>[<a href="/url" title="title"><em>foo</em> bar</a>]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test534 is test do
+ var md = """[[bar [foo]\n\n[foo]: /url\n"""
+ var html = """<p>[[bar <a href="/url">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test535 is test do
+ var md = """[Foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p><a href="/url" title="title">Foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test536 is test do
+ var md = """[foo] bar\n\n[foo]: /url\n"""
+ var html = """<p><a href="/url">foo</a> bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test537 is test do
+ var md = """\\[foo]\n\n[foo]: /url "title"\n"""
+ var html = """<p>[foo]</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test538 is test do
+ var md = """[foo*]: /url\n\n*[foo*]\n"""
+ var html = """<p>*<a href="/url">foo*</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test539 is test do
+ var md = """[foo][bar]\n\n[foo]: /url1\n[bar]: /url2\n"""
+ var html = """<p><a href="/url2">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test540 is test do
+ var md = """[foo][]\n\n[foo]: /url1\n"""
+ var html = """<p><a href="/url1">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test541 is test do
+ var md = """[foo]()\n\n[foo]: /url1\n"""
+ var html = """<p><a href="">foo</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test542 is test do
+ var md = """[foo](not a link)\n\n[foo]: /url1\n"""
+ var html = """<p><a href="/url1">foo</a>(not a link)</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test543 is test do
+ var md = """[foo][bar][baz]\n\n[baz]: /url\n"""
+ var html = """<p>[foo]<a href="/url">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test544 is test do
+ var md = """[foo][bar][baz]\n\n[baz]: /url1\n[bar]: /url2\n"""
+ var html = """<p><a href="/url2">foo</a><a href="/url1">baz</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test545 is test do
+ var md = """[foo][bar][baz]\n\n[baz]: /url1\n[foo]: /url2\n"""
+ var html = """<p>[foo]<a href="/url1">bar</a></p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_list_items is test
+
+import test_markdown
+
+class TestCommonmarkListItems
+ super TestMarkdownHtml
+ test
+
+ fun test216 is test do
+ var md = """A paragraph\nwith two lines.\n\n indented code\n\n> A block quote.\n"""
+ var html = """<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test217 is test do
+ var md = """1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test218 is test do
+ var md = """- one\n\n two\n"""
+ var html = """<ul>\n<li>one</li>\n</ul>\n<p>two</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test219 is test do
+ var md = """- one\n\n two\n"""
+ var html = """<ul>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test220 is test do
+ var md = """ - one\n\n two\n"""
+ var html = """<ul>\n<li>one</li>\n</ul>\n<pre><code> two\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test221 is test do
+ var md = """ - one\n\n two\n"""
+ var html = """<ul>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test222 is test do
+ var md = """ > > 1. one\n>>\n>> two\n"""
+ var html = """<blockquote>\n<blockquote>\n<ol>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ol>\n</blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test223 is test do
+ var md = """>>- one\n>>\n > > two\n"""
+ var html = """<blockquote>\n<blockquote>\n<ul>\n<li>one</li>\n</ul>\n<p>two</p>\n</blockquote>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test224 is test do
+ var md = """-one\n\n2.two\n"""
+ var html = """<p>-one</p>\n<p>2.two</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test225 is test do
+ var md = """- foo\n\n\n bar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test226 is test do
+ var md = """1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam\n"""
+ var html = """<ol>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n<blockquote>\n<p>bam</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test227 is test do
+ var md = """- Foo\n\n bar\n\n\n baz\n"""
+ var html = """<ul>\n<li>\n<p>Foo</p>\n<pre><code>bar\n\n\nbaz\n</code></pre>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test228 is test do
+ var md = """123456789. ok\n"""
+ var html = """<ol start="123456789">\n<li>ok</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test229 is test do
+ var md = """1234567890. not ok\n"""
+ var html = """<p>1234567890. not ok</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test230 is test do
+ var md = """0. ok\n"""
+ var html = """<ol start="0">\n<li>ok</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test231 is test do
+ var md = """003. ok\n"""
+ var html = """<ol start="3">\n<li>ok</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test232 is test do
+ var md = """-1. not ok\n"""
+ var html = """<p>-1. not ok</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test233 is test do
+ var md = """- foo\n\n bar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test234 is test do
+ var md = """ 10. foo\n\n bar\n"""
+ var html = """<ol start="10">\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test235 is test do
+ var md = """ indented code\n\nparagraph\n\n more code\n"""
+ var html = """<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test236 is test do
+ var md = """1. indented code\n\n paragraph\n\n more code\n"""
+ var html = """<ol>\n<li>\n<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test237 is test do
+ var md = """1. indented code\n\n paragraph\n\n more code\n"""
+ var html = """<ol>\n<li>\n<pre><code> indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test238 is test do
+ var md = """ foo\n\nbar\n"""
+ var html = """<p>foo</p>\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test239 is test do
+ var md = """- foo\n\n bar\n"""
+ var html = """<ul>\n<li>foo</li>\n</ul>\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test240 is test do
+ var md = """- foo\n\n bar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test241 is test do
+ var md = """-\n foo\n-\n ```\n bar\n ```\n-\n baz\n"""
+ var html = """<ul>\n<li>foo</li>\n<li>\n<pre><code>bar\n</code></pre>\n</li>\n<li>\n<pre><code>baz\n</code></pre>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test242 is test do
+ var md = """- \n foo\n"""
+ var html = """<ul>\n<li>foo</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test243 is test do
+ var md = """-\n\n foo\n"""
+ var html = """<ul>\n<li></li>\n</ul>\n<p>foo</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test244 is test do
+ var md = """- foo\n-\n- bar\n"""
+ var html = """<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test245 is test do
+ var md = """- foo\n- \n- bar\n"""
+ var html = """<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test246 is test do
+ var md = """1. foo\n2.\n3. bar\n"""
+ var html = """<ol>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test247 is test do
+ var md = """*\n"""
+ var html = """<ul>\n<li></li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test248 is test do
+ var md = """foo\n*\n\nfoo\n1.\n"""
+ var html = """<p>foo\n*</p>\n<p>foo\n1.</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test249 is test do
+ var md = """ 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test250 is test do
+ var md = """ 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test251 is test do
+ var md = """ 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test252 is test do
+ var md = """ 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<pre><code>1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test253 is test do
+ var md = """ 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote.\n"""
+ var html = """<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test254 is test do
+ var md = """ 1. A paragraph\n with two lines.\n"""
+ var html = """<ol>\n<li>A paragraph\nwith two lines.</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test255 is test do
+ var md = """> 1. > Blockquote\ncontinued here.\n"""
+ var html = """<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test256 is test do
+ var md = """> 1. > Blockquote\n> continued here.\n"""
+ var html = """<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test257 is test do
+ var md = """- foo\n - bar\n - baz\n - boo\n"""
+ var html = """<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>baz\n<ul>\n<li>boo</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test258 is test do
+ var md = """- foo\n - bar\n - baz\n - boo\n"""
+ var html = """<ul>\n<li>foo</li>\n<li>bar</li>\n<li>baz</li>\n<li>boo</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test259 is test do
+ var md = """10) foo\n - bar\n"""
+ var html = """<ol start="10">\n<li>foo\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test260 is test do
+ var md = """10) foo\n - bar\n"""
+ var html = """<ol start="10">\n<li>foo</li>\n</ol>\n<ul>\n<li>bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test261 is test do
+ var md = """- - foo\n"""
+ var html = """<ul>\n<li>\n<ul>\n<li>foo</li>\n</ul>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test262 is test do
+ var md = """1. - 2. foo\n"""
+ var html = """<ol>\n<li>\n<ul>\n<li>\n<ol start="2">\n<li>foo</li>\n</ol>\n</li>\n</ul>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test263 is test do
+ var md = """- # Foo\n- Bar\n ---\n baz\n"""
+ var html = """<ul>\n<li>\n<h1>Foo</h1>\n</li>\n<li>\n<h2>Bar</h2>\nbaz</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_lists is test
+
+import test_markdown
+
+class TestCommonmarkLists
+ super TestMarkdownHtml
+ test
+
+ fun test264 is test do
+ var md = """- foo\n- bar\n+ baz\n"""
+ var html = """<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<ul>\n<li>baz</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test265 is test do
+ var md = """1. foo\n2. bar\n3) baz\n"""
+ var html = """<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>\n<ol start="3">\n<li>baz</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test266 is test do
+ var md = """Foo\n- bar\n- baz\n"""
+ var html = """<p>Foo</p>\n<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test267 is test do
+ var md = """The number of windows in my house is\n14. The number of doors is 6.\n"""
+ var html = """<p>The number of windows in my house is\n14. The number of doors is 6.</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test268 is test do
+ var md = """The number of windows in my house is\n1. The number of doors is 6.\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test269 is test do
+ var md = """- foo\n\n- bar\n\n\n- baz\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test270 is test do
+ var md = """- foo\n - bar\n - baz\n\n\n bim\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test271 is test do
+ var md = """- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test272 is test do
+ var md = """- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test273 is test do
+ var md = """- a\n - b\n - c\n - d\n - e\n - f\n- g\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test274 is test do
+ var md = """1. a\n\n 2. b\n\n 3. c\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test277 is test do
+ var md = """- a\n- b\n\n- c\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test278 is test do
+ var md = """* a\n*\n\n* c\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test279 is test do
+ var md = """- a\n- b\n\n c\n- d\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test280 is test do
+ var md = """- a\n- b\n\n [ref]: /url\n- d\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test281 is test do
+ var md = """- a\n- ```\n b\n\n\n ```\n- c\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test282 is test do
+ var md = """- a\n - b\n\n c\n- d\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test283 is test do
+ var md = """* a\n > b\n >\n* c\n"""
+ var html = """<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test284 is test do
+ var md = """- a\n > b\n ```\n c\n ```\n- d\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test285 is test do
+ var md = """- a\n"""
+ var html = """<ul>\n<li>a</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test286 is test do
+ var md = """- a\n - b\n"""
+ var html = """<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test287 is test do
+ var md = """1. ```\n foo\n ```\n\n bar\n"""
+ var html = """<ol>\n<li>\n<pre><code>foo\n</code></pre>\n<p>bar</p>\n</li>\n</ol>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test288 is test do
+ var md = """* foo\n * bar\n\n baz\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+
+ fun test289 is test do
+ var md = """- a\n - b\n - c\n\n- d\n - e\n - f\n"""
+ 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"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_paragraphs is test
+
+import test_markdown
+
+class TestCommonmarkParagraphs
+ super TestMarkdownHtml
+ test
+
+ fun test182 is test do
+ var md = """aaa\n\nbbb\n"""
+ var html = """<p>aaa</p>\n<p>bbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test183 is test do
+ var md = """aaa\nbbb\n\nccc\nddd\n"""
+ var html = """<p>aaa\nbbb</p>\n<p>ccc\nddd</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test184 is test do
+ var md = """aaa\n\n\nbbb\n"""
+ var html = """<p>aaa</p>\n<p>bbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test185 is test do
+ var md = """ aaa\n bbb\n"""
+ var html = """<p>aaa\nbbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test186 is test do
+ var md = """aaa\n bbb\n ccc\n"""
+ var html = """<p>aaa\nbbb\nccc</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test187 is test do
+ var md = """ aaa\nbbb\n"""
+ var html = """<p>aaa\nbbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test188 is test do
+ var md = """ aaa\nbbb\n"""
+ var html = """<pre><code>aaa\n</code></pre>\n<p>bbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test189 is test do
+ var md = """aaa \nbbb \n"""
+ var html = """<p>aaa<br />\nbbb</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_precedence is test
+
+import test_markdown
+
+class TestCommonmarkPrecedence
+ super TestMarkdownHtml
+ test
+
+ fun test12 is test do
+ var md = """- `one\n- two`\n"""
+ var html = """<ul>\n<li>`one</li>\n<li>two`</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_raw_html is test
+
+import test_markdown
+
+class TestCommonmarkRawHTML
+ super TestMarkdownHtml
+ test
+
+ fun test587 is test do
+ var md = """<a><bab><c2c>\n"""
+ var html = """<p><a><bab><c2c></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test588 is test do
+ var md = """<a/><b2/>\n"""
+ var html = """<p><a/><b2/></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test589 is test do
+ var md = """<a /><b2\ndata="foo" >\n"""
+ var html = """<p><a /><b2\ndata="foo" ></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test590 is test do
+ var md = """<a foo="bar" bam = 'baz <em>"</em>'\n_boolean zoop:33=zoop:33 />\n"""
+ var html = """<p><a foo="bar" bam = 'baz <em>"</em>'\n_boolean zoop:33=zoop:33 /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test591 is test do
+ var md = """Foo <responsive-image src="foo.jpg" />\n"""
+ var html = """<p>Foo <responsive-image src="foo.jpg" /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test592 is test do
+ var md = """<33> <__>\n"""
+ var html = """<p><33> <__></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test593 is test do
+ var md = """<a h*#ref="hi">\n"""
+ var html = """<p><a h*#ref="hi"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test594 is test do
+ var md = """<a href="hi'> <a href=hi'>\n"""
+ var html = """<p><a href="hi'> <a href=hi'></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test595 is test do
+ var md = """< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />\n"""
+ var html = """<p>< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop /></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test596 is test do
+ var md = """<a href='bar'title=title>\n"""
+ var html = """<p><a href='bar'title=title></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test597 is test do
+ var md = """</a></foo >\n"""
+ var html = """<p></a></foo ></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test598 is test do
+ var md = """</a href="foo">\n"""
+ var html = """<p></a href="foo"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test599 is test do
+ var md = """foo <!-- this is a\ncomment - with hyphen -->\n"""
+ var html = """<p>foo <!-- this is a\ncomment - with hyphen --></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test600 is test do
+ var md = """foo <!-- not a comment -- two hyphens -->\n"""
+ var html = """<p>foo <!-- not a comment -- two hyphens --></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test601 is test do
+ var md = """foo <!--> foo -->\n\nfoo <!-- foo--->\n"""
+ var html = """<p>foo <!--> foo --></p>\n<p>foo <!-- foo---></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test602 is test do
+ var md = """foo <?php echo $a; ?>\n"""
+ var html = """<p>foo <?php echo $a; ?></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test603 is test do
+ var md = """foo <!ELEMENT br EMPTY>\n"""
+ var html = """<p>foo <!ELEMENT br EMPTY></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test604 is test do
+ var md = """foo <![CDATA[>&<]]>\n"""
+ var html = """<p>foo <![CDATA[>&<]]></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test605 is test do
+ var md = """foo <a href="ö">\n"""
+ var html = """<p>foo <a href="ö"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test606 is test do
+ var md = """foo <a href="\\*">\n"""
+ var html = """<p>foo <a href="\\*"></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test607 is test do
+ var md = """<a href="\\"">\n"""
+ var html = """<p><a href="""></p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_setext_headings is test
+
+import test_markdown
+
+class TestCommonmarkSetextHeadings
+ super TestMarkdownHtml
+ test
+
+ fun test50 is test do
+ var md = """Foo *bar*\n=========\n\nFoo *bar*\n---------\n"""
+ var html = """<h1>Foo <em>bar</em></h1>\n<h2>Foo <em>bar</em></h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test51 is test do
+ var md = """Foo *bar\nbaz*\n====\n"""
+ var html = """<h1>Foo <em>bar\nbaz</em></h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test52 is test do
+ var md = """Foo\n-------------------------\n\nFoo\n=\n"""
+ var html = """<h2>Foo</h2>\n<h1>Foo</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test53 is test do
+ var md = """ Foo\n---\n\n Foo\n-----\n\n Foo\n ===\n"""
+ var html = """<h2>Foo</h2>\n<h2>Foo</h2>\n<h1>Foo</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test54 is test do
+ var md = """ Foo\n ---\n\n Foo\n---\n"""
+ var html = """<pre><code>Foo\n---\n\nFoo\n</code></pre>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test55 is test do
+ var md = """Foo\n ---- \n"""
+ var html = """<h2>Foo</h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test56 is test do
+ var md = """Foo\n ---\n"""
+ var html = """<p>Foo\n---</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test57 is test do
+ var md = """Foo\n= =\n\nFoo\n--- -\n"""
+ var html = """<p>Foo\n= =</p>\n<p>Foo</p>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test58 is test do
+ var md = """Foo \n-----\n"""
+ var html = """<h2>Foo</h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test59 is test do
+ var md = """Foo\\\n----\n"""
+ var html = """<h2>Foo\\</h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test60 is test do
+ var md = """`Foo\n----\n`\n\n<a title="a lot\n---\nof dashes"/>\n"""
+ var html = """<h2>`Foo</h2>\n<p>`</p>\n<h2><a title="a lot</h2>\n<p>of dashes"/></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test61 is test do
+ var md = """> Foo\n---\n"""
+ var html = """<blockquote>\n<p>Foo</p>\n</blockquote>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test62 is test do
+ var md = """> foo\nbar\n===\n"""
+ var html = """<blockquote>\n<p>foo\nbar\n===</p>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test63 is test do
+ var md = """- Foo\n---\n"""
+ var html = """<ul>\n<li>Foo</li>\n</ul>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test64 is test do
+ var md = """Foo\nBar\n---\n"""
+ var html = """<h2>Foo\nBar</h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test65 is test do
+ var md = """---\nFoo\n---\nBar\n---\nBaz\n"""
+ var html = """<hr />\n<h2>Foo</h2>\n<h2>Bar</h2>\n<p>Baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test66 is test do
+ var md = """\n====\n"""
+ var html = """<p>====</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test67 is test do
+ var md = """---\n---\n"""
+ var html = """<hr />\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test68 is test do
+ var md = """- foo\n-----\n"""
+ var html = """<ul>\n<li>foo</li>\n</ul>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test69 is test do
+ var md = """ foo\n---\n"""
+ var html = """<pre><code>foo\n</code></pre>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test70 is test do
+ var md = """> foo\n-----\n"""
+ var html = """<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test71 is test do
+ var md = """\\> foo\n------\n"""
+ var html = """<h2>> foo</h2>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test72 is test do
+ var md = """Foo\n\nbar\n---\nbaz\n"""
+ var html = """<p>Foo</p>\n<h2>bar</h2>\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test73 is test do
+ var md = """Foo\nbar\n\n---\n\nbaz\n"""
+ var html = """<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test74 is test do
+ var md = """Foo\nbar\n* * *\nbaz\n"""
+ var html = """<p>Foo\nbar</p>\n<hr />\n<p>baz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test75 is test do
+ var md = """Foo\nbar\n\\---\nbaz\n"""
+ var html = """<p>Foo\nbar\n---\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_soft_line_breaks is test
+
+import test_markdown
+
+class TestCommonmarkSoftLineBreaks
+ super TestMarkdownHtml
+ test
+
+ fun test623 is test do
+ var md = """foo\nbaz\n"""
+ var html = """<p>foo\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test624 is test do
+ var md = """foo \n baz\n"""
+ var html = """<p>foo\nbaz</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_tabs is test
+
+import test_markdown
+
+class TestCommonmarkTabs
+ super TestMarkdownHtml
+ test
+
+ fun test1 is test do
+ var md = """\tfoo\tbaz\t\tbim\n"""
+ var html = """<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test2 is test do
+ var md = """ \tfoo\tbaz\t\tbim\n"""
+ var html = """<pre><code>foo\tbaz\t\tbim\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test3 is test do
+ var md = """ a\ta\n ὐ\ta\n"""
+ var html = """<pre><code>a\ta\nὐ\ta\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test4 is test do
+ var md = """ - foo\n\n\tbar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test5 is test do
+ var md = """- foo\n\n\t\tbar\n"""
+ var html = """<ul>\n<li>\n<p>foo</p>\n<pre><code> bar\n</code></pre>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test6 is test do
+ var md = """>\t\tfoo\n"""
+ var html = """<blockquote>\n<pre><code> foo\n</code></pre>\n</blockquote>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test7 is test do
+ var md = """-\t\tfoo\n"""
+ var html = """<ul>\n<li>\n<pre><code> foo\n</code></pre>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test8 is test do
+ var md = """ foo\n\tbar\n"""
+ var html = """<pre><code>foo\nbar\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test9 is test do
+ var md = """ - foo\n - bar\n\t - baz\n"""
+ var html = """<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>baz</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test10 is test do
+ var md = """#\tFoo\n"""
+ var html = """<h1>Foo</h1>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test11 is test do
+ var md = """*\t*\t*\t\n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_textual_content is test
+
+import test_markdown
+
+class TestCommonmarkTextualContent
+ super TestMarkdownHtml
+ test
+
+ fun test625 is test do
+ var md = """hello $.;'there\n"""
+ var html = """<p>hello $.;'there</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test626 is test do
+ var md = """Foo χρῆν\n"""
+ var html = """<p>Foo χρῆν</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test627 is test do
+ var md = """Multiple spaces\n"""
+ var html = """<p>Multiple spaces</p>\n"""
+ assert md_to_html(md) == html
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commonmark_thematic_breaks is test
+
+import test_markdown
+
+class TestCommonmarkThematicBreaks
+ super TestMarkdownHtml
+ test
+
+ fun test13 is test do
+ var md = """***\n---\n___\n"""
+ var html = """<hr />\n<hr />\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test14 is test do
+ var md = """+++\n"""
+ var html = """<p>+++</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test15 is test do
+ var md = """===\n"""
+ var html = """<p>===</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test16 is test do
+ var md = """--\n**\n__\n"""
+ var html = """<p>--\n**\n__</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test17 is test do
+ var md = """ ***\n ***\n ***\n"""
+ var html = """<hr />\n<hr />\n<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test18 is test do
+ var md = """ ***\n"""
+ var html = """<pre><code>***\n</code></pre>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test19 is test do
+ var md = """Foo\n ***\n"""
+ var html = """<p>Foo\n***</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test20 is test do
+ var md = """_____________________________________\n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test21 is test do
+ var md = """ - - -\n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test22 is test do
+ var md = """ ** * ** * ** * **\n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test23 is test do
+ var md = """- - - -\n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test24 is test do
+ var md = """- - - - \n"""
+ var html = """<hr />\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test25 is test do
+ var md = """_ _ _ _ a\n\na------\n\n---a---\n"""
+ var html = """<p>_ _ _ _ a</p>\n<p>a------</p>\n<p>---a---</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test26 is test do
+ var md = """ *-*\n"""
+ var html = """<p><em>-</em></p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test27 is test do
+ var md = """- foo\n***\n- bar\n"""
+ var html = """<ul>\n<li>foo</li>\n</ul>\n<hr />\n<ul>\n<li>bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test28 is test do
+ var md = """Foo\n***\nbar\n"""
+ var html = """<p>Foo</p>\n<hr />\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test29 is test do
+ var md = """Foo\n---\nbar\n"""
+ var html = """<h2>Foo</h2>\n<p>bar</p>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test30 is test do
+ var md = """* Foo\n* * *\n* Bar\n"""
+ var html = """<ul>\n<li>Foo</li>\n</ul>\n<hr />\n<ul>\n<li>Bar</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+
+ fun test31 is test do
+ var md = """- Foo\n- * * *\n"""
+ var html = """<ul>\n<li>Foo</li>\n<li>\n<hr />\n</li>\n</ul>\n"""
+ assert md_to_html(md) == html
+ end
+end