X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=IkiWiki%2FPlugin%2Frecentchanges.pm;h=3f70664ac36990c87113721cac1daf2af42706fc;hb=2a56ec664402e21625e9251dcbb3b53490e7ed0d;hp=d534d0cd96f6a92416a507b34ff3d38c1ac1b7b0;hpb=ddef0d3170b1543e6ed580c7ce00849e3ed1550f;p=ikiwiki.git diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index d534d0cd9..3f70664ac 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -4,6 +4,7 @@ package IkiWiki::Plugin::recentchanges; use warnings; use strict; use IkiWiki 2.00; +use Encode; sub import { #{{{ hook(type => "getsetup", id => "recentchanges", call => \&getsetup); @@ -16,6 +17,10 @@ sub import { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 1, + rebuild => 1, + }, recentchangespage => { type => "string", example => "recentchanges", @@ -82,7 +87,7 @@ sub cgi ($) { #{{{ # page they link to is deleted, or newly created, or # changes for whatever reason. So this CGI handles that # dynamic linking stuff. - my $page=$cgi->param("page"); + my $page=decode_utf8($cgi->param("page")); if (!defined $page) { error("missing page parameter"); } @@ -99,7 +104,7 @@ sub cgi ($) { #{{{ "

"); } else { - IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link))); + IkiWiki::redirect($cgi, urlto($link, undef, 1)); } exit; @@ -109,7 +114,7 @@ sub cgi ($) { #{{{ sub store ($$$) { #{{{ my $change=shift; - my $page="$config{recentchangespage}/change_".IkiWiki::titlepage($change->{rev}); + my $page="$config{recentchangespage}/change_".titlepage($change->{rev}); # Optimisation to avoid re-writing pages. Assumes commits never # change (or that any changes are not important). @@ -126,12 +131,12 @@ sub store ($$$) { #{{{ do => "recentchanges_link", page => $_->{page} ). - "\">". - IkiWiki::pagetitle($_->{page}). + "\" rel=\"nofollow\">". + pagetitle($_->{page}). "" } else { - $_->{link} = IkiWiki::pagetitle($_->{page}); + $_->{link} = pagetitle($_->{page}); } $_->{baseurl}="$config{url}/" if length $config{url}; @@ -170,6 +175,10 @@ sub store ($$$) { #{{{ commitdate => displaytime($change->{when}, "%X %x"), wikiname => $config{wikiname}, ); + + $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});