summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-19 17:58:03 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-19 17:58:03 +0000
commitf6bb3a1cbc82be7ae43277b45dc5c92466a60baa (patch)
tree9e5d392c6209c4b0d4a7cc7001bc557d794d2a02 /doc
parent2d204b0b0b2c8622f216289ff5796930b17baf08 (diff)
web commit by http://id.inelegant.org/: Make htmllink understand links to specific points in pages.
Diffstat (limited to 'doc')
-rw-r--r--doc/patchqueue/htmllink-anchors.mdwn29
1 files changed, 29 insertions, 0 deletions
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:
+
+<pre>
+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 "<img src=\"$bestlink\" alt=\"$linktext\" />";
+ }
+- return "<a href=\"$bestlink\">$linktext</a>";
++
++ $bestlink .= "#$anchor" if $anchor;
++
++ return "<a href=\"$bestlink\">$linktext</a>";
+ } #}}}
+
+ sub htmlize ($$$) { #{{{
+</pre> \ No newline at end of file