]> sipb.mit.edu Git - ikiwiki.git/blob - t/textile-double-escape-bug.t
Optionally accept and emit comments' url/email/ip.
[ikiwiki.git] / t / textile-double-escape-bug.t
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Test::More tests => 4;
7 use utf8;
8
9 BEGIN {
10         use_ok('IkiWiki');
11         use_ok('IkiWiki::Plugin::mdwn');
12         use_ok('IkiWiki::Plugin::textile');
13 };
14
15 subtest 'Text::Textile apparently double-escapes HTML entities in hrefs' => sub {
16         my $text = q{Gödel, Escher, Bach};
17         my $href = q{https://en.wikipedia.org/wiki/Gödel,_Escher,_Bach};
18         my $good = qq{<p><a href="$href">$text</a></p>};
19
20         chomp(my $mdwn_html = IkiWiki::Plugin::mdwn::htmlize(
21                 content => qq{[$text]($href)},
22         ));
23         is($mdwn_html, $good);
24
25         chomp(my $txtl_html = IkiWiki::Plugin::textile::htmlize(
26                 content => qq{"$text":$href},
27         ));
28         isnt($txtl_html, $good);
29         is($txtl_html, q{<p><a href="https://en.wikipedia.org/wiki/G&amp;ouml;del,_Escher,_Bach">G&ouml;del, Escher, Bach</a></p>});
30 };