X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/fdb5da46b0122d9cb4b2611526c6c955478a80cf..1d696aef2c6b364b55070b15dcc7084d0b09daaf:/IkiWiki/Plugin/recentchanges.pm diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index d0e4176ff..4d7023c1c 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -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); @@ -115,8 +116,6 @@ sub store ($$$) { #{{{ my $change=shift; my $page="$config{recentchangespage}/change_".titlepage($change->{rev}); - my $baseurl = IkiWiki::baseurl(); - my $permalink="$baseurl$config{recentchangespage}/#change-".titlepage($change->{rev}); # Optimisation to avoid re-writing pages. Assumes commits never # change (or that any changes are not important). @@ -133,7 +132,7 @@ sub store ($$$) { #{{{ do => "recentchanges_link", page => $_->{page} ). - "\">". + "\" rel=\"nofollow\">". pagetitle($_->{page}). "" } @@ -161,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/(?{line} = encode_entities($field->{line}); + # escape links and preprocessor stuff + $field->{line} = encode_entities($field->{line}, '\[\]'); } } } @@ -175,10 +176,12 @@ sub store ($$$) { #{{{ $template->param( %$change, commitdate => displaytime($change->{when}, "%X %x"), - commitdate_raw => scalar localtime($change->{when}), wikiname => $config{wikiname}, - permalink => $permalink, ); + + $template->param(permalink => "$config{url}/$config{recentchangespage}/#change-".titlepage($change->{rev})) + if exists $config{url}; + IkiWiki::run_hooks(pagetemplate => sub { shift->(page => $page, destpage => $page, template => $template, rev => $change->{rev});