]> sipb.mit.edu Git - ikiwiki.git/blob - t/textile-double-escape-bug.t
(no commit message)
[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 $text_ok = qr{G(?:ö|ö|ö|&#x[fF]6;)del, Escher, Bach};
18         my $href = q{https://en.wikipedia.org/wiki/Gödel,_Escher,_Bach};
19         my $href_ok = qr{https://en\.wikipedia\.org/wiki/G(?:ö|ö|ö|&#x[fF]6|%[cC]3%[bB]6)del,_Escher,_Bach};
20         my $good = qr{<p><a href="$href_ok">$text_ok</a></p>};
21
22         chomp(my $mdwn_html = IkiWiki::Plugin::mdwn::htmlize(
23                 content => qq{[$text]($href)},
24         ));
25         like($mdwn_html, $good);
26
27         chomp(my $txtl_html = IkiWiki::Plugin::textile::htmlize(
28                 content => qq{"$text":$href},
29         ));
30         TODO: {
31         local $TODO = "Text::Textile double-escapes the href";
32         like($txtl_html, $good);
33         unlike($txtl_html, qr{<p><a href="https://en\.wikipedia\.org/wiki/G&amp;ouml;del,_Escher,_Bach">G&ouml;del, Escher, Bach</a></p>}i);
34         }
35 };