From: joey Date: Mon, 19 Feb 2007 17:58:03 +0000 (+0000) Subject: web commit by http://id.inelegant.org/: Make htmllink understand links to specific... X-Git-Tag: 1.44~178 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f6bb3a1cbc82be7ae43277b45dc5c92466a60baa;p=ikiwiki.git web commit by id.inelegant.org/: Make htmllink understand links to specific points in pages. --- diff --git a/doc/patchqueue/htmllink-anchors.mdwn b/doc/patchqueue/htmllink-anchors.mdwn new file mode 100644 index 000000000..2bb203f51 --- /dev/null +++ b/doc/patchqueue/htmllink-anchors.mdwn @@ -0,0 +1,29 @@ +Here's an attempt to make `htmllink` "do the right thing" with in-page anchors: + +
+Index: IkiWiki.pm
+===================================================================
+--- IkiWiki.pm  (revision 2657)
++++ IkiWiki.pm  (working copy)
+@@ -426,6 +426,8 @@
+        my $noimageinline=shift; # don't turn links into inline html images
+        my $forcesubpage=shift; # force a link to a subpage
+        my $linktext=shift; # set to force the link text to something
++    
++    my $anchor = ($link =~ s/#(.+)$// ? $1 : undef);
+ 
+        my $bestlink;
+        if (! $forcesubpage) {
+@@ -455,7 +457,10 @@
+        if (! $noimageinline && isinlinableimage($bestlink)) {
+                return "\"$linktext\"";
+        }
+-       return "$linktext";
++
++    $bestlink .= "#$anchor" if $anchor;
++    
++    return "$linktext";
+ } #}}}
+ 
+ sub htmlize ($$$) { #{{{
+
\ No newline at end of file