]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/recentchanges.pm
escape wikilinks and preprocessor directives
[ikiwiki.git] / IkiWiki / Plugin / recentchanges.pm
index bdd386c7bf3001ac4f0785d8c204e838c2bc6bad..6c9848ba356213d27b8886fa716395743654bfa0 100644 (file)
@@ -6,8 +6,6 @@ use strict;
 use IkiWiki 2.00;
 
 sub import { #{{{
-       hook(type => "checkconfig", id => "recentchanges",
-               call => \&checkconfig);
        hook(type => "needsbuild", id => "recentchanges",
                call => \&needsbuild);
        hook(type => "preprocess", id => "recentchanges",
@@ -16,15 +14,11 @@ sub import { #{{{
                call => \&htmlize);
 } #}}}
 
-sub checkconfig () { #{{{
+sub needsbuild () { #{{{
        my @changes=IkiWiki::rcs_recentchanges(100);
        updatechanges("*", "recentchanges", \@changes);
 } #}}}
 
-sub needsbuild () { #{{{
-       # TODO
-} #}}}
-
 sub preprocess (@) { #{{{
        my %params=@_;
 
@@ -88,7 +82,7 @@ sub store ($$) { #{{{
        my $template=template("change.tmpl", blind_cache => 1);
        $template->param(
                %$change,
-               commitdate => displaytime($change->{when}, "%x %x"),
+               commitdate => displaytime($change->{when}, "%X %x"),
                wikiname => $config{wikiname},
        );
        $template->param(baseurl => "$config{url}/") if length $config{url};
@@ -96,7 +90,10 @@ sub store ($$) { #{{{
                shift->(page => $page, destpage => $page, template => $template);
        });
 
-       writefile($page."._change", $config{srcdir}, $template->output);
+       my $html=$template->output;
+       # escape  wikilinks and preprocessor stuff
+       $html=~s/(?<!\\)\[\[/\\\[\[/g;
+       writefile($page."._change", $config{srcdir}, $html);
        utime $change->{when}, $change->{when}, "$config{srcdir}/$page._change";
 } #}}}