]> sipb.mit.edu Git - ikiwiki.git/commitdiff
IkiWiki/Plugin/meta.pm <redir>: Support for specifying anchors.
authorThomas Schwinge <tschwinge@gnu.org>
Sat, 22 Dec 2007 15:21:00 +0000 (16:21 +0100)
committerJoey Hess <joey@kitenet.net>
Sat, 22 Dec 2007 18:10:55 +0000 (13:10 -0500)
IkiWiki/Plugin/meta.pm
doc/plugins/meta.mdwn

index 8555e1109b76afaf585daa6ec95ee261edbd0036..987262a48c6961bed98b480e5466614b0588d5dc 100644 (file)
@@ -108,13 +108,16 @@ sub preprocess (@) { #{{{
                return "" if $page ne $destpage;
                my $safe=0;
                if ($value !~ /^\w+:\/\//) {
                return "" if $page ne $destpage;
                my $safe=0;
                if ($value !~ /^\w+:\/\//) {
-                       add_depends($page, $value);
-                       my $link=bestlink($page, $value);
+                       my ($redir_page, $redir_anchor) = split /\#/, $value;
+
+                       add_depends($page, $redir_page);
+                       my $link=bestlink($page, $redir_page);
                        if (! length $link) {
                                return "[[meta ".gettext("redir page not found")."]]";
                        }
 
                        $value=urlto($link, $page);
                        if (! length $link) {
                                return "[[meta ".gettext("redir page not found")."]]";
                        }
 
                        $value=urlto($link, $page);
+                       $value.='#'.$redir_anchor if defined $redir_anchor;
                        $safe=1;
 
                        # redir cycle detection
                        $safe=1;
 
                        # redir cycle detection
index 0696dc08eb9ac40c4ea81b55a07910584ea60c03..479d62c434034262e000a01f843079b49a2d89e8 100644 (file)
@@ -85,6 +85,9 @@ Supported fields:
   However, this latter syntax won't be allowed if the [[htmlscrubber]] is
   enabled, since it can be used to insert unsafe content.
 
   However, this latter syntax won't be allowed if the [[htmlscrubber]] is
   enabled, since it can be used to insert unsafe content.
 
+  For both cases, an anchor to jump to inside the destination page may also be
+  specified using the common `PAGE#ANCHOR` syntax.
+
 If the field is not one of the above predefined fields, the metadata will be
 written to the generated html page as a &lt;meta&gt; header. However, this
 won't be allowed if the [[htmlscrubber]] is enabled, since it can be used to
 If the field is not one of the above predefined fields, the metadata will be
 written to the generated html page as a &lt;meta&gt; header. However, this
 won't be allowed if the [[htmlscrubber]] is enabled, since it can be used to