# 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 = """
\n""" assert md_to_html(md) == html end fun test463 is test do var md = """[link](/uri)\n""" var html = """\n""" assert md_to_html(md) == html end fun test464 is test do var md = """[link]()\n""" var html = """\n""" assert md_to_html(md) == html end fun test465 is test do var md = """[link](<>)\n""" var html = """\n""" assert md_to_html(md) == html end fun test466 is test do var md = """[link](/my uri)\n""" var html = """[link](/my uri)
\n""" assert md_to_html(md) == html end fun test467 is test do var md = """[link]()\n""" var html = """\n""" assert md_to_html(md) == html end fun test468 is test do var md = """[link](foo\nbar)\n""" var html = """[link](foo\nbar)
\n""" assert md_to_html(md) == html end fun test469 is test do var md = """[link]([link](
[link](/url "title "and" title")
\n""" assert md_to_html(md) == html end fun test483 is test do var md = """[link](/url 'title "and" title')\n""" var html = """\n""" assert md_to_html(md) == html end fun test484 is test do var md = """[link]( /uri\n "title" )\n""" var html = """\n""" assert md_to_html(md) == html end fun test485 is test do var md = """[link] (/uri)\n""" var html = """[link] (/uri)
\n""" assert md_to_html(md) == html end fun test486 is test do var md = """[link [foo [bar]]](/uri)\n""" var html = """\n""" assert md_to_html(md) == html end fun test487 is test do var md = """[link] bar](/uri)\n""" var html = """[link] bar](/uri)
\n""" assert md_to_html(md) == html end fun test488 is test do var md = """[link [bar](/uri)\n""" var html = """[link bar
\n""" assert md_to_html(md) == html end fun test489 is test do var md = """[link \\[bar](/uri)\n""" var html = """\n""" assert md_to_html(md) == html end fun test490 is test do var md = """[link *foo **bar** `#`*](/uri)\n""" var html = """\n""" assert md_to_html(md) == html end fun test491 is test do var md = """[![moon](moon.jpg)](/uri)\n""" var html = """\n""" assert md_to_html(md) == html end fun test492 is test do var md = """[foo [bar](/uri)](/uri)\n""" var html = """[foo bar](/uri)
\n""" assert md_to_html(md) == html end fun test493 is test do var md = """[foo *[bar [baz](/uri)](/uri)*](/uri)\n""" var html = """[foo [bar baz](/uri)](/uri)
\n""" assert md_to_html(md) == html end fun test494 is test do var md = """![[[foo](uri1)](uri2)](uri3)\n""" var html = """*foo*
\n""" assert md_to_html(md) == html end fun test496 is test do var md = """[foo *bar](baz*)\n""" var html = """\n""" assert md_to_html(md) == html end fun test497 is test do var md = """*foo [bar* baz]\n""" var html = """foo [bar baz]
\n""" assert md_to_html(md) == html end fun test498 is test do var md = """[foo[foo
[foo](/uri)
[foohttp://example.com/?search=](uri)
\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 = """\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 = """\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 = """\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 = """\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 = """\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 = """\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 = """\n""" assert md_to_html(md) == html end fun test508 is test do var md = """*[foo*][ref]\n\n[ref]: /uri\n""" var html = """*foo*
\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 = """\n""" assert md_to_html(md) == html end fun test510 is test do var md = """[foo[foo
[foo][ref]
[foohttp://example.com/?search=][ref]
\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 = """\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 = """\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 = """[foo] bar
\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 = """[foo]\nbar
\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 = """\n""" assert md_to_html(md) == html end fun test519 is test do var md = """[bar][foo\\!]\n\n[foo!]: /url\n""" var html = """[bar][foo!]
\n""" assert md_to_html(md) == html end fun test520 is test do var md = """[foo][ref[]\n\n[ref[]: /uri\n""" var html = """[foo][ref[]
\n[ref[]: /uri
\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 = """[foo][ref[bar]]
\n[ref[bar]]: /uri
\n""" assert md_to_html(md) == html end fun test522 is test do var md = """[[[foo]]]\n\n[[[foo]]]: /url\n""" var html = """[[[foo]]]
\n[[[foo]]]: /url
\n""" assert md_to_html(md) == html end fun test523 is test do var md = """[foo][ref\\[]\n\n[ref\\[]: /uri\n""" var html = """\n""" assert md_to_html(md) == html end fun test524 is test do var md = """[bar\\\\]: /uri\n\n[bar\\\\]\n""" var html = """\n""" assert md_to_html(md) == html end fun test525 is test do var md = """[]\n\n[]: /uri\n""" var html = """[]
\n[]: /uri
\n""" assert md_to_html(md) == html end fun test526 is test do var md = """[\n ]\n\n[\n ]: /uri\n""" var html = """[\n]
\n[\n]: /uri
\n""" assert md_to_html(md) == html end fun test527 is test do var md = """[foo][]\n\n[foo]: /url "title"\n""" var html = """\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 = """\n""" assert md_to_html(md) == html end fun test529 is test do var md = """[Foo][]\n\n[foo]: /url "title"\n""" var html = """\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 = """foo\n[]
\n""" assert md_to_html(md) == html end fun test531 is test do var md = """[foo]\n\n[foo]: /url "title"\n""" var html = """\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 = """\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 = """[foo bar]
\n""" assert md_to_html(md) == html end fun test534 is test do var md = """[[bar [foo]\n\n[foo]: /url\n""" var html = """[[bar foo
\n""" assert md_to_html(md) == html end fun test535 is test do var md = """[Foo]\n\n[foo]: /url "title"\n""" var html = """\n""" assert md_to_html(md) == html end fun test536 is test do var md = """[foo] bar\n\n[foo]: /url\n""" var html = """foo bar
\n""" assert md_to_html(md) == html end fun test537 is test do var md = """\\[foo]\n\n[foo]: /url "title"\n""" var html = """[foo]
\n""" assert md_to_html(md) == html end fun test538 is test do var md = """[foo*]: /url\n\n*[foo*]\n""" var html = """*foo*
\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 = """\n""" assert md_to_html(md) == html end fun test540 is test do var md = """[foo][]\n\n[foo]: /url1\n""" var html = """\n""" assert md_to_html(md) == html end fun test541 is test do var md = """[foo]()\n\n[foo]: /url1\n""" var html = """\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 = """foo(not a link)
\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 = """[foo]bar
\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 = """\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 = """[foo]bar
\n""" assert md_to_html(md) == html end end