2 package IkiWiki::Plugin::recentchangesdiff;
12 hook(type => "getsetup", id => "recentchangesdiff",
14 hook(type => "pagetemplate", id => "recentchangesdiff",
15 call => \&pagetemplate);
18 sub getsetup () { #{{{
26 sub pagetemplate (@) { #{{{
28 my $template=$params{template};
29 if ($config{rcs} && exists $params{rev} && length $params{rev} &&
30 $template->query(name => "diff")) {
31 my @lines=IkiWiki::rcs_diff($params{rev});
34 if (@lines > $maxlines) {
35 # only include so many lines of diff
36 $diff=join("", @lines[0..($maxlines-1)])."\n".
37 gettext("(Diff truncated)");
40 $diff=join("", @lines);
43 $diff = encode_entities($diff);
44 # escape links and preprocessor stuff
45 $diff = encode_entities($diff, '\[\]');
46 $template->param(diff => $diff);