]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Document an annoying Text::Textile encoding bug.
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Tue, 23 Dec 2014 03:43:40 +0000 (22:43 -0500)
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>
Tue, 23 Dec 2014 03:43:40 +0000 (22:43 -0500)
t/textile-double-escape-bug.t [new file with mode: 0755]

diff --git a/t/textile-double-escape-bug.t b/t/textile-double-escape-bug.t
new file mode 100755 (executable)
index 0000000..fe73f33
--- /dev/null
@@ -0,0 +1,30 @@
+#!/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};
+       my $href = q{https://en.wikipedia.org/wiki/Gödel,_Escher,_Bach};
+       my $good = qq{<p><a href="$href">$text</a></p>};
+
+       chomp(my $mdwn_html = IkiWiki::Plugin::mdwn::htmlize(
+               content => qq{[$text]($href)},
+       ));
+       is($mdwn_html, $good);
+
+       chomp(my $txtl_html = IkiWiki::Plugin::textile::htmlize(
+               content => qq{"$text":$href},
+       ));
+       isnt($txtl_html, $good);
+       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>});
+};