Wikulator.php
changeset 3 98ccd8815a02
parent 2 88265c8715d0
child 4 a803741a5fc0
--- a/Wikulator.php	Fri May 29 14:32:47 2009 -0400
+++ b/Wikulator.php	Tue Jul 28 16:07:51 2009 -0400
@@ -66,11 +66,12 @@
         unset($treenum[count($treenum)-1]);
       }
     }
+    $treenum = array_values($treenum);
     if ( isset($treenum[count($treenum)-1]) )
       $treenum[count($treenum)-1]++;
     if ( $i > 0 )
       $toc .= '</dd>';
-    $toc .= '<dd><a href="#toc' . ($i + 1) . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>';
+    $toc .= '<dd><a href="#toc' . $i . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>';
     $prev = $head;
   }
   while ( $levels > 0 )