Source for file Toc.php
Documentation is available at Toc.php
// $Id: Toc.php,v 1.4 2004/09/25 19:05:13 pmjones Exp $
* This class implements a Text_Wiki_Parse to find all heading tokens and
* build a table of contents. The [[toc]] tag gets replaced with a list
* of all the level-2 through level-6 headings.
* @author Paul M. Jones <pmjones@ciaweb.net>
* The regular expression used to parse the source text and find
* matches conforming to this rule. Used by the parse() method.
var $regex = "/\n\[\[toc( .*)?\]\]\n/m";
* Generates a replacement for the matched text.
* 'type' => ['list_start'|'list_end'|'item_start'|'item_end'|'target']
* 'level' => The heading level (1-6).
* 'count' => Which entry number this is in the list.
* @param array &$matches The array of matches from parse().
* @return string A token indicating the TOC collection point.
if (isset ($matches[1 ])) {
$output = $this->wiki->addToken (
foreach ($this->wiki->getTokens ('Heading') as $key => $val) {
if ($val[1 ]['type'] != 'start') {
'level' => $val[1 ]['level'],
$output .= $this->wiki->addToken ($this->rule, $options);
$output .= $val[1 ]['text'];
$output .= $this->wiki->addToken (
'level' => $val[1 ]['level']
$output .= $this->wiki->addToken (
Documentation generated on Mon, 11 Mar 2019 14:22:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|