The old method failed for '[' x 3.
my $template=template($feed->{template}, blind_cache => 1);
$template->param(title => $params{title})
if defined $params{title} && length($params{title});
- $template->param(content => htmlescape(htmlabs($params{content},
+ $template->param(content => wikiescape(htmlabs($params{content},
defined $params{base} ? $params{base} : $feed->{feedurl})));
$template->param(name => $feed->{name});
$template->param(url => $feed->{url});
}
} #}}}
-sub htmlescape ($) { #{{{
+sub wikiescape ($) { #{{{
# escape accidental wikilinks and preprocessor stuff
- my $html=shift;
- $html=~s/(?<!\\)\[\[/\\\[\[/g;
- return $html;
+ return encode_entities(shift, '\[\]');
} #}}}
sub urlabs ($$) { #{{{
use strict;
use IkiWiki 2.00;
use Encode;
+use HTML::Entities;
sub import { #{{{
hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
if (ref $change->{message}) {
foreach my $field (@{$change->{message}}) {
if (exists $field->{line}) {
- $field->{line} =~ s/(?<!\\)\[\[/\\\[\[/g;
+ $field->{line} = encode_entities($field->{line}, '\[\]');
}
}
}
use warnings;
use strict;
use IkiWiki 2.00;
+use HTML::Entities;
my $maxlines=200;
$diff=join("", @lines);
}
# escape links and preprocessor stuff
- $diff =~ s/(?<!\\)\[\[/\\\[\[/g;
+ $diff = encode_entities($diff, '\[\]');
$template->param(diff => $diff);
}
}
* htmlbalance: New plugin contributed by Simon McVittie.
* Change deb dependencies to list Text::Markdown before markdown (really
this time).
+ * Improve escaping of wikilinks and preprocessor directives in content
+ produced by aggregate and recentchanges.
-- Joey Hess <joeyh@debian.org> Mon, 17 Nov 2008 14:02:10 -0500