aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/meta.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2007-12-08 17:40:50 -0500
committerJoey Hess <joey@kitenet.net>2007-12-08 17:40:50 -0500
commit055179cb4cc9b8bc9b204e1a9f83b1f59e13824e (patch)
tree1a48f2f93684238180b355df67f2aa48dcfb1be4 /IkiWiki/Plugin/meta.pm
parent2fbca21390d2752a89a2e1167fe33d4d201359cf (diff)
downloadikiwiki-055179cb4cc9b8bc9b204e1a9f83b1f59e13824e.tar
ikiwiki-055179cb4cc9b8bc9b204e1a9f83b1f59e13824e.tar.gz
* Finally implemented a simple per-page data storage mechanism for plugins,
via the %pagestate hash. * Use pagestate in meta to detect potential redir loops.
Diffstat (limited to 'IkiWiki/Plugin/meta.pm')
-rw-r--r--IkiWiki/Plugin/meta.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index ac8890795..968e6ccee 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -24,6 +24,7 @@ sub filter (@) { #{{{
my %params=@_;
$meta{$params{page}}='';
+ delete $pagestate{$params{page}}{meta}{redir};
return $params{content};
} # }}}
@@ -72,10 +73,16 @@ sub preprocess (@) { #{{{
elsif ($key eq 'redir') {
my $safe=0;
if ($value !~ /^\w+:\/\//) {
+ add_depends($page, $value);
my $link=bestlink($page, $value);
if (! length $link) {
return "[[meta ".gettext("redir page not found")."]]";
}
+ $pagestate{$page}{meta}{redir}=$link;
+ if ($pagestate{$link}{meta}{redir}) {
+ # TODO: real cycle detection
+ return "[[meta ".gettext("redir not allowed to point to a page that contains a redir")."]]";
+ }
$value=urlto($link, $destpage);
$safe=1;
}