From 7d91652a4c175e84188b2d8e2fe4e677dac251e8 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Tue, 7 Aug 2007 19:18:44 +0200
Subject: [PATCH] TOC fixed

This fixes some small bugs which were introduced with recent TOC changes

darcs-hash:20070807171844-7ad00-fc09dd6d09b72927e64dfa41dd8b86fc20d86ed0.gz
---
 inc/html.php         | 8 +++++++-
 inc/parser/xhtml.php | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index 3ae192c73..35cb09d3a 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1273,7 +1273,13 @@ function html_TOC($toc){
  * Callback for html_buildlist
  */
 function html_list_toc($item){
-    return '<span class="li"><a href="'.$item['link'].'" class="toc">'.
+    if($item['hid']){
+        $link = '#'.$item['hid'];
+    }else{
+        $link = $item['link'];
+    }
+
+    return '<span class="li"><a href="'.$link.'" class="toc">'.
            hsc($item['title']).'</a></span>';
 }
 
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index aba44e8da..7279844f9 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -97,7 +97,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
         //handle TOC
         if($level >= $conf['toptoclevel'] && $level <= $conf['maxtoclevel']){
-            $this->toc[] = html_mktocitem("#$id", $text, $level-$conf['toptoclevel']+1);
+            $this->toc[] = html_mktocitem($id, $text, $level-$conf['toptoclevel']+1);
         }
     }
 
-- 
GitLab