diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2007-12-22 16:21:00 +0100 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2007-12-22 13:10:55 -0500 |
commit | 1ac0fd03bb9e840b03aabe516557c24f43a9c450 (patch) | |
tree | 9577f964fbb21951f5fbf4e0530c328defc0e3b6 | |
parent | 8937e5e2857ef1784e3a715878c9cd62d4022406 (diff) |
IkiWiki/Plugin/meta.pm <redir>: Support for specifying anchors.
-rw-r--r-- | IkiWiki/Plugin/meta.pm | 7 | ||||
-rw-r--r-- | doc/plugins/meta.mdwn | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 8555e1109..987262a48 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -108,13 +108,16 @@ sub preprocess (@) { #{{{ 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); + $value.='#'.$redir_anchor if defined $redir_anchor; $safe=1; # redir cycle detection diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn index 0696dc08e..479d62c43 100644 --- a/doc/plugins/meta.mdwn +++ b/doc/plugins/meta.mdwn @@ -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. + 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 <meta> header. However, this won't be allowed if the [[htmlscrubber]] is enabled, since it can be used to |