tests:
  emails:
    - description: "does not autolink within a quote"
      text: "got@example.com\n    quoted@example.com"
      expected: "<a href='mailto:got@example.com' class='email-link'>got@example.com</a>\n    quoted@example.com"

    - description: "Autolink regular email"
      text: "test@example.com"
      expected: "<a href='mailto:test@example.com' class='email-link'>test@example.com</a>"

    - description: "Autolink email in beginning of sentence"
      text: "foo@example.com was the email"
      expected: "<a href='mailto:foo@example.com' class='email-link'>foo@example.com</a> was the email"

    - description: "Autolink email in end of sentence"
      text: "This is a test test@example.com"
      expected: "This is a test <a href='mailto:test@example.com' class='email-link'>test@example.com</a>"

    - description: "Autolink email in mid-sentence"
      text: "This is a test test@example.com thank you"
      expected: "This is a test <a href='mailto:test@example.com' class='email-link'>test@example.com</a> thank you"

    - description: "Autolink several emails"
      text: "test.user@example.com bla bla. other-user@example.com"
      expected: "<a href='mailto:test.user@example.com' class='email-link'>test.user@example.com</a> bla bla. <a href='mailto:other-user@example.com' class='email-link'>other-user@example.com</a>"

    - description: "Autolink two emails following each other"
      text: "test.user@example.com other-user@example.com"
      expected: "<a href='mailto:test.user@example.com' class='email-link'>test.user@example.com</a> <a href='mailto:other-user@example.com' class='email-link'>other-user@example.com</a>"

    - description: "Autolink three emails following each other"
      text: "first.user@example.com second.user@example.com third.user@example.com"
      expected: "<a href='mailto:first.user@example.com' class='email-link'>first.user@example.com</a> <a href='mailto:second.user@example.com' class='email-link'>second.user@example.com</a> <a href='mailto:third.user@example.com' class='email-link'>third.user@example.com</a>"

    - description: "Autolink two emails with quotes"
      text: "'one@example.com'. Cool. Cool, cool, cool. \"two@example.com\""
      expected: "'<a href='mailto:one@example.com' class='email-link'>one@example.com</a>'. Cool. Cool, cool, cool. \"<a href='mailto:two@example.com' class='email-link'>two@example.com</a>\""

    - description: "Autolink email in parentheses"
      text: "Postman Pat (pat@royalmail.com)"
      expected: "Postman Pat (<a href='mailto:pat@royalmail.com' class='email-link'>pat@royalmail.com</a>)"

  usernames:
    - description: "Autolink trailing username"
      text: "text @username"
      expected: "text <a title=\"Search @username\" class=\"app-tag-link\" href=\"#flowser/all/@username\">@username</a>"

    - description: "Does not autolink when text starts with a quote"
      text: "    @username"
      expected: "    @username"

    - description: "autolinks after quote"
      text: "    @quoted\n@username"
      expected: "    @quoted\n<a title=\"Search @username\" class=\"app-tag-link\" href=\"#flowser/all/@username\">@username</a>"

    - description: "Does not autolink within quotes"
      text: "text\n    @username"
      expected: "text\n    @username"

    - description: "Autolink username at the beginning"
      text: "@username text"
      expected: "<a title=\"Search @username\" class=\"app-tag-link\" href=\"#flowser/all/@username\">@username</a> text"

    - description: "DO NOT Autolink username preceded by a letter"
      text: "meet@the beach"
      expected: "meet@the beach"

    - description: "Autolink username preceded by punctuation"
      text: "great.@username"
      expected: "great.<a title=\"Search @username\" class=\"app-tag-link\" href=\"#flowser/all/@username\">@username</a>"

    - description: "Autolink username followed by punctuation"
      text: "@username&^$%^"
      expected: "<a title=\"Search @username\" class=\"app-tag-link\" href=\"#flowser/all/@username\">@username</a>&^$%^"

    - description: "Autolink username including dots"
      text: "@user.name"
      expected: "<a title=\"Search @user.name\" class=\"app-tag-link\" href=\"#flowser/all/@user.name\">@user.name</a>"

    - description: "Autolink username including dots (but excude trailing dot)"
      text: "@user.name."
      expected: "<a title=\"Search @user.name\" class=\"app-tag-link\" href=\"#flowser/all/@user.name\">@user.name</a>."

    - description: "Autolink username followed by accented latin characters"
      text: "@aliceìnheiro something something"
      expected: "<a title=\"Search @aliceìnheiro\" class=\"app-tag-link\" href=\"#flowser/all/@aliceìnheiro\">@aliceìnheiro</a> something something"

    - description: "Autolink usernames over 20 characters"
      text: "@username9012345678901"
      expected: "<a title=\"Search @username9012345678901\" class=\"app-tag-link\" href=\"#flowser/all/@username9012345678901\">@username9012345678901</a>"

    - description: "Autolink two usernames"
      text: "@foo @bar"
      expected: "<a title=\"Search @foo\" class=\"app-tag-link\" href=\"#flowser/all/@foo\">@foo</a> <a title=\"Search @bar\" class=\"app-tag-link\" href=\"#flowser/all/@bar\">@bar</a>"

    - description: "Autolink usernames followed by :"
      text: "@foo: @bar"
      expected: "<a title=\"Search @foo\" class=\"app-tag-link\" href=\"#flowser/all/@foo\">@foo</a>: <a title=\"Search @bar\" class=\"app-tag-link\" href=\"#flowser/all/@bar\">@bar</a>"

    - description: "Autolink usernames that are followed by international characters"
      text: "@foo îs in the house"
      expected: "<a title=\"Search @foo\" class=\"app-tag-link\" href=\"#flowser/all/@foo\">@foo</a> îs in the house"

  hashtags:
    - description: "does not autolink in quotes"
      text: "    #hashtag"
      expected: "    #hashtag"

    - description: "Autolink trailing hashtag"
      text: "text #hashtag"
      expected: "text <a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">#hashtag</a>"

    - description: "Autolink alphanumeric hashtag (letter-number-letter)"
      text: "text #hash0tag"
      expected: "text <a href=\"#flowser/all/hash0tag\" title=\"#hash0tag\" class=\"app-tag-link\">#hash0tag</a>"

    - description: "Autolink alphanumeric hashtag (number-letter)"
      text: "text #1tag"
      expected: "text <a href=\"#flowser/all/1tag\" title=\"#1tag\" class=\"app-tag-link\">#1tag</a>"

    - description: "Autolink hashtag with underscore"
      text: "text #hash_tag"
      expected: "text <a href=\"#flowser/all/hash_tag\" title=\"#hash_tag\" class=\"app-tag-link\">#hash_tag</a>"

    - description: "Autolink all-numeric hashtags"
      text: "text #1234"
      expected: "text <a href=\"#flowser/all/1234\" title=\"#1234\" class=\"app-tag-link\">#1234</a>"

    - description: "DO NOT Autolink hashtag preceded by a letter"
      text: "text#hashtag"
      expected: "text#hashtag"

    - description: "Autolink multiple hashtags"
      text: "text #hashtag1 #hashtag2"
      expected: "text <a href=\"#flowser/all/hashtag1\" title=\"#hashtag1\" class=\"app-tag-link\">#hashtag1</a> <a href=\"#flowser/all/hashtag2\" title=\"#hashtag2\" class=\"app-tag-link\">#hashtag2</a>"

    - description: "Autolink hashtag preceded by a period"
      text: "text.#hashtag"
      expected: "text.<a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">#hashtag</a>"

    - description: "DO NOT Autolink hashtag preceded by &"
      text: "&#nbsp;"
      expected: "&#nbsp;"

    - description: "Autolink hashtag followed by ! (! not included)"
      text: "text #hashtag!"
      expected: "text <a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">#hashtag</a>!"

    - description: "Autolink hashtag followed by Japanese"
      text: "text #hashtagの"
      expected: "text <a href=\"#flowser/all/hashtagの\" title=\"#hashtagの\" class=\"app-tag-link\">#hashtagの</a>"

    - description: "Autolink hashtag preceded by full-width space (U+3000)"
      text: "text　#hashtag"
      expected: "text　<a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">#hashtag</a>"

    - description: "Autolink hashtag followed by full-width space (U+3000)"
      text: "#hashtag　text"
      expected: "<a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">#hashtag</a>　text"

    - description: "Autolink hashtag with full-width hash (U+FF03)"
      text: "＃hashtag"
      expected: "<a href=\"#flowser/all/hashtag\" title=\"#hashtag\" class=\"app-tag-link\">＃hashtag</a>"

    - description: "Autolink hashtag with accented character at the start"
      text: "#éhashtag"
      expected: "<a href=\"#flowser/all/éhashtag\" title=\"#éhashtag\" class=\"app-tag-link\">#éhashtag</a>"

    - description: "Autolink hashtag with accented character at the end"
      text: "#hashtagé"
      expected: "<a href=\"#flowser/all/hashtagé\" title=\"#hashtagé\" class=\"app-tag-link\">#hashtagé</a>"

    - description: "Autolink hashtag with accented character in the middle"
      text: "#hashétag"
      expected: "<a href=\"#flowser/all/hashétag\" title=\"#hashétag\" class=\"app-tag-link\">#hashétag</a>"

    - description: "Autolink hashtags in Korean"
      text: "What is #트위터 anyway?"
      expected: "What is <a href=\"#flowser/all/트위터\" title=\"#트위터\" class=\"app-tag-link\">#트위터</a> anyway?"

    - description: "Autolink hashtags in Russian"
      text: "What is #ашок anyway?"
      expected: "What is <a href=\"#flowser/all/ашок\" title=\"#ашок\" class=\"app-tag-link\">#ашок</a> anyway?"

    - description: "Autolink a katakana hashtag preceded by a space and followed by a space"
      text: "カタカナ #カタカナ カタカナ"
      expected: "カタカナ <a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a> カタカナ"

    - description: "Autolink a katakana hashtag preceded by a space and followed by a bracket"
      text: "カタカナ #カタカナ」カタカナ"
      expected: "カタカナ <a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>」カタカナ"

    - description: "Autolink a katakana hashtag preceded by a space and followed by a edge"
      text: "カタカナ #カタカナ"
      expected: "カタカナ <a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>"

    - description: "Autolink a katakana hashtag preceded by a bracket and followed by a space"
      text: "カタカナ「#カタカナ カタカナ"
      expected: "カタカナ「<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a> カタカナ"

    - description: "Autolink a katakana hashtag preceded by a bracket and followed by a bracket"
      text: "カタカナ「#カタカナ」カタカナ"
      expected: "カタカナ「<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>」カタカナ"

    - description: "Autolink a katakana hashtag preceded by a bracket and followed by a edge"
      text: "カタカナ「#カタカナ"
      expected: "カタカナ「<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>"

    - description: "Autolink a katakana hashtag preceded by a edge and followed by a space"
      text: "#カタカナ カタカナ"
      expected: "<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a> カタカナ"

    - description: "Autolink a katakana hashtag preceded by a edge and followed by a bracket"
      text: "#カタカナ」カタカナ"
      expected: "<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>」カタカナ"

    - description: "Autolink a katakana hashtag preceded by a edge and followed by a edge"
      text: "#カタカナ"
      expected: "<a href=\"#flowser/all/カタカナ\" title=\"#カタカナ\" class=\"app-tag-link\">#カタカナ</a>"

    - description: "Autolink a katakana hashtag with a voiced sounds mark followed by a space"
      text: "#ﾊｯｼｭﾀｸﾞ　テスト"
      expected: "<a href=\"#flowser/all/ﾊｯｼｭﾀｸﾞ\" title=\"#ﾊｯｼｭﾀｸﾞ\" class=\"app-tag-link\">#ﾊｯｼｭﾀｸﾞ</a>　テスト"

    - description: "Autolink a katakana hashtag with a voiced sounds mark followed by numbers"
      text: "#ﾊｯｼｭﾀｸﾞ123"
      expected: "<a href=\"#flowser/all/ﾊｯｼｭﾀｸﾞ123\" title=\"#ﾊｯｼｭﾀｸﾞ123\" class=\"app-tag-link\">#ﾊｯｼｭﾀｸﾞ123</a>"

    - description: "Autolink a katakana hashtag with another voiced sounds mark"
      text: "#ﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟ"
      expected: "<a href=\"#flowser/all/ﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟ\" title=\"#ﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟ\" class=\"app-tag-link\">#ﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟ</a>"

    - description: "Autolink a kanji hashtag preceded by a space and followed by a space"
      text: "漢字 #漢字 漢字"
      expected: "漢字 <a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a> 漢字"

    - description: "Autolink a kanji hashtag preceded by a space and followed by a bracket"
      text: "漢字 #漢字」漢字"
      expected: "漢字 <a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>」漢字"

    - description: "Autolink a kanji hashtag preceded by a space and followed by a edge"
      text: "漢字 #漢字"
      expected: "漢字 <a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>"

    - description: "Autolink a kanji hashtag preceded by a bracket and followed by a space"
      text: "漢字「#漢字 漢字"
      expected: "漢字「<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a> 漢字"

    - description: "Autolink a kanji hashtag preceded by a bracket and followed by a bracket"
      text: "漢字「#漢字」漢字"
      expected: "漢字「<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>」漢字"

    - description: "Autolink a kanji hashtag preceded by a bracket and followed by a edge"
      text: "漢字「#漢字"
      expected: "漢字「<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>"

    - description: "Autolink a kanji hashtag preceded by a edge and followed by a space"
      text: "#漢字 漢字"
      expected: "<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a> 漢字"

    - description: "Autolink a kanji hashtag preceded by a edge and followed by a bracket"
      text: "#漢字」漢字"
      expected: "<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>」漢字"

    - description: "Autolink a kanji hashtag preceded by a edge and followed by a edge"
      text: "#漢字"
      expected: "<a href=\"#flowser/all/漢字\" title=\"#漢字\" class=\"app-tag-link\">#漢字</a>"

    - description: "Autolink a kanji hashtag preceded by an ideographic comma, followed by an ideographic period"
      text: "これは、＃大丈夫。"
      expected: "これは、<a href=\"#flowser/all/大丈夫\" title=\"#大丈夫\" class=\"app-tag-link\">＃大丈夫</a>。"

    - description: "Autolink a hiragana hashtag preceded by a space and followed by a space"
      text: "ひらがな #ひらがな ひらがな"
      expected: "ひらがな <a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a> ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a space and followed by a bracket"
      text: "ひらがな #ひらがな」ひらがな"
      expected: "ひらがな <a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>」ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a space and followed by a edge"
      text: "ひらがな #ひらがな"
      expected: "ひらがな <a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>"

    - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a space"
      text: "ひらがな「#ひらがな ひらがな"
      expected: "ひらがな「<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a> ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a bracket"
      text: "ひらがな「#ひらがな」ひらがな"
      expected: "ひらがな「<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>」ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a bracket and followed by a edge"
      text: "ひらがな「#ひらがな"
      expected: "ひらがな「<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>"

    - description: "Autolink a hiragana hashtag preceded by a edge and followed by a space"
      text: "#ひらがな ひらがな"
      expected: "<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a> ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a edge and followed by a bracket"
      text: "#ひらがな」ひらがな"
      expected: "<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>」ひらがな"

    - description: "Autolink a hiragana hashtag preceded by a edge and followed by a edge"
      text: "#ひらがな"
      expected: "<a href=\"#flowser/all/ひらがな\" title=\"#ひらがな\" class=\"app-tag-link\">#ひらがな</a>"

    - description: "Autolink a Kanji/Katakana mix hashtag"
      text: "日本語ハッシュタグ #日本語ハッシュタグ"
      expected: "日本語ハッシュタグ <a href=\"#flowser/all/日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"app-tag-link\">#日本語ハッシュタグ</a>"

    - description: "DO NOT autolink a hashtag without a preceding space"
      text: "日本語ハッシュタグ#日本語ハッシュタグ"
      expected: "日本語ハッシュタグ#日本語ハッシュタグ"

    - description: "DO NOT include a punctuation in a hashtag"
      text: "#日本語ハッシュタグ。"
      expected: "<a href=\"#flowser/all/日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"app-tag-link\">#日本語ハッシュタグ</a>。"

    - description: "Autolink a hashtag after a punctuation"
      text: "日本語ハッシュタグ。#日本語ハッシュタグ"
      expected: "日本語ハッシュタグ。<a href=\"#flowser/all/日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"app-tag-link\">#日本語ハッシュタグ</a>"

    - description: "Autolink a hashtag with chouon"
      text: "長音ハッシュタグ。#サッカー"
      expected: "長音ハッシュタグ。<a href=\"#flowser/all/サッカー\" title=\"#サッカー\" class=\"app-tag-link\">#サッカー</a>"

    - description: "Autolink a hashtag with half-width chouon"
      text: "長音ハッシュタグ。#ｻｯｶｰ"
      expected: "長音ハッシュタグ。<a href=\"#flowser/all/ｻｯｶｰ\" title=\"#ｻｯｶｰ\" class=\"app-tag-link\">#ｻｯｶｰ</a>"

    - description: "Autolink a hashtag with half-width # after full-width ！"
      text: "できましたよー！#日本語ハッシュタグ。"
      expected: "できましたよー！<a href=\"#flowser/all/日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"app-tag-link\">#日本語ハッシュタグ</a>。"

    - description: "Autolink a hashtag with full-width ＃ after full-width ！"
      text: "できましたよー！＃日本語ハッシュタグ。"
      expected: "できましたよー！<a href=\"#flowser/all/日本語ハッシュタグ\" title=\"#日本語ハッシュタグ\" class=\"app-tag-link\">＃日本語ハッシュタグ</a>。"

    - description: "Autolink a hashtag containing ideographic iteration mark"
      text: "#云々"
      expected: "<a href=\"#flowser/all/云々\" title=\"#云々\" class=\"app-tag-link\">#云々</a>"

    - description: "Autolink multiple hashtags in multiple languages"
      text: "Hashtags in #中文, #日本語, #한국말, and #русский! Try it out!"
      expected: "Hashtags in <a href=\"#flowser/all/中文\" title=\"#中文\" class=\"app-tag-link\">#中文</a>, <a href=\"#flowser/all/日本語\" title=\"#日本語\" class=\"app-tag-link\">#日本語</a>, <a href=\"#flowser/all/한국말\" title=\"#한국말\" class=\"app-tag-link\">#한국말</a>, and <a href=\"#flowser/all/русский\" title=\"#русский\" class=\"app-tag-link\">#русский</a>! Try it out!"

    - description: "Autolink should allow for ş (U+015F) in a hashtag"
      text: "Here’s a test tweet for you: #Ateş #qrşt #ştu #ş"
      expected: "Here’s a test tweet for you: <a href=\"#flowser/all/Ateş\" title=\"#Ateş\" class=\"app-tag-link\">#Ateş</a> <a href=\"#flowser/all/qrşt\" title=\"#qrşt\" class=\"app-tag-link\">#qrşt</a> <a href=\"#flowser/all/ştu\" title=\"#ştu\" class=\"app-tag-link\">#ştu</a> <a href=\"#flowser/all/ş\" title=\"#ş\" class=\"app-tag-link\">#ş</a>"

  urls:
    - description: "Autolink URL with pipe character"
      text: "text http://example.com/pipe|character?yes|pipe|character"
      expected: "text <a href=\"http://example.com/pipe|character?yes|pipe|character\">http://example.com/pipe|character?yes|pipe|character</a>"

    - description: "Autolink trailing url"
      text: "text http://example.com"
      expected: "text <a href=\"http://example.com\">http://example.com</a>"

    - description: "Autolink trailing IP"
      text: "text http://173.194.70.101"
      expected: "text <a href=\"http://173.194.70.101\">http://173.194.70.101</a>"

    - description: "Autolink url in mid-text"
      text: "text http://example.com more text"
      expected: "text <a href=\"http://example.com\">http://example.com</a> more text"

    - description: "Autolink IP in mid-text"
      text: "text http://10.0.0.126 more text"
      expected: "text <a href=\"http://10.0.0.126\">http://10.0.0.126</a> more text"

    - description: "Autolink url in Japanese text"
      text: "いまなにしてるhttp://example.comいまなにしてる"
      expected: "いまなにしてる<a href=\"http://example.com\">http://example.com</a>いまなにしてる"

    - description: "does not include trailing comma to link with @"
      text: "https://medium.com/@s, "
      expected: "<a href=\"https://medium.com/@s\">https://medium.com/@s</a>, "

    - description: "allows , inside the query"
      text: "https://medium.com/@s?aa,bb"
      expected: "<a href=\"https://medium.com/@s?aa,bb\">https://medium.com/@s?aa,bb</a>"

    - description: "Autolink url surrounded by parentheses does not capture them"
      text: "text (http://example.com)"
      expected: "text (<a href=\"http://example.com\">http://example.com</a>)"

    - description: "Autolink url with path surrounded by parentheses does not capture them"
      text: "text (http://example.com/test)"
      expected: "text (<a href=\"http://example.com/test\">http://example.com/test</a>)"

    - description: "Autolink url with embedded parentheses"
      text: "text http://msdn.com/S(deadbeef)/page.htm"
      expected: "text <a href=\"http://msdn.com/S(deadbeef)/page.htm\">http://msdn.com/S(deadbeef)/page.htm</a>"

    - description: "Extract valid URL: http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx"
      text: "text http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx"
      expected: "text <a href=\"http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx\">http://msdn.microsoft.com/ja-jp/library/system.net.httpwebrequest(v=VS.100).aspx</a>"

    - description: "Autolink url with balanced parens hiding XSS"
      text: 'text http://foo.com/("onclick="alert(1)")'
      expected: 'text <a href="http://foo.com/">http://foo.com/</a>("onclick="alert(1)")'

    - description: "Autolink url should NOT capture unbalanced parens"
      text: "Parenthetically bad http://example.com/i_has_a_) thing"
      expected: "Parenthetically bad <a href=\"http://example.com/i_has_a_\">http://example.com/i_has_a_</a>) thing"

    - description: "Autolink url containing unicode characters"
      text: "I enjoy Macintosh Brand computers: http://✪df.ws/ejp"
      expected: "I enjoy Macintosh Brand computers: <a href=\"http://✪df.ws/ejp\">http://✪df.ws/ejp</a>"

    - description: "Autolink url with .co. under TLD"
      text: "test http://www.example.co.jp"
      expected: "test <a href=\"http://www.example.co.jp\">http://www.example.co.jp</a>"

    - description: "DO NOT Autolink url containing ! character in the domain"
      text: "badly formatted http://foo!bar.com"
      expected: "badly formatted http://foo!bar.com"

    - description: "DO NOT Autolink url containing _ character in the domain"
      text: "badly formatted http://foo_bar.com"
      expected: "badly formatted http://foo_bar.com"

    - description: "Autolink url preceded by :"
      text: "text:http://example.com"
      expected: "text:<a href=\"http://example.com\">http://example.com</a>"

    - description: "Autolink url followed by ? (without it)"
      text: "text http://example.com?"
      expected: "text <a href=\"http://example.com\">http://example.com</a>?"

    - description: "Autolink url followed by ! (without it)"
      text: "text http://example.com!"
      expected: "text <a href=\"http://example.com\">http://example.com</a>!"

    - description: "Autolink url followed by , (without it)"
      text: "text http://example.com,"
      expected: "text <a href=\"http://example.com\">http://example.com</a>,"

    - description: "Autolink url without the protocol and with a dash in subdomain"
      text: "text ex-ample.com,"
      expected: "text <a href=\"http://ex-ample.com\">ex-ample.com</a>,"

    - description: "Autolink url without the protocol and with subdomain and with a dash in subdomain"
      text: "text ex-ample.example.com,"
      expected: "text <a href=\"http://ex-ample.example.com\">ex-ample.example.com</a>,"

    - description: "Autolink url without the protocol and with a CCTLD and with a dash in subdomain"
      text: "text ex-ample.fi,"
      expected: "text <a href=\"http://ex-ample.fi\">ex-ample.fi</a>,"

    - description: "Autolink url without the protocol and with a CCTLD, subdomain and a dash in subdomain"
      text: "text ex-ample.example.fi,"
      expected: "text <a href=\"http://ex-ample.example.fi\">ex-ample.example.fi</a>,"

    - description: "Autolink url with path followed by a comma (wihout the comma)"
      text: "In http://example.com/test, Douglas explains 42."
      expected: "In <a href=\"http://example.com/test\">http://example.com/test</a>, Douglas explains 42."

    - description: "Autolink url followed by . (without it)"
      text: "text http://example.com."
      expected: "text <a href=\"http://example.com\">http://example.com</a>."

    - description: "Autolink url followed by : (without it)"
      text: "text http://example.com:"
      expected: "text <a href=\"http://example.com\">http://example.com</a>:"

    - description: "Autolink url followed by ; (without it)"
      text: "text http://example.com;"
      expected: "text <a href=\"http://example.com\">http://example.com</a>;"

    - description: "Autolink url followed by ] (without it)"
      text: "text http://example.com]"
      expected: "text <a href=\"http://example.com\">http://example.com</a>]"

    - description: "Autolink url followed by ) (without it)"
      text: "text http://example.com)"
      expected: "text <a href=\"http://example.com\">http://example.com</a>)"

    - description: "Autolink url followed by } (without it)"
      text: "text http://example.com}"
      expected: "text <a href=\"http://example.com\">http://example.com</a>}"

    - description: "Autolink url followed by = (without it)"
      text: "text http://example.com="
      expected: "text <a href=\"http://example.com\">http://example.com</a>="

    - description: "Autolink url followed by ' (without it)"
      text: "text http://example.com'"
      expected: "text <a href=\"http://example.com\">http://example.com</a>'"

    - description: "DO NOT Autolink url preceded by /"
      text: "text /http://example.com"
      expected: "text /http://example.com"

    - description: "DO NOT Autolink url preceded by !"
      text: "text !http://example.com"
      expected: "text !http://example.com"

    - description: "DO NOT Autolink url preceded by ="
      text: "text =http://example.com"
      expected: "text =http://example.com"

    - description: "DO NOT Autolink url preceded by @"
      text: "@http://example.com"
      expected: "@http://example.com"

    - description: "DO NOT Autolink domain in email address"
      text: "foo@bar.com"
      expected: "foo@bar.com"

    - description: "Autolink url embedded in link tag"
      text: "<link rel='true'>http://example.com</link>"
      expected: "<link rel='true'><a href=\"http://example.com\">http://example.com</a></link>"

    - description: "Autolink multiple urls"
      text: "http://example.com https://sslexample.com http://sub.example.com"
      expected: "<a href=\"http://example.com\">http://example.com</a> <a href=\"https://sslexample.com\">https://sslexample.com</a> <a href=\"http://sub.example.com\">http://sub.example.com</a>"

    - description: "Autolink url with long TLD"
      text: "http://example.mobi/path"
      expected: "<a href=\"http://example.mobi/path\">http://example.mobi/path</a>"

    - description: "Autolink url containing ending with #value (not as url + hashtag)"
      text: "http://foo.com/?#foo"
      expected: "<a href=\"http://foo.com/?#foo\">http://foo.com/?#foo</a>"

    - description: "Autolink url containing .local ptld"
      text: "http://build.local"
      expected: "<a href=\"http://build.local\">http://build.local</a>"

    - description: "Autolink url containing .dmz ptld"
      text: "http://jorma.dmz"
      expected: "<a href=\"http://jorma.dmz\">http://jorma.dmz</a>"

    - description: "Autolink url containing .corp ptld"
      text: "http://enterprise.corp"
      expected: "<a href=\"http://enterprise.corp\">http://enterprise.corp</a>"

    - description: "Autolink url containing .lan ptld"
      text: "http://build.lan"
      expected: "<a href=\"http://build.lan\">http://build.lan</a>"

    - description: "Autolink url containing .technology ptld"
      text: "http://build.technology"
      expected: "<a href=\"http://build.technology\">http://build.technology</a>"

    - description: "Autolink url without protocol (with www)"
      text: "www.example.biz"
      expected: "<a href=\"http://www.example.biz\">www.example.biz</a>"

    - description: "Autolink url without protocol (with WWW)"
      text: "WWW.EXAMPLE.BIZ"
      expected: "<a href=\"http://WWW.EXAMPLE.BIZ\">WWW.EXAMPLE.BIZ</a>"

    - description: "Autolink URL without protocol and without www (ending in .com)"
      text: "foo.com"
      expected: "<a href=\"http://foo.com\">foo.com</a>"

    - description: "Autolink URL without protocol and without www (ending in .org)"
      text: "foo.org"
      expected: "<a href=\"http://foo.org\">foo.org</a>"

    - description: "Autolink URL without protocol and without www (ending in .net)"
      text: "foo.net"
      expected: "<a href=\"http://foo.net\">foo.net</a>"

    - description: "Autolink URL without protocol and without www (ending in .gov)"
      text: "foo.gov"
      expected: "<a href=\"http://foo.gov\">foo.gov</a>"

    - description: "Autolink URL without protocol and without www (ending in .edu)"
      text: "foo.edu"
      expected: "<a href=\"http://foo.edu\">foo.edu</a>"

    - description: "Multiple URLs with different protocols"
      text:  "http://foo.com AND https://bar.com AND www.foobar.com"
      expected: "<a href=\"http://foo.com\">http://foo.com</a> AND <a href=\"https://bar.com\">https://bar.com</a> AND <a href=\"http://www.foobar.com\">www.foobar.com</a>"

    - description: "Autolink url that includes @-sign and numeric dir under it"
      text: "http://www.flickr.com/photos/29674651@N00/4382024406"
      expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/4382024406\">http://www.flickr.com/photos/29674651@N00/4382024406</a>"

    - description: "Autolink url that includes @-sign and non-numeric dir under it"
      text: "http://www.flickr.com/photos/29674651@N00/foobar"
      expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/foobar\">http://www.flickr.com/photos/29674651@N00/foobar</a>"

    - description: "Autolink URL with only a domain followed by a period doesn't swallow the period."
      text: "I think it's proper to end sentences with a period http://tell.me.com. Even when they contain a URL."
      expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me.com\">http://tell.me.com</a>. Even when they contain a URL."

    - description: "Autolink URL with a path followed by a period doesn't swallow the period."
      text: "I think it's proper to end sentences with a period http://tell.me/why. Even when they contain a URL."
      expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me/why\">http://tell.me/why</a>. Even when they contain a URL."

    - description: "Autolink URL with a query followed by a period doesn't swallow the period."
      text: "I think it's proper to end sentences with a period http://tell.me/why?=because.i.want.it. Even when they contain a URL."
      expected: "I think it's proper to end sentences with a period <a href=\"http://tell.me/why?=because.i.want.it\">http://tell.me/why?=because.i.want.it</a>. Even when they contain a URL."

    - description: "Autolink URL with a hyphen in the domain name"
      text: "Czech out sweet deals at http://mrs.domain-dash.biz ok?"
      expected: "Czech out sweet deals at <a href=\"http://mrs.domain-dash.biz\">http://mrs.domain-dash.biz</a> ok?"

    - description: "Autolink an IDN (punycode) domain and TLD"
      text: "See also: http://xn--80abe5aohbnkjb.xn--p1ai/"
      expected: "See also: <a href=\"http://xn--80abe5aohbnkjb.xn--p1ai/\">http://xn--80abe5aohbnkjb.xn--p1ai/</a>"

    - description: "Autolink URL should NOT autolink www...foo"
      text: "Is www...foo a valid URL?"
      expected: "Is www...foo a valid URL?"

    - description: "Autolink URL should NOT autolink www.-foo.com"
      text: "Is www.-foo.com a valid URL?"
      expected: "Is www.-foo.com a valid URL?"

    - description: "Autolink URL should autolink a domain with a valid dash and a protocol"
      text: "Is http://www.foo-bar.com a valid URL?"
      expected: "Is <a href=\"http://www.foo-bar.com\">http://www.foo-bar.com</a> a valid URL?"

    - description: "Autolink URL should link search urls (with &lang=, not &lang;)"
      text: "Check out http://search.twitter.com/#!/search?q=avro&lang=en"
      expected: "Check out <a href=\"http://search.twitter.com/#!/search?q=avro&amp;lang=en\">http://search.twitter.com/#!/search?q=avro&amp;lang=en</a>"

    - description: "Autolink URL should link urls with very long paths"
      text: "Check out http://example.com/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>"

    - description: "Autolink URL should HTML escape the URL"
      text: "example: https://twitter.com/otm_m@\"onmousedown=\"alert('foo')\" style=background-color:yellow;color:yellow;\"/"
      expected: "example: <a href=\"https://twitter.com/otm_m\">https://twitter.com/otm_m</a>@\"onmousedown=\"alert('foo')\" style=background-color:yellow;color:yellow;\"/"

    - description: "Autolink URL should autolink a URL with a - or + at the end of the path"
      text: "Go to http://example.com/a+ or http://example.com/a-"
      expected: "Go to <a href=\"http://example.com/a+\">http://example.com/a+</a> or <a href=\"http://example.com/a-\">http://example.com/a-</a>"

    - description: "Autolink URL should autolink a URL with a - or + at the end of the path and query parameters"
      text: "Go to http://example.com/a+?this=that or http://example.com/a-?this=that"
      expected: "Go to <a href=\"http://example.com/a+?this=that\">http://example.com/a+?this=that</a> or <a href=\"http://example.com/a-?this=that\">http://example.com/a-?this=that</a>"

    - description: "Autolink URL should autolink URLs with longer paths ending in -"
      text: "Go to http://example.com/view/slug-url-?foo=bar"
      expected: "Go to <a href=\"http://example.com/view/slug-url-?foo=bar\">http://example.com/view/slug-url-?foo=bar</a>"

    - description: "Autolink URL should link paths containing accented characters"
      text: "See: http://example.com/café"
      expected: "See: <a href=\"http://example.com/café\">http://example.com/café</a>"

    - description: "Autolink URL should link URL without protocol"
      text: "See: www.twitter.com or twitter.com/twitter"
      expected: "See: <a href=\"http://www.twitter.com\">www.twitter.com</a> or <a href=\"http://twitter.com/twitter\">twitter.com/twitter</a>"

    - description: "Autolink t.co URL followed by punctuation"
      text: "See: http://t.co/abcde's page"
      expected: "See: <a href=\"http://t.co/abcde\">http://t.co/abcde</a>'s page"

    - description: "DO NOT autolink URL if preceded by $"
      text: "$https://twitter.com $twitter.com $http://t.co/abcde $t.co/abcde $t.co $TVI.CA $RBS.CA"
      expected: "$https://twitter.com $twitter.com $http://t.co/abcde $t.co/abcde $t.co $TVI.CA $RBS.CA"

    - description: "DO NOT remove trailing paren if no leading paren present"
      text: "http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)"
      expected: "<a href=\"http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)\">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>"

    - description: "DO NOT remove trailing paren from query if no leading paren present"
      text: "http://www.example.com/search?query=PC_Tools_(Central_Point_Software)"
      expected: "<a href=\"http://www.example.com/search?query=PC_Tools_(Central_Point_Software)\">http://www.example.com/search?query=PC_Tools_(Central_Point_Software)</a>"

    - description: "DO NOT mess with spaces and parens"
      text: "( https://github.com/Anyfetch/api.anyfetch.com/compare/production...staging )"
      expected: "( <a href=\"https://github.com/Anyfetch/api.anyfetch.com/compare/production...staging\">https://github.com/Anyfetch/api.anyfetch.com/compare/production...staging</a> )"

  all:
    - description: "Autolink all does not break on URL with @"
      text: "http://www.flickr.com/photos/29674651@N00/4382024406 if you know what's good for you."
      expected: "<a href=\"http://www.flickr.com/photos/29674651@N00/4382024406\">http://www.flickr.com/photos/29674651@N00/4382024406</a> if you know what's good for you."

    - description: "Autolink all does not allow & without ?"
      text: "Check out: http://example.com/test&@chasesechrist"
      expected: "Check out: <a href=\"http://example.com/test\">http://example.com/test</a>&@chasesechrist"

    - description: "Correctly handles URL follower directly by @user"
      text: "See: http://example.com/@user"
      expected: "See: <a href=\"http://example.com/@user\">http://example.com/@user</a>"

    - description: "Correctly handles URL with an @user followed by trailing /"
      text: "See: http://example.com/@user/"
      expected: "See: <a href=\"http://example.com/@user/\">http://example.com/@user/</a>"

    - description: "Does not allow an XSS after an @"
      text: "See: http://x.xx.com/@\"style=\"color:pink\"onmouseover=alert(1)//"
      expected: "See: <a href=\"http://x.xx.com/\">http://x.xx.com/</a>@\"style=\"color:pink\"onmouseover=alert(1)//"

    - description: "DO NOT autolink URLs if preceded by # or @"
      text: "#https://twitter.com @https://twitter.com"
      expected: "#https://twitter.com @https://twitter.com"

    - description: "Handle terminator models properly"
      text: "Terminator models: http://en.wikipedia.org/wiki/Terminator_(character_concept)#Models"
      expected: "Terminator models: <a href=\"http://en.wikipedia.org/wiki/Terminator_(character_concept)#Models\">http://en.wikipedia.org/wiki/Terminator_(character_concept)#Models</a>"
