diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-29 12:59:49 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-29 12:59:49 -0500 |
commit | a5ad70a8dc6d3aee22f29b84509ce945163d43dd (patch) | |
tree | e30f3f35ca502bf3ae52675b7619ee74ce0ba61a | |
parent | c3ce3c33817875eb6d2e7369943359b1000c9869 (diff) | |
download | ikiwiki-a5ad70a8dc6d3aee22f29b84509ce945163d43dd.tar ikiwiki-a5ad70a8dc6d3aee22f29b84509ce945163d43dd.tar.gz |
updates
-rw-r--r-- | IkiWiki/Plugin/recentchanges.pm | 34 |
1 files 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/(?<!\\)\[\[/\\\[\[/g; + } + } + } + # Fill out a template with the change info. my $template=template("change.tmpl", blind_cache => 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/(?<!\\)\[\[/\\\[\[/g; - writefile($page."._change", $config{srcdir}, $html); - utime $change->{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 |