highlighter = new PHP_Highlight; $this->wiki = new Text_Wiki; } public function parseIndex2($index) { $ret = array(); $path = array(); $counters = array(); foreach ($index as $k => $v) { if (empty($v)) { continue; } $v = rtrim($v); $i = count($path) - 1; $i = ($i > 0) ? $i : 0; $indent = substr_count($v, ' '); if ( ! isset($counters[$indent])) { $counters[$indent] = 0; } if ($indent > $i) { $counters[$indent]++; $path[] = trim($v); } else { $steps = abs($i - $indent); $key = ($i - $steps); while ($steps--) { array_pop($path); array_pop($counters); } $counters[$key]++; $path[$key] = trim($v); } $chapterName = implode(' - ', $path); $ret[] = array('index' => implode('.', $counters), 'name' => $chapterName); } return $ret; } public function renderBlock($name) { if (file_exists("docs/$name.php")) { $c = file_get_contents("docs/$name.php"); if (substr($c, 0, 5) == "') !== false || strpos($c, '
') !== false || strpos($c, '