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_link_reference_definitions
is test
19 class TestCommonmarkLinkReferenceDefinitions
20 super TestMarkdownHtml
23 fun test159
is test
do
24 var md
= """[foo]: /url "title"\n\n[foo]\n"""
25 var html
= """<p><a href="/url" title="title">foo</a></p>\n"""
26 assert md_to_html
(md
) == html
29 fun test160
is test
do
30 var md
= """ [foo]: \n /url \n 'the title' \n\n[foo]\n"""
31 var html
= """<p><a href="/url" title="the title">foo</a></p>\n"""
32 assert md_to_html
(md
) == html
35 fun test161
is test
do
36 var md
= """[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]\n"""
37 var html
= """<p><a href="my_(url)" title="title (with parens)">Foo*bar]</a></p>\n"""
38 assert md_to_html
(md
) == html
41 fun test162
is test
do
42 var md
= """[Foo bar]:\n<my%20url>\n'title'\n\n[Foo bar]\n"""
43 var html
= """<p><a href="my%20url" title="title">Foo bar</a></p>\n"""
44 assert md_to_html
(md
) == html
47 fun test163
is test
do
48 var md
= """[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]\n"""
49 var html
= """<p><a href="/url" title="\ntitle\nline1\nline2\n">foo</a></p>\n"""
50 assert md_to_html
(md
) == html
53 fun test164
is test
do
54 var md
= """[foo]: /url 'title\n\nwith blank line'\n\n[foo]\n"""
55 var html
= """<p>[foo]: /url 'title</p>\n<p>with blank line'</p>\n<p>[foo]</p>\n"""
56 assert md_to_html
(md
) == html
59 fun test165
is test
do
60 var md
= """[foo]:\n/url\n\n[foo]\n"""
61 var html
= """<p><a href="/url">foo</a></p>\n"""
62 assert md_to_html
(md
) == html
65 fun test166
is test
do
66 var md
= """[foo]:\n\n[foo]\n"""
67 var html
= """<p>[foo]:</p>\n<p>[foo]</p>\n"""
68 assert md_to_html
(md
) == html
71 fun test167
is test
do
72 var md
= """[foo]: /url\\bar\\*baz "foo\\"bar\\baz"\n\n[foo]\n"""
73 var html
= """<p><a href="/url%5Cbar*baz" title="foo"bar\\baz">foo</a></p>\n"""
74 assert md_to_html
(md
) == html
77 fun test168
is test
do
78 var md
= """[foo]\n\n[foo]: url\n"""
79 var html
= """<p><a href="url">foo</a></p>\n"""
80 assert md_to_html
(md
) == html
83 fun test169
is test
do
84 var md
= """[foo]\n\n[foo]: first\n[foo]: second\n"""
85 var html
= """<p><a href="first">foo</a></p>\n"""
86 assert md_to_html
(md
) == html
89 fun test170
is test
do
90 var md
= """[FOO]: /url\n\n[Foo]\n"""
91 var html
= """<p><a href="/url">Foo</a></p>\n"""
92 assert md_to_html
(md
) == html
95 fun test172
is test
do
96 var md
= """[foo]: /url\n"""
98 assert md_to_html
(md
) == html
101 fun test173
is test
do
102 var md
= """[\nfoo\n]: /url\nbar\n"""
103 var html
= """<p>bar</p>\n"""
104 assert md_to_html
(md
) == html
107 fun test174
is test
do
108 var md
= """[foo]: /url "title" ok\n"""
109 var html
= """<p>[foo]: /url "title" ok</p>\n"""
110 assert md_to_html
(md
) == html
113 fun test175
is test
do
114 var md
= """[foo]: /url\n"title" ok\n"""
115 var html
= """<p>"title" ok</p>\n"""
116 assert md_to_html
(md
) == html
119 fun test176
is test
do
120 var md
= """ [foo]: /url "title"\n\n[foo]\n"""
121 var html
= """<pre><code>[foo]: /url "title"\n</code></pre>\n<p>[foo]</p>\n"""
122 assert md_to_html
(md
) == html
125 fun test177
is test
do
126 var md
= """```\n[foo]: /url\n```\n\n[foo]\n"""
127 var html
= """<pre><code>[foo]: /url\n</code></pre>\n<p>[foo]</p>\n"""
128 assert md_to_html
(md
) == html
131 fun test178
is test
do
132 var md
= """Foo\n[bar]: /baz\n\n[bar]\n"""
133 var html
= """<p>Foo\n[bar]: /baz</p>\n<p>[bar]</p>\n"""
134 assert md_to_html
(md
) == html
137 fun test179
is test
do
138 var md
= """# [Foo]\n[foo]: /url\n> bar\n"""
139 var html
= """<h1><a href="/url">Foo</a></h1>\n<blockquote>\n<p>bar</p>\n</blockquote>\n"""
140 assert md_to_html
(md
) == html
143 fun test180
is test
do
144 var md
= """[foo]: /foo-url "foo"\n[bar]: /bar-url\n "bar"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]\n"""
145 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"""
146 assert md_to_html
(md
) == html
149 fun test181
is test
do
150 var md
= """[foo]\n\n> [foo]: /url\n"""
151 var html
= """<p><a href="/url">foo</a></p>\n<blockquote>\n</blockquote>\n"""
152 assert md_to_html
(md
) == html