From: Thomas Schwinge Date: Sat, 8 Dec 2007 19:37:41 +0000 (-0500) Subject: Here is a patch to add a forwarding functionality to the meta plugin X-Git-Tag: 2.16~83 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=655d7925c60ecd7dd5dc3b35887f7a2573029796;p=ikiwiki.git Here is a patch to add a forwarding functionality to the meta plugin --- 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}.="\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="$dest_url"; + $dest_url=$value; + } +# TODO. $meta{$page}.=scrub(""); + $meta{$page}.=""; + return "You are being forwarded to $text."; + } else { $meta{$page}.=scrub("\n");