X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/598d338b11cbcbf5d87517f3b8fcd99e357a31a2..35bc35660cafad2e8661077a9196bbf9b6fd3663:/IkiWiki/Plugin/recentchanges.pm diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 6c9848ba3..2525785e7 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -6,15 +6,15 @@ use strict; use IkiWiki 2.00; sub import { #{{{ - hook(type => "needsbuild", id => "recentchanges", - call => \&needsbuild); + hook(type => "refresh", id => "recentchanges", + call => \&refresh); hook(type => "preprocess", id => "recentchanges", call => \&preprocess); hook(type => "htmlize", id => "_change", call => \&htmlize); } #}}} -sub needsbuild () { #{{{ +sub refresh ($) { #{{{ my @changes=IkiWiki::rcs_recentchanges(100); updatechanges("*", "recentchanges", \@changes); } #}}} @@ -61,11 +61,6 @@ sub store ($$) { #{{{ ]; push @{$change->{pages}}, { link => '...' } if $is_excess; - # Take the first line of the commit message as a summary. - #my $m=shift @{$change->{message}}; - #$change->{summary}=$m->{line}; - #delete $change->{message} unless @{$change->{message}}; - # See if the committer is an openid. my $oiduser=IkiWiki::openiduser($change->{user}); if (defined $oiduser) { @@ -78,6 +73,15 @@ sub store ($$) { #{{{ $change->{user}; } + # escape wikilinks and preprocessor stuff in commit messages + if (ref $change->{message}) { + foreach my $field (@{$change->{message}}) { + if (exists $field->{line}) { + $field->{line} =~ s/(? 1); $template->param( @@ -90,20 +94,20 @@ sub store ($$) { #{{{ shift->(page => $page, destpage => $page, template => $template); }); - my $html=$template->output; - # escape wikilinks and preprocessor stuff - $html=~s/(?{when}, $change->{when}, "$config{srcdir}/$page._change"; + my $file=$page."._change"; + writefile($file, $config{srcdir}, $template->output); + utime $change->{when}, $change->{when}, "$config{srcdir}/$file"; } #}}} sub updatechanges ($$) { #{{{ my $pagespec=shift; my $subdir=shift; my @changes=@{shift()}; + foreach my $change (@changes) { store($change, $subdir); } + # TODO: delete old } #}}}