]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/recentchanges.pm
Add initial version of a postcomment plugin (temporarily namespaced as smcvpostcomment)
[git.ikiwiki.info.git] / IkiWiki / Plugin / recentchanges.pm
index 3f70664ac36990c87113721cac1daf2af42706fc..4d7023c1c1e5a0af91aad4841eb85c817dfefab3 100644 (file)
@@ -5,6 +5,7 @@ use warnings;
 use strict;
 use IkiWiki 2.00;
 use Encode;
+use HTML::Entities;
 
 sub import { #{{{
        hook(type => "getsetup", id => "recentchanges", call => \&getsetup);
@@ -159,11 +160,13 @@ sub store ($$$) { #{{{
                );
        }
 
-       # escape wikilinks and preprocessor stuff in commit messages
        if (ref $change->{message}) {
                foreach my $field (@{$change->{message}}) {
                        if (exists $field->{line}) {
-                               $field->{line} =~ s/(?<!\\)\[\[/\\\[\[/g;
+                               # escape html
+                               $field->{line} = encode_entities($field->{line});
+                               # escape links and preprocessor stuff
+                               $field->{line} = encode_entities($field->{line}, '\[\]');
                        }
                }
        }