From a5ad70a8dc6d3aee22f29b84509ce945163d43dd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 29 Jan 2008 12:59:49 -0500 Subject: updates --- IkiWiki/Plugin/recentchanges.pm | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 6c9848ba3..1c52a00f2 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -14,9 +14,10 @@ sub import { #{{{ call => \&htmlize); } #}}} -sub needsbuild () { #{{{ +sub needsbuild ($) { #{{{ + my $needsbuild=shift; my @changes=IkiWiki::rcs_recentchanges(100); - updatechanges("*", "recentchanges", \@changes); + push @$needsbuild, updatechanges("*", "recentchanges", \@changes); } #}}} sub preprocess (@) { #{{{ @@ -61,11 +62,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 +74,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,21 +95,24 @@ 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"; + return $file; } #}}} sub updatechanges ($$) { #{{{ my $pagespec=shift; my $subdir=shift; my @changes=@{shift()}; + my @ret; foreach my $change (@changes) { - store($change, $subdir); + my $file=store($change, $subdir); + push @ret, $file if defined $file; } # TODO: delete old + + return @ret; } #}}} 1 -- cgit v1.2.3