X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/8b31c53366bbee51b36501443eafd0f712ee6a4c..870adf3bbf459e3f234fb06322b750582ab47912:/IkiWiki/Plugin/recentchanges.pm diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index f5982604b..337fb7ac5 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -9,6 +9,7 @@ sub import { #{{{ hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig); hook(type => "refresh", id => "recentchanges", call => \&refresh); hook(type => "htmlize", id => "_change", call => \&htmlize); + hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate); } #}}} sub checkconfig () { #{{{ @@ -32,6 +33,18 @@ sub refresh ($) { #{{{ } } #}}} +# Enable the recentchanges link on wiki pages. +sub pagetemplate (@) { #{{{ + my %params=@_; + my $template=$params{template}; + my $page=$params{page}; + if ($config{rcs} && $page ne $config{recentchangespage} && + $template->query(name => "recentchangesurl")) { + $template->param(recentchangesurl => urlto($config{recentchangespage}, $page)); + $template->param(have_actions => 1); + } +} #}}} + # Pages with extension _change have plain html markup, pass through. sub htmlize (@) { #{{{ my %params=@_; @@ -60,13 +73,16 @@ sub store ($$$) { #{{{ else { $_->{link} = IkiWiki::pagetitle($_->{page}); } + $_->{baseurl}="$config{url}/" if length $config{url}; + $_; } @{$change->{pages}} ]; push @{$change->{pages}}, { link => '...' } if $is_excess; # See if the committer is an openid. - my $oiduser=IkiWiki::openiduser($change->{user}); + $change->{author}=$change->{user}; + my $oiduser=eval { IkiWiki::openiduser($change->{user}) }; if (defined $oiduser) { $change->{authorurl}=$change->{user}; $change->{user}=$oiduser; @@ -93,7 +109,6 @@ sub store ($$$) { #{{{ commitdate => displaytime($change->{when}, "%X %x"), wikiname => $config{wikiname}, ); - $template->param(baseurl => "$config{url}/") if length $config{url}; IkiWiki::run_hooks(pagetemplate => sub { shift->(page => $page, destpage => $page, template => $template); });