use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%pagestate %wikistate %renderedfiles %oldrenderedfiles
%pagesources %destsources %depends %depends_simple %hooks
- %forcerebuild %loaded_plugins};
+ %forcerebuild %loaded_plugins @autofiles %dellinks
+ %delrenderedfiles};
use Exporter q{import};
our @EXPORT = qw(hook debug error template htmlpage deptype
htmllink readfile writefile pagetype srcfile pagename
displaytime will_render gettext urlto targetpage
add_underlay pagetitle titlepage linkpage newpagefile
- inject add_link
+ inject add_link add_autofile
%config %links %pagestate %wikistate %renderedfiles
%pagesources %destsources);
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
$l.="/" if length $l;
$l.=$link;
- if (exists $links{$l}) {
+ if (exists $pagesources{$l}) {
return $l;
}
elsif (exists $pagecase{lc $l}) {
if (length $config{userdir}) {
my $l = "$config{userdir}/".lc($link);
- if (exists $links{$l}) {
+ if (exists $pagesources{$l}) {
return $l;
}
elsif (exists $pagecase{lc $l}) {
}
my @attrs;
- if (defined $opts{rel}) {
- push @attrs, ' rel="'.$opts{rel}.'"';
- }
- if (defined $opts{class}) {
- push @attrs, ' class="'.$opts{class}.'"';
+ foreach my $attr (qw{rel class title}) {
+ if (defined $opts{$attr}) {
+ push @attrs, " $attr=\"$opts{$attr}\"";
+ }
}
return "<a href=\"$bestlink\"@attrs>$linktext</a>";
my %old=map { $_ => 1 }
split("\n", readfile(srcfile($pagesources{$params{page}})));
foreach my $line (split("\n", $params{content})) {
- push @diff, $line if ! exists $old{$_};
+ push @diff, $line if ! exists $old{$line};
}
$params{diff}=join("\n", @diff);
}
unless grep { $_ eq $link } @{$links{$page}};
}
+sub add_autofile ($) {
+ my $addfile=shift;
+ my ($file,$page) = verify_src_file($addfile,$config{srcdir});
+ if ($page) {
+ push @autofiles, $file;
+ }
+}
+
sub pagespec_translate ($) {
my $spec=shift;