2014-12-23 04:43:40 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use Test::More tests => 4;
|
|
|
|
use utf8;
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
use_ok('IkiWiki');
|
|
|
|
use_ok('IkiWiki::Plugin::mdwn');
|
|
|
|
use_ok('IkiWiki::Plugin::textile');
|
|
|
|
};
|
|
|
|
|
|
|
|
subtest 'Text::Textile apparently double-escapes HTML entities in hrefs' => sub {
|
|
|
|
my $text = q{Gödel, Escher, Bach};
|
2015-01-06 01:26:41 +01:00
|
|
|
my $text_ok = qr{G(?:ö|ö|ö|&#x[fF]6;)del, Escher, Bach};
|
2014-12-23 04:43:40 +01:00
|
|
|
my $href = q{https://en.wikipedia.org/wiki/Gödel,_Escher,_Bach};
|
2015-01-06 01:26:41 +01:00
|
|
|
my $href_ok = qr{https://en\.wikipedia\.org/wiki/G(?:ö|ö|ö|&#x[fF]6|%[cC]3%[bB]6)del,_Escher,_Bach};
|
|
|
|
my $good = qr{<p><a href="$href_ok">$text_ok</a></p>};
|
2014-12-23 04:43:40 +01:00
|
|
|
|
|
|
|
chomp(my $mdwn_html = IkiWiki::Plugin::mdwn::htmlize(
|
|
|
|
content => qq{[$text]($href)},
|
|
|
|
));
|
2015-01-06 01:26:41 +01:00
|
|
|
like($mdwn_html, $good);
|
2014-12-23 04:43:40 +01:00
|
|
|
|
|
|
|
chomp(my $txtl_html = IkiWiki::Plugin::textile::htmlize(
|
|
|
|
content => qq{"$text":$href},
|
|
|
|
));
|
2015-01-06 01:23:33 +01:00
|
|
|
TODO: {
|
|
|
|
local $TODO = "Text::Textile double-escapes the href";
|
2015-01-06 01:26:41 +01:00
|
|
|
like($txtl_html, $good);
|
|
|
|
unlike($txtl_html, qr{<p><a href="https://en\.wikipedia\.org/wiki/G&ouml;del,_Escher,_Bach">Gödel, Escher, Bach</a></p>}i);
|
2015-01-06 01:23:33 +01:00
|
|
|
}
|
2014-12-23 04:43:40 +01:00
|
|
|
};
|