master
Joey Hess 2008-01-29 12:59:49 -05:00
parent c3ce3c3381
commit a5ad70a8dc
1 changed files with 21 additions and 13 deletions

View File

@ -14,9 +14,10 @@ sub import { #{{{
call => \&htmlize); call => \&htmlize);
} #}}} } #}}}
sub needsbuild () { #{{{ sub needsbuild ($) { #{{{
my $needsbuild=shift;
my @changes=IkiWiki::rcs_recentchanges(100); my @changes=IkiWiki::rcs_recentchanges(100);
updatechanges("*", "recentchanges", \@changes); push @$needsbuild, updatechanges("*", "recentchanges", \@changes);
} #}}} } #}}}
sub preprocess (@) { #{{{ sub preprocess (@) { #{{{
@ -61,11 +62,6 @@ sub store ($$) { #{{{
]; ];
push @{$change->{pages}}, { link => '...' } if $is_excess; 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. # See if the committer is an openid.
my $oiduser=IkiWiki::openiduser($change->{user}); my $oiduser=IkiWiki::openiduser($change->{user});
if (defined $oiduser) { if (defined $oiduser) {
@ -78,6 +74,15 @@ sub store ($$) { #{{{
$change->{user}; $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. # Fill out a template with the change info.
my $template=template("change.tmpl", blind_cache => 1); my $template=template("change.tmpl", blind_cache => 1);
$template->param( $template->param(
@ -90,21 +95,24 @@ sub store ($$) { #{{{
shift->(page => $page, destpage => $page, template => $template); shift->(page => $page, destpage => $page, template => $template);
}); });
my $html=$template->output; my $file=$page."._change";
# escape wikilinks and preprocessor stuff writefile($file, $config{srcdir}, $template->output);
$html=~s/(?<!\\)\[\[/\\\[\[/g; utime $change->{when}, $change->{when}, "$config{srcdir}/$file";
writefile($page."._change", $config{srcdir}, $html); return $file;
utime $change->{when}, $change->{when}, "$config{srcdir}/$page._change";
} #}}} } #}}}
sub updatechanges ($$) { #{{{ sub updatechanges ($$) { #{{{
my $pagespec=shift; my $pagespec=shift;
my $subdir=shift; my $subdir=shift;
my @changes=@{shift()}; my @changes=@{shift()};
my @ret;
foreach my $change (@changes) { foreach my $change (@changes) {
store($change, $subdir); my $file=store($change, $subdir);
push @ret, $file if defined $file;
} }
# TODO: delete old # TODO: delete old
return @ret;
} #}}} } #}}}
1 1