# HG changeset patch # User Dan # Date 1243621967 14400 # Node ID 88265c8715d07fb8d246b8378306ff80fc781aa9 # Parent 616d046e3bd9329b13818e9abfc42b0b381ebadc Improvements to parsing for TOC diff -r 616d046e3bd9 -r 88265c8715d0 Wikulator.php --- a/Wikulator.php Wed Dec 24 11:04:18 2008 -0500 +++ b/Wikulator.php Fri May 29 14:32:47 2009 -0400 @@ -16,7 +16,7 @@ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. */ -$plugins->attachHook('render_wikiformat_pre', 'mediafier_draw_toc($text);'); +$plugins->attachHook('render_wikiformat_posttemplates', 'mediafier_draw_toc($text);'); $plugins->attachHook('render_wikiformat_post', 'mediafy($result);'); $plugins->attachHook('compile_template', 'mediafier_add_headers();'); $plugins->attachHook('html_attribute_whitelist', '$whitelist["ref"] = array(); $whitelist["references"] = array("/");'); @@ -66,7 +66,8 @@ unset($treenum[count($treenum)-1]); } } - $treenum[count($treenum)-1]++; + if ( isset($treenum[count($treenum)-1]) ) + $treenum[count($treenum)-1]++; if ( $i > 0 ) $toc .= ''; $toc .= '