summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2007-12-08 14:37:41 -0500
committerJoey Hess <joey@kitenet.net>2007-12-08 14:37:41 -0500
commit655d7925c60ecd7dd5dc3b35887f7a2573029796 (patch)
tree61dbddb28b6337da8db1839b0ee1e14eeac162b7
parent7e661e1ed3a64728fe31bb9be9aed4d34e2aec21 (diff)
Here is a patch to add a forwarding functionality to the meta plugin
-rw-r--r--IkiWiki/Plugin/meta.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 938a28e59..cfa4b84b1 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -47,6 +47,7 @@ sub preprocess (@) { #{{{
delete $params{$key};
my $page=$params{page};
delete $params{page};
+ my $destpage=$params{destpage};
delete $params{destpage};
delete $params{preview};
@@ -110,6 +111,25 @@ sub preprocess (@) { #{{{
$meta{$page}.="<link rel=\"copyright\" href=\"#page_copyright\" />\n";
$copyright{$page}=$value;
}
+ elsif ($key eq 'forward') {
+ my $delay=0;
+ my $dest_url;
+ my $text;
+ if (exists $params{delay}) {
+ $delay=$params{delay};
+ }
+ # Is this a wikilink?
+ if ($value =~ /^\[\[(.*)\]\]$/) {
+ $text=htmllink($page, $destpage, $1);
+ $dest_url=urlto(bestlink($page, $1), $destpage);
+ } else {
+ $text="<a href=\"$dest_url\">$dest_url</a>";
+ $dest_url=$value;
+ }
+# TODO. $meta{$page}.=scrub("<meta http-equiv=\"refresh\" content=\"$delay; URL=$dest_url\">");
+ $meta{$page}.="<meta http-equiv=\"refresh\" content=\"$delay; URL=$dest_url\">";
+ return "You are being forwarded to $text.";
+ }
else {
$meta{$page}.=scrub("<meta name=\"".encode_entities($key).
"\" content=\"".encode_entities($value)."\" />\n");