aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-09 22:50:27 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-09 22:50:27 +0000
commitdae0f48e91304afcb6ebe0936360e51b22a56548 (patch)
tree930090e4343087dac7ae6693d420d80b826c57f2 /IkiWiki/Plugin
parentd92142d09eaec9018c0cdc96f9ad3bd4a0c876a7 (diff)
downloadikiwiki-dae0f48e91304afcb6ebe0936360e51b22a56548.tar
ikiwiki-dae0f48e91304afcb6ebe0936360e51b22a56548.tar.gz
* Work on firming up the plugin interface:
- Plugins should not need to load IkiWiki::Render to get commonly used functions, so moved some functions from there to IkiWiki. - Picked out the set of functions and variables that most plugins use, documented them, and made IkiWiki export them by default, like a proper perl module should. - Use the other functions at your own risk. - This is not quite complete, I still have to decide whether to export some other things. * Changed all plugins included in ikiwiki to not use "IkiWiki::" when referring to stuff now exported by the IkiWiki module. * Anyone with a third-party ikiwiki plugin is strongly enrouraged to make like changes to it and avoid use of non-exported symboles from "IkiWiki::". * Link debian/changelog and debian/news to NEWS and CHANGELOG. * Support hyperestradier version 1.4.2, which adds a new required phraseform setting.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm60
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm19
-rw-r--r--IkiWiki/Plugin/camelcase.pm3
-rw-r--r--IkiWiki/Plugin/ddate.pm12
-rw-r--r--IkiWiki/Plugin/fortune.pm4
-rw-r--r--IkiWiki/Plugin/googlecalendar.pm4
-rw-r--r--IkiWiki/Plugin/haiku.pm5
-rw-r--r--IkiWiki/Plugin/html.pm6
-rw-r--r--IkiWiki/Plugin/htmlscrubber.pm3
-rw-r--r--IkiWiki/Plugin/htmltidy.pm4
-rw-r--r--IkiWiki/Plugin/inline.pm7
-rw-r--r--IkiWiki/Plugin/linkmap.pm20
-rw-r--r--IkiWiki/Plugin/map.pm11
-rw-r--r--IkiWiki/Plugin/mdwn.pm4
-rw-r--r--IkiWiki/Plugin/meta.pm11
-rw-r--r--IkiWiki/Plugin/orphans.pm23
-rw-r--r--IkiWiki/Plugin/otl.pm14
-rw-r--r--IkiWiki/Plugin/pagecount.pm9
-rw-r--r--IkiWiki/Plugin/pagestats.pm13
-rw-r--r--IkiWiki/Plugin/polygen.pm3
-rw-r--r--IkiWiki/Plugin/rst.pm4
-rw-r--r--IkiWiki/Plugin/search.pm47
-rw-r--r--IkiWiki/Plugin/sidebar.pm13
-rw-r--r--IkiWiki/Plugin/skeleton.pm58
-rw-r--r--IkiWiki/Plugin/smiley.pm12
-rw-r--r--IkiWiki/Plugin/tag.pm21
-rw-r--r--IkiWiki/Plugin/template.pm11
-rw-r--r--IkiWiki/Plugin/toc.pm6
-rw-r--r--IkiWiki/Plugin/wikitext.pm2
29 files changed, 184 insertions, 225 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 22f46aac0..ac55dcb1d 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -14,30 +14,24 @@ my %feeds;
my %guids;
sub import { #{{{
- IkiWiki::hook(type => "getopt", id => "aggregate",
- call => \&getopt);
- IkiWiki::hook(type => "checkconfig", id => "aggregate",
- call => \&checkconfig);
- IkiWiki::hook(type => "filter", id => "aggregate",
- call => \&filter);
- IkiWiki::hook(type => "preprocess", id => "aggregate",
- call => \&preprocess);
- IkiWiki::hook(type => "delete", id => "aggregate",
- call => \&delete);
- IkiWiki::hook(type => "savestate", id => "aggregate",
- call => \&savestate);
+ hook(type => "getopt", id => "aggregate", call => \&getopt);
+ hook(type => "checkconfig", id => "aggregate", call => \&checkconfig);
+ hook(type => "filter", id => "aggregate", call => \&filter);
+ hook(type => "preprocess", id => "aggregate", call => \&preprocess);
+ hook(type => "delete", id => "aggregate", call => \&delete);
+ hook(type => "savestate", id => "aggregate", call => \&savestate);
} # }}}
sub getopt () { #{{{
eval q{use Getopt::Long};
Getopt::Long::Configure('pass_through');
- GetOptions("aggregate" => \$IkiWiki::config{aggregate});
+ GetOptions("aggregate" => \$config{aggregate});
} #}}}
sub checkconfig () { #{{{
IkiWiki::lockwiki();
loadstate();
- if ($IkiWiki::config{aggregate}) {
+ if ($config{aggregate}) {
IkiWiki::loadindex();
aggregate();
savestate();
@@ -78,7 +72,7 @@ sub preprocess (@) { #{{{
$feed->{url}=$params{url};
my $dir=exists $params{dir} ? $params{dir} : $params{page}."/".IkiWiki::titlepage($params{name});
$dir=~s/^\/+//;
- ($dir)=$dir=~/$IkiWiki::config{wiki_file_regexp}/;
+ ($dir)=$dir=~/$config{wiki_file_regexp}/;
$feed->{dir}=$dir;
$feed->{feedurl}=defined $params{feedurl} ? $params{feedurl} : "";
$feed->{updateinterval}=defined $params{updateinterval} ? $params{updateinterval} * 60 : 15 * 60;
@@ -109,15 +103,15 @@ sub delete (@) { #{{{
# Remove feed data for removed pages.
foreach my $file (@files) {
- my $page=IkiWiki::pagename($file);
+ my $page=pagename($file);
remove_feeds($page);
}
} #}}}
sub loadstate () { #{{{
- if (-e "$IkiWiki::config{wikistatedir}/aggregate") {
- open (IN, "$IkiWiki::config{wikistatedir}/aggregate" ||
- die "$IkiWiki::config{wikistatedir}/aggregate: $!");
+ if (-e "$config{wikistatedir}/aggregate") {
+ open (IN, "$config{wikistatedir}/aggregate" ||
+ die "$config{wikistatedir}/aggregate: $!");
while (<IN>) {
$_=IkiWiki::possibly_foolish_untaint($_);
chomp;
@@ -151,8 +145,8 @@ sub loadstate () { #{{{
sub savestate () { #{{{
eval q{use HTML::Entities};
die $@ if $@;
- open (OUT, ">$IkiWiki::config{wikistatedir}/aggregate" ||
- die "$IkiWiki::config{wikistatedir}/aggregate: $!");
+ open (OUT, ">$config{wikistatedir}/aggregate" ||
+ die "$config{wikistatedir}/aggregate: $!");
foreach my $data (values %feeds, values %guids) {
if ($data->{remove}) {
if ($data->{name}) {
@@ -193,19 +187,19 @@ sub aggregate () { #{{{
die $@ if $@;
foreach my $feed (values %feeds) {
- next unless $IkiWiki::config{rebuild} ||
+ next unless $config{rebuild} ||
time - $feed->{lastupdate} >= $feed->{updateinterval};
$feed->{lastupdate}=time;
$feed->{newposts}=0;
$IkiWiki::forcerebuild{$feed->{sourcepage}}=1;
- IkiWiki::debug("checking feed ".$feed->{name}." ...");
+ debug("checking feed ".$feed->{name}." ...");
if (! length $feed->{feedurl}) {
my @urls=XML::Feed->find_feeds($feed->{url});
if (! @urls) {
$feed->{message}="could not find feed at ".$feed->{feedurl};
- IkiWiki::debug($feed->{message});
+ debug($feed->{message});
next;
}
$feed->{feedurl}=pop @urls;
@@ -213,12 +207,12 @@ sub aggregate () { #{{{
my $f=eval{XML::Feed->parse(URI->new($feed->{feedurl}))};
if ($@) {
$feed->{message}="feed crashed XML::Feed! $@";
- IkiWiki::debug($feed->{message});
+ debug($feed->{message});
next;
}
if (! $f) {
$feed->{message}=XML::Feed->errstr;
- IkiWiki::debug($feed->{message});
+ debug($feed->{message});
next;
}
@@ -234,7 +228,7 @@ sub aggregate () { #{{{
}
$feed->{message}="processed ok at ".
- IkiWiki::displaytime($feed->{lastupdate});
+ displaytime($feed->{lastupdate});
}
# TODO: expiry
@@ -264,7 +258,7 @@ sub add_page (@) { #{{{
# directory name or trigger ".." disallowing code.
$page=~s!([/.])!"__".ord($1)."__"!eg;
$page=$feed->{dir}."/".$page;
- ($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/;
+ ($page)=$page=~/$config{wiki_file_regexp}/;
if (! defined $page || ! length $page) {
$page=$feed->{dir}."/item";
}
@@ -274,7 +268,7 @@ sub add_page (@) { #{{{
$c++
}
$guid->{page}=$page;
- IkiWiki::debug("creating new page $page");
+ debug("creating new page $page");
}
$guid->{feed}=$feed->{name};
@@ -284,11 +278,11 @@ sub add_page (@) { #{{{
eval q{use Digest::MD5 'md5_hex'};
require Encode;
my $digest=md5_hex(Encode::encode_utf8($params{content}));
- return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $IkiWiki::config{rebuild};
+ return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $config{rebuild};
$guid->{md5}=$digest;
# Create the page.
- my $template=IkiWiki::template("aggregatepost.tmpl", blind_cache => 1);
+ my $template=template("aggregatepost.tmpl", blind_cache => 1);
$template->param(title => $params{title})
if defined $params{title} && length($params{title});
$template->param(content => htmlescape(htmlabs($params{content}, $feed->{feedurl})));
@@ -299,7 +293,7 @@ sub add_page (@) { #{{{
if (ref $feed->{tags}) {
$template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]);
}
- IkiWiki::writefile(IkiWiki::htmlpage($guid->{page}), $IkiWiki::config{srcdir},
+ writefile(htmlpage($guid->{page}), $config{srcdir},
$template->output);
# Set the mtime, this lets the build process get the right creation
@@ -374,7 +368,7 @@ sub remove_feeds () { #{{{
sub pagefile ($) { #{{{
my $page=shift;
- return "$IkiWiki::config{srcdir}/".IkiWiki::htmlpage($page);
+ return "$config{srcdir}/".htmlpage($page);
} #}}}
1
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index 7fae9a2f2..225d8d829 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -7,8 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "brokenlinks",
- call => \&preprocess);
+ hook(type => "preprocess", id => "brokenlinks", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -17,19 +16,19 @@ sub preprocess (@) { #{{{
# Needs to update whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
my @broken;
- foreach my $page (keys %IkiWiki::links) {
- if (IkiWiki::pagespec_match($page, $params{pages})) {
- foreach my $link (@{$IkiWiki::links{$page}}) {
- next if $link =~ /.*\/discussion/i && $IkiWiki::config{discussion};
- my $bestlink=IkiWiki::bestlink($page, $link);
+ foreach my $page (keys %links) {
+ if (pagespec_match($page, $params{pages})) {
+ foreach my $link (@{$links{$page}}) {
+ next if $link =~ /.*\/discussion/i && $config{discussion};
+ my $bestlink=bestlink($page, $link);
next if length $bestlink;
push @broken,
- IkiWiki::htmllink($page, $params{destpage}, $link, 1).
+ htmllink($page, $params{destpage}, $link, 1).
" in ".
- IkiWiki::htmllink($params{page}, $params{destpage}, $page, 1);
+ htmllink($params{page}, $params{destpage}, $page, 1);
}
}
}
diff --git a/IkiWiki/Plugin/camelcase.pm b/IkiWiki/Plugin/camelcase.pm
index 68d399d77..0bb35b6e2 100644
--- a/IkiWiki/Plugin/camelcase.pm
+++ b/IkiWiki/Plugin/camelcase.pm
@@ -2,11 +2,12 @@
# CamelCase links
package IkiWiki::Plugin::camelcase;
+use IkiWiki;
use warnings;
use strict;
sub import { #{{{
- IkiWiki::hook(type => "filter", id => "camelcase", call => \&filter);
+ hook(type => "filter", id => "camelcase", call => \&filter);
} # }}}
sub filter (@) { #{{{
diff --git a/IkiWiki/Plugin/ddate.pm b/IkiWiki/Plugin/ddate.pm
index 4e9d919a3..b67702655 100644
--- a/IkiWiki/Plugin/ddate.pm
+++ b/IkiWiki/Plugin/ddate.pm
@@ -2,18 +2,16 @@
# Discordian date support fnord ikiwiki.
package IkiWiki::Plugin::ddate;
use IkiWiki;
-use IkiWiki::Render; # so we can redefine it here
no warnings;
sub import { #{{{
- IkiWiki::hook(type => "checkconfig", id => "skeleton",
- call => \&checkconfig);
+ hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
} # }}}
sub checkconfig () { #{{{
- if (! defined $IkiWiki::config{timeformat} ||
- $IkiWiki::config{timeformat} eq '%c') {
- $IkiWiki::config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
+ if (! defined $config{timeformat} ||
+ $config{timeformat} eq '%c') {
+ $config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
}
} #}}}
@@ -21,7 +19,7 @@ sub IkiWiki::displaytime ($) { #{{{
my $time=shift;
eval q{use POSIX};
my $gregorian=POSIX::strftime("%d %m %Y", localtime($time));
- my $date=`ddate +'$IkiWiki::config{timeformat}' $gregorian`;
+ my $date=`ddate +'$config{timeformat}' $gregorian`;
chomp $date;
if ($? || ! length $date) {
return "some time or other (hail Eris!)";
diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm
index 8e96bdbbd..43f4526af 100644
--- a/IkiWiki/Plugin/fortune.pm
+++ b/IkiWiki/Plugin/fortune.pm
@@ -2,12 +2,12 @@
# Include a fortune in a page
package IkiWiki::Plugin::fortune;
+use IkiWiki;
use warnings;
use strict;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "fortune",
- call => \&preprocess);
+ hook(type => "preprocess", id => "fortune", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm
index c99563d95..c6abeb717 100644
--- a/IkiWiki/Plugin/googlecalendar.pm
+++ b/IkiWiki/Plugin/googlecalendar.pm
@@ -7,9 +7,9 @@ use IkiWiki;
use IPC::Open2;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "googlecalendar",
+ hook(type => "preprocess", id => "googlecalendar",
call => \&preprocess);
- IkiWiki::hook(type => "format", id => "googlecalendar",
+ hook(type => "format", id => "googlecalendar",
call => \&format);
} # }}}
diff --git a/IkiWiki/Plugin/haiku.pm b/IkiWiki/Plugin/haiku.pm
index e2873ec6f..fe8a782fa 100644
--- a/IkiWiki/Plugin/haiku.pm
+++ b/IkiWiki/Plugin/haiku.pm
@@ -7,8 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "haiku",
- call => \&preprocess);
+ hook(type => "preprocess", id => "haiku", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -16,7 +15,7 @@ sub preprocess (@) { #{{{
my $haiku;
eval q{use Coy};
- if ($@) {
+ if ($@ || ! Coy->can("Coy::with_haiku")) {
my @canned=(
"The lack of a Coy:
No darting, subtle haiku.
diff --git a/IkiWiki/Plugin/html.pm b/IkiWiki/Plugin/html.pm
index 83720b4b5..4270a7eb6 100644
--- a/IkiWiki/Plugin/html.pm
+++ b/IkiWiki/Plugin/html.pm
@@ -7,12 +7,12 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "htmlize", id => "html", call => \&htmlize);
- IkiWiki::hook(type => "htmlize", id => "htm", call => \&htmlize);
+ hook(type => "htmlize", id => "html", call => \&htmlize);
+ hook(type => "htmlize", id => "htm", call => \&htmlize);
# ikiwiki defaults to skipping .html files as a security measure;
# make it process them so this plugin can take effect
- $IkiWiki::config{wiki_file_prune_regexp} =~ s/\|\\\.x\?html\?\$//;
+ $config{wiki_file_prune_regexp} =~ s/\|\\\.x\?html\?\$//;
} # }}}
sub htmlize (@) { #{{{
diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm
index d77ab809b..3035307c2 100644
--- a/IkiWiki/Plugin/htmlscrubber.pm
+++ b/IkiWiki/Plugin/htmlscrubber.pm
@@ -6,8 +6,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "sanitize", id => "htmlscrubber",
- call => \&sanitize);
+ hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
} # }}}
sub sanitize (@) { #{{{
diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm
index c626250cb..906c677dc 100644
--- a/IkiWiki/Plugin/htmltidy.pm
+++ b/IkiWiki/Plugin/htmltidy.pm
@@ -13,7 +13,7 @@ use IkiWiki;
use IPC::Open2;
sub import { #{{{
- IkiWiki::hook(type => "sanitize", id => "tidy", call => \&sanitize);
+ hook(type => "sanitize", id => "tidy", call => \&sanitize);
} # }}}
sub sanitize (@) { #{{{
@@ -28,7 +28,7 @@ sub sanitize (@) { #{{{
last unless $@;
$tries--;
if ($tries < 1) {
- IkiWiki::debug("failed to run tidy: $@");
+ debug("failed to run tidy: $@");
return $params{content};
}
}
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 6661ed215..79e64beac 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -5,17 +5,18 @@ package IkiWiki::Plugin::inline;
use warnings;
use strict;
use IkiWiki;
+use IkiWiki::Render; # for displaytime
use URI;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "inline",
+ hook(type => "preprocess", id => "inline",
call => \&IkiWiki::preprocess_inline);
- IkiWiki::hook(type => "pagetemplate", id => "inline",
+ hook(type => "pagetemplate", id => "inline",
call => \&IkiWiki::pagetemplate_inline);
# Hook to change to do pinging since it's called late.
# This ensures each page only pings once and prevents slow
# pings interrupting page builds.
- IkiWiki::hook(type => "change", id => "inline",
+ hook(type => "change", id => "inline",
call => \&IkiWiki::pingurl);
} # }}}
diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
index 2405cae7f..6b1609744 100644
--- a/IkiWiki/Plugin/linkmap.pm
+++ b/IkiWiki/Plugin/linkmap.pm
@@ -7,10 +7,8 @@ use IkiWiki;
use IPC::Open2;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "linkmap",
- call => \&preprocess);
- IkiWiki::hook(type => "format", id => "linkmap",
- call => \&format);
+ hook(type => "preprocess", id => "linkmap", call => \&preprocess);
+ hook(type => "format", id => "linkmap", call => \&format);
} # }}}
my $mapnum=0;
@@ -23,7 +21,7 @@ sub preprocess (@) { #{{{
# Needs to update whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
# Can't just return the linkmap here, since the htmlscrubber
# scrubs out all <object> tags (with good reason!)
@@ -49,9 +47,9 @@ sub genmap ($) { #{{{
# Get all the items to map.
my %mapitems = ();
- foreach my $item (keys %IkiWiki::links) {
- if (IkiWiki::pagespec_match($item, $params{pages})) {
- my $link=IkiWiki::htmlpage($item);
+ foreach my $item (keys %links) {
+ if (pagespec_match($item, $params{pages})) {
+ my $link=htmlpage($item);
$link=IkiWiki::abs2rel($link, IkiWiki::dirname($params{page}));
$mapitems{$item}=$link;
}
@@ -59,7 +57,7 @@ sub genmap ($) { #{{{
# Use ikiwiki's function to create the file, this makes sure needed
# subdirs are there and does some sanity checking.
- IkiWiki::writefile("$params{page}.png", $IkiWiki::config{destdir}, "");
+ writefile("$params{page}.png", $config{destdir}, "");
# Run dot to create the graphic and get the map data.
# TODO: should really add the png to renderedfiles and call
@@ -69,7 +67,7 @@ sub genmap ($) { #{{{
my $pid;
while (1) {
eval {
- $pid=open2(*IN, *OUT, "dot -Tpng -o '$IkiWiki::config{destdir}/$params{page}.png' -Tcmapx");
+ $pid=open2(*IN, *OUT, "dot -Tpng -o '$config{destdir}/$params{page}.png' -Tcmapx");
};
last unless $@;
$tries--;
@@ -88,7 +86,7 @@ sub genmap ($) { #{{{
if defined $params{width} and defined $params{height};
foreach my $item (keys %mapitems) {
print OUT "\"$item\" [shape=box,href=\"$mapitems{$item}\"];\n";
- foreach my $link (map { IkiWiki::bestlink($item, $_) } @{$IkiWiki::links{$item}}) {
+ foreach my $link (map { bestlink($item, $_) } @{$links{$item}}) {
print OUT "\"$item\" -> \"$link\";\n"
if $mapitems{$link};
}
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 27ae0c6a3..96daf39fc 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -12,8 +12,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "map",
- call => \&preprocess);
+ hook(type => "preprocess", id => "map", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -22,12 +21,12 @@ sub preprocess (@) { #{{{
# Needs to update whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
# Get all the items to map.
my @mapitems = ();
- foreach my $page (keys %IkiWiki::links) {
- if (IkiWiki::pagespec_match($page, $params{pages})) {
+ foreach my $page (keys %links) {
+ if (pagespec_match($page, $params{pages})) {
push @mapitems, $page;
}
}
@@ -50,7 +49,7 @@ sub preprocess (@) { #{{{
}
$map .= "</li>\n" if $openli;
$map .= "<li>"
- .IkiWiki::htmllink($params{page}, $params{destpage}, $item) ."\n";
+ .htmllink($params{page}, $params{destpage}, $item) ."\n";
$openli=1;
}
while ($indent > 0) {
diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index 2274fea72..e5228c329 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -7,7 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "htmlize", id => "mdwn", call => \&htmlize);
+ hook(type => "htmlize", id => "mdwn", call => \&htmlize);
} # }}}
my $markdown_loaded=0;
@@ -26,7 +26,7 @@ sub htmlize (@) { #{{{
eval q{use Markdown};
if ($@) {
do "/usr/bin/markdown" ||
- IkiWiki::error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+ error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
}
$markdown_loaded=1;
require Encode;
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 9b026fffa..5bcd65837 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -13,12 +13,9 @@ my %author;
my %authorurl;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "meta",
- call => \&preprocess);
- IkiWiki::hook(type => "filter", id => "meta",
- call => \&filter);
- IkiWiki::hook(type => "pagetemplate", id => "meta",
- call => \&pagetemplate);
+ hook(type => "preprocess", id => "meta", call => \&preprocess);
+ hook(type => "filter", id => "meta", call => \&filter);
+ hook(type => "pagetemplate", id => "meta", call => \&pagetemplate);
} # }}}
sub filter (@) { #{{{
@@ -54,7 +51,7 @@ sub preprocess (@) { #{{{
}
else {
# hidden WikiLink
- push @{$IkiWiki::links{$page}}, $value;
+ push @{$links{$page}}, $value;
}
}
elsif ($key eq 'title') {
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 2219634ca..3a8a7954f 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -7,8 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "orphans",
- call => \&preprocess);
+ hook(type => "preprocess", id => "orphans", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -17,30 +16,30 @@ sub preprocess (@) { #{{{
# Needs to update whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
my %linkedto;
- foreach my $p (keys %IkiWiki::links) {
- map { $linkedto{IkiWiki::bestlink($p, $_)}=1 if length $_ }
- @{$IkiWiki::links{$p}};
+ foreach my $p (keys %links) {
+ map { $linkedto{bestlink($p, $_)}=1 if length $_ }
+ @{$links{$p}};
}
my @orphans;
- foreach my $page (keys %IkiWiki::renderedfiles) {
+ foreach my $page (keys %renderedfiles) {
next if $linkedto{$page};
- next unless IkiWiki::pagespec_match($page, $params{pages});
+ next unless pagespec_match($page, $params{pages});
# If the page has a link to some other page, it's
# indirectly linked to a page via that page's backlinks.
next if grep {
length $_ &&
- ($_ !~ /\/Discussion$/i || ! $IkiWiki::config{discussion}) &&
- IkiWiki::bestlink($page, $_) !~ /^($page|)$/
- } @{$IkiWiki::links{$page}};
+ ($_ !~ /\/Discussion$/i || ! $config{discussion}) &&
+ bestlink($page, $_) !~ /^($page|)$/
+ } @{$links{$page}};
push @orphans, $page;
}
return "All pages are linked to by other pages." unless @orphans;
- return "<ul>\n".join("\n", map { "<li>".IkiWiki::htmllink($params{page}, $params{destpage}, $_, 1)."</li>" } sort @orphans)."</ul>\n";
+ return "<ul>\n".join("\n", map { "<li>".htmllink($params{page}, $params{destpage}, $_, 1)."</li>" } sort @orphans)."</ul>\n";
} # }}}
1
diff --git a/IkiWiki/Plugin/otl.pm b/IkiWiki/Plugin/otl.pm
index b10d5e807..3f3413390 100644
--- a/IkiWiki/Plugin/otl.pm
+++ b/IkiWiki/Plugin/otl.pm
@@ -7,8 +7,8 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "filter", id => "otl", call => \&filter);
- IkiWiki::hook(type => "htmlize", id => "otl", call => \&htmlize);
+ hook(type => "filter", id => "otl", call => \&filter);
+ hook(type => "htmlize", id => "otl", call => \&htmlize);
} # }}}
@@ -16,9 +16,9 @@ sub filter (@) { #{{{
my %params=@_;
# Munge up check boxes to look a little bit better. This is a hack.
- my $checked=IkiWiki::htmllink($params{page}, $params{page},
+ my $checked=htmllink($params{page}, $params{page},
"smileys/star_on.png", 0, 0, "[X]");
- my $unchecked=IkiWiki::htmllink($params{page}, $params{page},
+ my $unchecked=htmllink($params{page}, $params{page},
"smileys/star_off.png", 0, 0, "[_]");
$params{content}=~s/^(\s*)\[X\]\s/${1}$checked /mg;
$params{content}=~s/^(\s*)\[_\]\s/${1}$unchecked /mg;
@@ -40,7 +40,7 @@ sub htmlize (@) { #{{{
unless (defined $pid) {
$tries--;
if ($tries < 1) {
- IkiWiki::debug("failed to fork: $@");
+ debug("failed to fork: $@");
return $params{content};
}
}
@@ -55,7 +55,7 @@ sub htmlize (@) { #{{{
unless (defined $pid) {
$tries--;
if ($tries < 1) {
- IkiWiki::debug("failed to fork: $@");
+ debug("failed to fork: $@");
print $params{content};
exit;
}
@@ -64,7 +64,7 @@ sub htmlize (@) { #{{{
if (! $pid) {
if (! exec 'otl2html', '-S', '/dev/null', '-T', '/dev/stdin') {
- IkiWiki::debug("failed to run otl2html: $@");
+ debug("failed to run otl2html: $@");
print $params{content};
exit;
}
diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm
index cfc962b6c..7ced15982 100644
--- a/IkiWiki/Plugin/pagecount.pm
+++ b/IkiWiki/Plugin/pagecount.pm
@@ -7,8 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "pagecount",
- call => \&preprocess);
+ hook(type => "preprocess", id => "pagecount", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -17,13 +16,13 @@ sub preprocess (@) { #{{{
# Needs to update count whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
- my @pages=keys %IkiWiki::pagesources;
+ my @pages=keys %pagesources;
return $#pages+1 if $params{pages} eq "*"; # optimisation
my $count=0;
foreach my $page (@pages) {
- $count++ if IkiWiki::pagespec_match($page, $params{pages});
+ $count++ if pagespec_match($page, $params{pages});
}
return $count;
} # }}}
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index 8ce563fc5..0958f5af6 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -18,8 +18,7 @@ use IkiWiki;
our @classes = ('smallestPC', 'smallPC', 'normalPC', 'bigPC', 'biggestPC' );
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "pagestats",
- call => \&preprocess);
+ hook(type => "preprocess", id => "pagestats", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -29,12 +28,12 @@ sub preprocess (@) { #{{{
# Needs to update whenever a page is added or removed, so
# register a dependency.
- IkiWiki::add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages});
my %counts;
my $max = 0;
- foreach my $page (keys %IkiWiki::links) {
- if (IkiWiki::pagespec_match($page, $params{pages})) {
+ foreach my $page (keys %links) {
+ if (pagespec_match($page, $params{pages})) {
my @bl = IkiWiki::backlinks($page);
$counts{$page} = scalar(@bl);
$max = $counts{$page} if $counts{$page} > $max;
@@ -45,7 +44,7 @@ sub preprocess (@) { #{{{
return "<table class='pageStats'>\n".
join("\n", map {
"<tr><td>".
- IkiWiki::htmllink($params{page}, $params{destpage}, $_, 1).
+ htmllink($params{page}, $params{destpage}, $_, 1).
"</td><td>".$counts{$_}."</td></tr>"
}
sort { $counts{$b} <=> $counts{$a} } keys %counts).
@@ -57,7 +56,7 @@ sub preprocess (@) { #{{{
foreach my $page (sort keys %counts) {
my $class = $classes[$counts{$page} * scalar(@classes) / ($max + 1)];
$res .= "<span class=\"$class\">".
- IkiWiki::htmllink($params{page}, $params{destpage}, $page).
+ htmllink($params{page}, $params{destpage}, $page).
"</span>\n";
}
$res .= "</div>\n";
diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm
index 82fd575a7..05ad4416e 100644
--- a/IkiWiki/Plugin/polygen.pm
+++ b/IkiWiki/Plugin/polygen.pm
@@ -11,8 +11,7 @@ use IkiWiki;
use File::Find;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "polygen",
- call => \&preprocess);
+ hook(type => "preprocess", id => "polygen", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
diff --git a/IkiWiki/Plugin/rst.pm b/IkiWiki/Plugin/rst.pm
index 789a70ac7..1fd13d1f5 100644
--- a/IkiWiki/Plugin/rst.pm
+++ b/IkiWiki/Plugin/rst.pm
@@ -36,7 +36,7 @@ print html[html.find('<body>')+6:html.find('</body>')].strip();
";
sub import { #{{{
- IkiWiki::hook(type => "htmlize", id => "rst", call => \&htmlize);
+ hook(type => "htmlize", id => "rst", call => \&htmlize);
} # }}}
sub htmlize (@) { #{{{
@@ -54,7 +54,7 @@ sub htmlize (@) { #{{{
last unless $@;
$tries--;
if ($tries < 1) {
- IkiWiki::debug("failed to run python to convert rst: $@");
+ debug("failed to run python to convert rst: $@");
return $content;
}
}
diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index c8e0dd580..b6fca66ff 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -7,22 +7,22 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "checkconfig", id => "hyperestraier",
+ hook(type => "checkconfig", id => "hyperestraier",
call => \&checkconfig);
- IkiWiki::hook(type => "pagetemplate", id => "hyperestraier",
+ hook(type => "pagetemplate", id => "hyperestraier",
call => \&pagetemplate);
- IkiWiki::hook(type => "delete", id => "hyperestraier",
+ hook(type => "delete", id => "hyperestraier",
call => \&delete);
- IkiWiki::hook(type => "change", id => "hyperestraier",
+ hook(type => "change", id => "hyperestraier",
call => \&change);
- IkiWiki::hook(type => "cgi", id => "hyperestraier",
+ hook(type => "cgi", id => "hyperestraier",
call => \&cgi);
} # }}}
sub checkconfig () { #{{{
foreach my $required (qw(url cgiurl)) {
- if (! length $IkiWiki::config{$required}) {
- IkiWiki::error("Must specify $required when using the search plugin\n");
+ if (! length $config{$required}) {
+ error("Must specify $required when using the search plugin\n");
}
}
} #}}}
@@ -36,8 +36,8 @@ sub pagetemplate (@) { #{{{
# Add search box to page header.
if ($template->query(name => "searchform")) {
if (! defined $form) {
- my $searchform = IkiWiki::template("searchform.tmpl", blind_cache => 1);
- $searchform->param(searchaction => $IkiWiki::config{cgiurl});
+ my $searchform = template("searchform.tmpl", blind_cache => 1);
+ $searchform->param(searchaction => $config{cgiurl});
$form=$searchform->output;
}
@@ -46,19 +46,19 @@ sub pagetemplate (@) { #{{{
} #}}}
sub delete (@) { #{{{
- IkiWiki::debug("cleaning hyperestraier search index");
- IkiWiki::estcmd("purge -cl");
- IkiWiki::estcfg();
+ debug("cleaning hyperestraier search index");
+ estcmd("purge -cl");
+ estcfg();
} #}}}
sub change (@) { #{{{
- IkiWiki::debug("updating hyperestraier search index");
- IkiWiki::estcmd("gather -cm -bc -cl -sd",
+ debug("updating hyperestraier search index");
+ estcmd("gather -cm -bc -cl -sd",
map {
- Encode::encode_utf8($IkiWiki::config{destdir}."/".$IkiWiki::renderedfiles{IkiWiki::pagename($_)})
+ Encode::encode_utf8($config{destdir}."/".$renderedfiles{pagename($_)})
} @_
);
- IkiWiki::estcfg();
+ estcfg();
} #}}}
sub cgi ($) { #{{{
@@ -66,25 +66,22 @@ sub cgi ($) { #{{{
if (defined $cgi->param('phrase')) {
# only works for GET requests
- chdir("$IkiWiki::config{wikistatedir}/hyperestraier") || IkiWiki::error("chdir: $!");
- exec("./".IkiWiki::basename($IkiWiki::config{cgiurl})) || IkiWiki::error("estseek.cgi failed");
+ chdir("$config{wikistatedir}/hyperestraier") || error("chdir: $!");
+ exec("./".IkiWiki::basename($config{cgiurl})) || error("estseek.cgi failed");
}
} #}}}
-# Easier to keep these in the IkiWiki namespace.
-package IkiWiki;
-
my $configured=0;
sub estcfg () { #{{{
return if $configured;
$configured=1;
my $estdir="$config{wikistatedir}/hyperestraier";
- my $cgi=basename($config{cgiurl});
+ my $cgi=IkiWiki::basename($config{cgiurl});
$cgi=~s/\..*$//;
open(TEMPLATE, ">$estdir/$cgi.tmpl") ||
error("write $estdir/$cgi.tmpl: $!");
- print TEMPLATE misctemplate("search",
+ print TEMPLATE IkiWiki::misctemplate("search",
"<!--ESTFORM-->\n\n<!--ESTRESULT-->\n\n<!--ESTINFO-->\n\n");
close TEMPLATE;
open(TEMPLATE, ">$estdir/$cgi.conf") ||
@@ -94,12 +91,12 @@ sub estcfg () { #{{{
$template->param(
index => $estdir,
tmplfile => "$estdir/$cgi.tmpl",
- destdir => abs_path($config{destdir}),
+ destdir => IkiWiki::abs_path($config{destdir}),
url => $config{url},
);
print TEMPLATE $template->output;
close TEMPLATE;
- $cgi="$estdir/".basename($config{cgiurl});
+ $cgi="$estdir/".IkiWiki::basename($config{cgiurl});
unlink($cgi);
symlink("/usr/lib/estraier/estseek.cgi", $cgi) ||
error("symlink $cgi: $!");
diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm
index 0b006f110..da1f82b82 100644
--- a/IkiWiki/Plugin/sidebar.pm
+++ b/IkiWiki/Plugin/sidebar.pm
@@ -9,24 +9,23 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "pagetemplate", id => "sidebar",
- call => \&pagetemplate);
+ hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate);
} # }}}
sub sidebar_content ($) { #{{{
my $page=shift;
- my $sidebar_page=IkiWiki::bestlink($page, "sidebar") || return;
- my $sidebar_file=$IkiWiki::pagesources{$sidebar_page} || return;
- my $sidebar_type=IkiWiki::pagetype($sidebar_file);
+ my $sidebar_page=bestlink($page, "sidebar") || return;
+ my $sidebar_file=$pagesources{$sidebar_page} || return;
+ my $sidebar_type=pagetype($sidebar_file);
if (defined $sidebar_type) {
# FIXME: This isn't quite right; it won't take into account
# adding a new sidebar page. So adding such a page
# currently requires a wiki rebuild.
- IkiWiki::add_depends($page, $sidebar_page);
+ add_depends($page, $sidebar_page);
- my $content=IkiWiki::readfile(IkiWiki::srcfile($sidebar_file));
+ my $content=readfile(srcfile($sidebar_file));
return unless length $content;
return IkiWiki::htmlize($page, $sidebar_type,
IkiWiki::linkify($sidebar_page, $page,
diff --git a/IkiWiki/Plugin/skeleton.pm b/IkiWiki/Plugin/skeleton.pm
index 5947ebb4c..3e1e5700b 100644
--- a/IkiWiki/Plugin/skeleton.pm
+++ b/IkiWiki/Plugin/skeleton.pm
@@ -9,38 +9,26 @@ use strict;
use IkiWiki;
sub import { #{{{
- IkiWiki::hook(type => "getopt", id => "skeleton",
- call => \&getopt);
- IkiWiki::hook(type => "checkconfig", id => "skeleton",
- call => \&checkconfig);
- IkiWiki::hook(type => "preprocess", id => "skeleton",
- call => \&preprocess);
- IkiWiki::hook(type => "filter", id => "skeleton",
- call => \&filter);
- IkiWiki::hook(type => "htmlize", id => "skeleton",
- call => \&htmlize);
- IkiWiki::hook(type => "sanitize", id => "skeleton",
- call => \&sanitize);
- IkiWiki::hook(type => "format", id => "skeleton",
- call => \&format);
- IkiWiki::hook(type => "pagetemplate", id => "skeleton",
- call => \&pagetemplate);
- IkiWiki::hook(type => "delete", id => "skeleton",
- call => \&delete);
- IkiWiki::hook(type => "change", id => "skeleton",
- call => \&change);
- IkiWiki::hook(type => "cgi", id => "skeleton",
- call => \&cgi);
- IkiWiki::hook(type => "savestate", id => "savestate",
- call => \&savestate);
+ hook(type => "getopt", id => "skeleton", call => \&getopt);
+ hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
+ hook(type => "preprocess", id => "skeleton", call => \&preprocess);
+ hook(type => "filter", id => "skeleton", call => \&filter);
+ hook(type => "htmlize", id => "skeleton", call => \&htmlize);
+ hook(type => "sanitize", id => "skeleton", call => \&sanitize);
+ hook(type => "format", id => "skeleton", call => \&format);
+ hook(type => "pagetemplate", id => "skeleton", call => \&pagetemplate);
+ hook(type => "delete", id => "skeleton", call => \&delete);
+ hook(type => "change", id => "skeleton", call => \&change);
+ hook(type => "cgi", id => "skeleton", call => \&cgi);
+ hook(type => "savestate", id => "savestate", call => \&savestate);
} # }}}
sub getopt () { #{{{
- IkiWiki::debug("skeleton plugin getopt");
+ debug("skeleton plugin getopt");
} #}}}
sub checkconfig () { #{{{
- IkiWiki::debug("skeleton plugin checkconfig");
+ debug("skeleton plugin checkconfig");
} #}}}
sub preprocess (@) { #{{{
@@ -52,7 +40,7 @@ sub preprocess (@) { #{{{
sub filter (@) { #{{{
my %params=@_;
- IkiWiki::debug("skeleton plugin running as filter");
+ debug("skeleton plugin running as filter");
return $params{content};
} # }}}
@@ -60,7 +48,7 @@ sub filter (@) { #{{{
sub htmlize (@) { #{{{
my %params=@_;
- IkiWiki::debug("skeleton plugin running as htmlize");
+ debug("skeleton plugin running as htmlize");
return $params{content};
} # }}}
@@ -68,7 +56,7 @@ sub htmlize (@) { #{{{
sub sanitize (@) { #{{{
my %params=@_;
- IkiWiki::debug("skeleton plugin running as a sanitizer");
+ debug("skeleton plugin running as a sanitizer");
return $params{content};
} # }}}
@@ -76,7 +64,7 @@ sub sanitize (@) { #{{{
sub format (@) { #{{{
my %params=@_;
- IkiWiki::debug("skeleton plugin running as a formatter");
+ debug("skeleton plugin running as a formatter");
return $params{content};
} # }}}
@@ -86,29 +74,29 @@ sub pagetemplate (@) { #{{{
my $page=$params{page};
my $template=$params{template};
- IkiWiki::debug("skeleton plugin running as a pagetemplate hook");
+ debug("skeleton plugin running as a pagetemplate hook");
} # }}}
sub delete (@) { #{{{
my @files=@_;
- IkiWiki::debug("skeleton plugin told that files were deleted: @files");
+ debug("skeleton plugin told that files were deleted: @files");
} #}}}
sub change (@) { #{{{
my @files=@_;
- IkiWiki::debug("skeleton plugin told that changed files were rendered: @files");
+ debug("skeleton plugin told that changed files were rendered: @files");
} #}}}
sub cgi ($) { #{{{
my $cgi=shift;
- IkiWiki::debug("skeleton plugin running in cgi");
+ debug("skeleton plugin running in cgi");
} #}}}
sub savestate () { #{{{
- IkiWiki::debug("skeleton plugin running in savestate");
+ debug("skeleton plugin running in savestate");
} #}}}
1
diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm
index f49c9b62f..0c6f5d427 100644
--- a/IkiWiki/Plugin/smiley.pm
+++ b/IkiWiki/Plugin/smiley.pm
@@ -9,33 +9,33 @@ my %smileys;
my $smiley_regexp;
sub import { #{{{
- IkiWiki::hook(type => "checkconfig", id => "smiley", call => \&setup);
+ hook(type => "checkconfig", id => "smiley", call => \&setup);
} # }}}
sub setup () { #{{{
- my $list=IkiWiki::readfile(IkiWiki::srcfile("smileys.mdwn"));
+ my $list=readfile(srcfile("smileys.mdwn"));
while ($list =~ m/^\s*\*\s+\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) {
$smileys{$1}=$2;
}
if (! %smileys) {
- IkiWiki::debug("failed to parse any smileys, disabling plugin");
+ debug("failed to parse any smileys, disabling plugin");
return;
}
- IkiWiki::hook(type => "filter", id => "smiley", call => \&filter);
+ hook(type => "filter", id => "smiley", call => \&filter);
# sort and reverse so that substrings come after longer strings
# that contain them, in most cases.
$smiley_regexp='('.join('|', map { quotemeta }
reverse sort keys %smileys).')';
- #IkiWiki::debug($smiley_regexp);
+ #debug($smiley_regexp);
} #}}}
sub filter (@) { #{{{
my %params=@_;
$params{content} =~ s{(?<=\s)(\\?)$smiley_regexp(?=\s)}{
- $1 ? $2 : IkiWiki::htmllink($params{page}, $params{page}, $smileys{$2}, 0, 0, $2)
+ $1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, 0, 0, $2)
}egs;
return $params{content};
diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm
index 3de09a767..7a1be6bec 100644
--- a/IkiWiki/Plugin/tag.pm
+++ b/IkiWiki/Plugin/tag.pm
@@ -9,26 +9,23 @@ use IkiWiki;
my %tags;
sub import { #{{{
- IkiWiki::hook(type => "getopt", id => "tag",
- call => \&getopt);
- IkiWiki::hook(type => "preprocess", id => "tag",
- call => \&preprocess);
- IkiWiki::hook(type => "pagetemplate", id => "tag",
- call => \&pagetemplate);
+ hook(type => "getopt", id => "tag", call => \&getopt);
+ hook(type => "preprocess", id => "tag", call => \&preprocess);
+ hook(type => "pagetemplate", id => "tag", call => \&pagetemplate);
} # }}}
sub getopt () { #{{{
eval q{use Getopt::Long};
Getopt::Long::Configure('pass_through');
- GetOptions("tagbase=s" => \$IkiWiki::config{tagbase});
+ GetOptions("tagbase=s" => \$config{tagbase});
} #}}}
sub tagpage ($) { #{{{
my $tag=shift;
- if (exists $IkiWiki::config{tagbase} &&
- defined $IkiWiki::config{tagbase}) {
- $tag=$IkiWiki::config{tagbase}."/".$tag;
+ if (exists $config{tagbase} &&
+ defined $config{tagbase}) {
+ $tag=$config{tagbase}."/".$tag;
}
return $tag;
@@ -47,7 +44,7 @@ sub preprocess (@) { #{{{
foreach my $tag (keys %params) {
push @{$tags{$page}}, $tag;
# hidden WikiLink
- push @{$IkiWiki::links{$page}}, tagpage($tag);
+ push @{$links{$page}}, tagpage($tag);
}
return "";
@@ -61,7 +58,7 @@ sub pagetemplate (@) { #{{{
$template->param(tags => [
map {
- link => IkiWiki::htmllink($page, $destpage, tagpage($_))
+ link => htmllink($page, $destpage, tagpage($_))
}, @{$tags{$page}}
]) if exists $tags{$page} && @{$tags{$page}} && $template->query(name => "tags");
diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
index 7e23306cb..1a4faf05f 100644
--- a/IkiWiki/Plugin/template.pm
+++ b/IkiWiki/Plugin/template.pm
@@ -9,8 +9,7 @@ use HTML::Template;
use Encode;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "template",
- call => \&preprocess);
+ hook(type => "preprocess", id => "template", call => \&preprocess);
} # }}}
sub preprocess (@) { #{{{
@@ -21,11 +20,11 @@ sub preprocess (@) { #{{{
}
my $template_page="templates/$params{id}";
- IkiWiki::add_depends($params{page}, $template_page);
+ add_depends($params{page}, $template_page);
- my $template_file=$IkiWiki::pagesources{$template_page};
+ my $template_file=$pagesources{$template_page};
return "[[template ".
- IkiWiki::htmllink($params{page}, $params{destpage}, $template_page).
+ htmllink($params{page}, $params{destpage}, $template_page).
" not found]]"
unless defined $template_file;
@@ -34,7 +33,7 @@ sub preprocess (@) { #{{{
my $text_ref = shift;
$$text_ref=&Encode::decode_utf8($$text_ref);
},
- filename => IkiWiki::srcfile($template_file),
+ filename => srcfile($template_file),
die_on_bad_params => 0,
no_includes => 1,
blind_cache => 1,
diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm
index 063e66f3b..279eef008 100644
--- a/IkiWiki/Plugin/toc.pm
+++ b/IkiWiki/Plugin/toc.pm
@@ -8,10 +8,8 @@ use IkiWiki;
use HTML::Parser;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "toc",
- call => \&preprocess);
- IkiWiki::hook(type => "format", id => "toc",
- call => \&format);
+ hook(type => "preprocess", id => "toc", call => \&preprocess);
+ hook(type => "format", id => "toc", call => \&format);
} # }}}
my %tocpages;
diff --git a/IkiWiki/Plugin/wikitext.pm b/IkiWiki/Plugin/wikitext.pm
index 5c46c565c..95182f870 100644
--- a/IkiWiki/Plugin/wikitext.pm
+++ b/IkiWiki/Plugin/wikitext.pm
@@ -8,7 +8,7 @@ use IkiWiki;
use Text::WikiFormat;
sub import { #{{{
- IkiWiki::hook(type => "htmlize", id => "wiki", call => \&htmlize);
+ hook(type => "htmlize", id => "wiki", call => \&htmlize);
} # }}}
sub htmlize (@) { #{{{