Wikulator.php
changeset 3 98ccd8815a02
parent 2 88265c8715d0
child 4 a803741a5fc0
equal deleted inserted replaced
2:88265c8715d0 3:98ccd8815a02
    64         $toc .= '</dl>';
    64         $toc .= '</dl>';
    65         $levels--;
    65         $levels--;
    66         unset($treenum[count($treenum)-1]);
    66         unset($treenum[count($treenum)-1]);
    67       }
    67       }
    68     }
    68     }
       
    69     $treenum = array_values($treenum);
    69     if ( isset($treenum[count($treenum)-1]) )
    70     if ( isset($treenum[count($treenum)-1]) )
    70       $treenum[count($treenum)-1]++;
    71       $treenum[count($treenum)-1]++;
    71     if ( $i > 0 )
    72     if ( $i > 0 )
    72       $toc .= '</dd>';
    73       $toc .= '</dd>';
    73     $toc .= '<dd><a href="#toc' . ($i + 1) . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>';
    74     $toc .= '<dd><a href="#toc' . $i . '">' . implode('.', $treenum) . ' ' . htmlspecialchars($matches[2][$i]) . '</a>';
    74     $prev = $head;
    75     $prev = $head;
    75   }
    76   }
    76   while ( $levels > 0 )
    77   while ( $levels > 0 )
    77   {
    78   {
    78     $toc .= '</dd></dl>';
    79     $toc .= '</dd></dl>';