aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/external.pm18
-rw-r--r--IkiWiki/Plugin/meta.pm7
2 files changed, 25 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm
index f76b42c99..8d1baa587 100644
--- a/IkiWiki/Plugin/external.pm
+++ b/IkiWiki/Plugin/external.pm
@@ -132,6 +132,24 @@ sub setvar ($$$;@) { #{{{
return $ret;
} #}}}
+sub getstate ($$$$) { #{{{
+ my $plugin=shift;
+ my $page=shift;
+ my $id=shift;
+ my $key=shift;
+
+ return $IkiWiki::pagestate{$page}{$id}{$key};
+} #}}}
+
+sub setstate ($$$$;@) { #{{{
+ my $plugin=shift;
+ my $page=shift;
+ my $id=shift;
+ my $key=shift;
+
+ return $IkiWiki::pagestate{$page}{$id}{$key}=@_;
+} #}}}
+
sub inject ($@) { #{{{
# Bind a given perl function name to a particular RPC request.
my $plugin=shift;
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;
}