1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 module test_commonmark_backslash_escapes
is test
19 class TestCommonmarkBackslashEscapes
20 super TestMarkdownHtml
23 fun test291
is test
do
24 var md
= """\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\n"""
25 var html
= """<p>!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~</p>\n"""
26 assert md_to_html
(md
) == html
29 fun test292
is test
do
30 var md
= """\\\t\\A\\a\\ \\3\\φ\\«\n"""
31 var html
= """<p>\\\t\\A\\a\\ \\3\\φ\\«</p>\n"""
32 assert md_to_html
(md
) == html
35 fun test293
is test
do
36 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"""
37 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"""
38 assert md_to_html
(md
) == html
41 fun test294
is test
do
42 var md
= """\\\\*emphasis*\n"""
43 var html
= """<p>\\<em>emphasis</em></p>\n"""
44 assert md_to_html
(md
) == html
47 fun test295
is test
do
48 var md
= """foo\\\nbar\n"""
49 var html
= """<p>foo<br />\nbar</p>\n"""
50 assert md_to_html
(md
) == html
53 fun test296
is test
do
54 var md
= """`` \\[\\` ``\n"""
55 var html
= """<p><code>\\[\\`</code></p>\n"""
56 assert md_to_html
(md
) == html
59 fun test297
is test
do
60 var md
= """ \\[\\]\n"""
61 var html
= """<pre><code>\\[\\]\n</code></pre>\n"""
62 assert md_to_html
(md
) == html
65 fun test298
is test
do
66 var md
= """~~~\n\\[\\]\n~~~\n"""
67 var html
= """<pre><code>\\[\\]\n</code></pre>\n"""
68 assert md_to_html
(md
) == html
71 fun test299
is test
do
72 var md
= """<http://example.com?find=\\*>\n"""
73 var html
= """<p><a href="http://example.com?find=%5C*">http://example.com?find=\\*</a></p>\n"""
74 assert md_to_html
(md
) == html
77 fun test300
is test
do
78 var md
= """<a href="/bar\\/)">\n"""
79 var html
= """<a href="/bar\\/)">\n"""
80 assert md_to_html
(md
) == html
83 fun test301
is test
do
84 var md
= """[foo](/bar\\* "ti\\*tle")\n"""
85 var html
= """<p><a href="/bar*" title="ti*tle">foo</a></p>\n"""
86 assert md_to_html
(md
) == html
89 fun test302
is test
do
90 var md
= """[foo]\n\n[foo]: /bar\\* "ti\\*tle"\n"""
91 var html
= """<p><a href="/bar*" title="ti*tle">foo</a></p>\n"""
92 assert md_to_html
(md
) == html
95 fun test303
is test
do
96 var md
= """``` foo\\+bar\nfoo\n```\n"""
97 var html
= """<pre><code class="language-foo+bar">foo\n</code></pre>\n"""
98 assert md_to_html
(md
) == html