use IkiWiki 2.00;
sub import { #{{{
- hook(type => "checkconfig", id => "recentchanges",
- call => \&checkconfig);
hook(type => "needsbuild", id => "recentchanges",
call => \&needsbuild);
hook(type => "preprocess", id => "recentchanges",
call => \&htmlize);
} #}}}
-sub checkconfig () { #{{{
+sub needsbuild () { #{{{
my @changes=IkiWiki::rcs_recentchanges(100);
updatechanges("*", "recentchanges", \@changes);
} #}}}
-sub needsbuild () { #{{{
- # TODO
-} #}}}
-
sub preprocess (@) { #{{{
my %params=@_;
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};
+ #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});
# Fill out a template with the change info.
my $template=template("change.tmpl", blind_cache => 1);
- $template->param(%$change);
+ $template->param(
+ %$change,
+ 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);
});
- writefile($page."._change", $config{srcdir}, $template->output);
+ 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";
} #}}}