* Use forcebaseurl to make page previews be displayed with the html base
[ikiwiki.git] / IkiWiki / Plugin / recentchangesdiff.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::recentchangesdiff;
3
4 use warnings;
5 use strict;
6 use IkiWiki 2.00;
7
8 sub import { #{{{
9         hook(type => "pagetemplate", id => "recentchangesdiff",
10                 call => \&pagetemplate);
11 } #}}}
12
13 sub pagetemplate (@) { #{{{
14         my %params=@_;
15         my $template=$params{template};
16         if ($config{rcs} && exists $params{rev} && length $params{rev} &&
17             $template->query(name => "diff")) {
18                 my $diff=IkiWiki::rcs_diff($params{rev});
19                 if (defined $diff && length $diff) {
20                         # escape links and preprocessor stuff
21                         $diff =~ s/(?<!\\)\[\[/\\\[\[/g;
22                         $template->param(diff => $diff);
23                 }
24         }
25 } #}}}
26
27 1