summaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-06-02 04:49:12 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-06-02 04:49:12 +0000
commitd534483b9befc360b3d973091b1b7f5692f15a6e (patch)
treef5071940e2966f935e78bc90755c200145179166 /IkiWiki/Render.pm
parentf1b3b728c1bc1e1bd821d362b4936990c1ab6bc9 (diff)
* Reorganised the doc wiki's todo/* pages, using a link/tag to flag
* Allow pagetemplate plugins to override *anything* in the template. * Add a meta plugin, which allows specifying various metadata about pages, like license and author. It also allows for inserting html link and meta tags into html, overriding the title, and adding hidden WikiLinks, which can be useful when using link-based globbing for page categorisation. * Remove preprocessor directives from inlined pages. * Allow simple preprocessor directive values to be specified w/o quotes.
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm28
1 files changed, 17 insertions, 11 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 886a30f6b..0dfa03cd4 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -95,9 +95,10 @@ sub parentlinks ($) { #{{{
return @ret;
} #}}}
-sub preprocess ($$) { #{{{
+sub preprocess ($$;$) { #{{{
my $page=shift;
my $content=shift;
+ my $onlystrip=shift || 0; # strip directives without processing
my $handle=sub {
my $escape=shift;
@@ -106,12 +107,17 @@ sub preprocess ($$) { #{{{
if (length $escape) {
return "[[$command $params]]";
}
+ elsif ($onlystrip) {
+ return "";
+ }
elsif (exists $hooks{preprocess}{$command}) {
- my %params;
- while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
- $params{$1}=$2;
+ # Note: preserve order of params, some plugins may
+ # consider it significant.
+ my @params;
+ while ($params =~ /(\w+)=\"?([^"]+)"?(\s+|$)/g) {
+ push @params, $1, $2;
}
- return $hooks{preprocess}{$command}{call}->(page => $page, %params);
+ return $hooks{preprocess}{$command}{call}->(@params, page => $page);
}
else {
return "[[$command not processed]]";
@@ -190,12 +196,6 @@ sub genpage ($$$) { #{{{
$template->param(have_actions => 1);
}
- if (exists $hooks{pagetemplate}) {
- foreach my $id (keys %{$hooks{pagetemplate}}) {
- $hooks{pagetemplate}{$id}{call}->($page, $template);
- }
- }
-
$template->param(
title => $title,
wikiname => $config{wikiname},
@@ -205,6 +205,12 @@ sub genpage ($$$) { #{{{
mtime => displaytime($mtime),
styleurl => styleurl($page),
);
+
+ if (exists $hooks{pagetemplate}) {
+ foreach my $id (keys %{$hooks{pagetemplate}}) {
+ $hooks{pagetemplate}{$id}{call}->($page, $template);
+ }
+ }
return $template->output;
} #}}}