aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-06-07 11:37:53 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-06-07 11:37:53 +0000
commitd01efdf07c3449afa396348f4972eb077121670d (patch)
treec68482e6a6910f948e288f523ad3a27a6bb9375b
parent9dc9c113cc1b345bb9631f92803b4d0b9426f8e4 (diff)
downloadikiwiki-d01efdf07c3449afa396348f4972eb077121670d.tar
ikiwiki-d01efdf07c3449afa396348f4972eb077121670d.tar.gz
web commit by HenrikBrixAndersen: Add patch for toc.pm
-rw-r--r--doc/bugs/Problem_with_toc.pm_plug-in.mdwn35
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/bugs/Problem_with_toc.pm_plug-in.mdwn b/doc/bugs/Problem_with_toc.pm_plug-in.mdwn
new file mode 100644
index 000000000..6b8e5923b
--- /dev/null
+++ b/doc/bugs/Problem_with_toc.pm_plug-in.mdwn
@@ -0,0 +1,35 @@
+Problem with toc.pm plug-in
+===========================
+
+The toc.pm plug-in currently renders empty 'a' tag elements. This seems to confuse at least Firefox, possibly others. The result is that the following text is rendered as an anchor (visible if you style 'a' elements in a different color).
+
+Here is a patch for toc.pm for producing non-empty 'a' elements.
+
+ --- IkiWiki/Plugin/toc.pm.orig Thu Jun 7 11:53:53 2007
+ +++ IkiWiki/Plugin/toc.pm Thu Jun 7 13:00:00 2007
+ @@ -47,7 +47,7 @@ sub format (@) { #{{{
+ if ($tagname =~ /^h(\d+)$/i) {
+ my $level=$1;
+ my $anchor="index".++$anchors{$level}."h$level";
+ - $page.="$text<a name=\"$anchor\" />";
+ + $page.="$text<a name=\"$anchor\">";
+
+ # Take the first header level seen as the topmost level,
+ # even if there are higher levels seen later on.
+ @@ -90,6 +90,16 @@ sub format (@) { #{{{
+ "</a>\n";
+ $p->handler(text => undef);
+ }, "dtext");
+ + }
+ + else {
+ + $page.=$text;
+ + }
+ + }, "tagname, text");
+ + $p->handler(end => sub {
+ + my $tagname=shift;
+ + my $text=shift;
+ + if ($tagname =~ /^h(\d+)$/i) {
+ + $page.="</a>$text";
+ }
+ else {
+ $page.=$text; \ No newline at end of file