From 15269fed646bf14692061e634969c98b614daaad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Nov 2008 02:43:17 -0500 Subject: improve escaping of wikilinks and preprocessor directives The old method failed for '[' x 3. --- IkiWiki/Plugin/aggregate.pm | 8 +++----- IkiWiki/Plugin/recentchanges.pm | 3 ++- IkiWiki/Plugin/recentchangesdiff.pm | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index f256b3ac1..6cdbbc0e9 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -610,7 +610,7 @@ sub add_page (@) { #{{{ 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}); @@ -637,11 +637,9 @@ sub add_page (@) { #{{{ } } #}}} -sub htmlescape ($) { #{{{ +sub wikiescape ($) { #{{{ # escape accidental wikilinks and preprocessor stuff - my $html=shift; - $html=~s/(? "getsetup", id => "recentchanges", call => \&getsetup); @@ -163,7 +164,7 @@ sub store ($$$) { #{{{ if (ref $change->{message}) { foreach my $field (@{$change->{message}}) { if (exists $field->{line}) { - $field->{line} =~ s/(?{line} = encode_entities($field->{line}, '\[\]'); } } } diff --git a/IkiWiki/Plugin/recentchangesdiff.pm b/IkiWiki/Plugin/recentchangesdiff.pm index 36acef72e..bc793bada 100644 --- a/IkiWiki/Plugin/recentchangesdiff.pm +++ b/IkiWiki/Plugin/recentchangesdiff.pm @@ -4,6 +4,7 @@ package IkiWiki::Plugin::recentchangesdiff; use warnings; use strict; use IkiWiki 2.00; +use HTML::Entities; my $maxlines=200; @@ -39,7 +40,7 @@ sub pagetemplate (@) { #{{{ $diff=join("", @lines); } # escape links and preprocessor stuff - $diff =~ s/(?param(diff => $diff); } } -- cgit v1.2.3