Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Class: Text_Wiki_Rule_toc

Source Location: /Text_Wiki-0.12.1/Text/Wiki/Rule/toc.php

Class Overview

Text_Wiki_Rule
   |
   --Text_Wiki_Rule_toc

This class implements a Text_Wiki_Rule 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(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: Text_Wiki_Rule

Text_Wiki_Rule::Text_Wiki_Rule()
Constructor for the rule.
Text_Wiki_Rule::addToken()
Add a token to the Text_Wiki tokens array, and return a delimited token number.
Text_Wiki_Rule::getMacroArgs()
Simple method to extract 'option="value"' portions of wiki markup, typically used only in macros.
Text_Wiki_Rule::parse()
Simple parsing method to apply the rule's regular expression to the source text, pass every match to the process() method, and replace the matched text with the results of the processing.
Text_Wiki_Rule::process()
Simple processing mathod to take matched text and generate replacement text. This is one of the methods you will definitely want to override in your rule class extensions.
Text_Wiki_Rule::renderXhtml()
Simple rendering method to take a set of token options and generate replacement text for it. This is another method you will definitely want to override in your rule subclass extensions.
Text_Wiki_Rule::setToken()
Set or re-set a token with specific information, overwriting any previous rule name and rule options.

Class Details

[line 35]
This class implements a Text_Wiki_Rule 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.


[ Top ]


Class Variables

$entry = array()

[line 66]

The collection of headings (text and levels).
  • See: _getEntries()
  • Access: public

Type:   array


[ Top ]

$regex =  "/\[\[toc\]\]/m"

[line 51]

The regular expression used to parse the source text and find matches conforming to this rule. Used by the parse() method.

Type:   string
Overrides:   Array


[ Top ]



Method Detail

parse   [line 79]

void parse( )

Custom parsing (have to process heading entries first).
  • See: Text_Wiki::parse()
  • Access: public

Overrides Text_Wiki_Rule::parse() (Simple parsing method to apply the rule's regular expression to the source text, pass every match to the process() method, and replace the matched text with the results of the processing.)
[ Top ]

process   [line 104]

string process( array &$matches)

Generates a replacement for the matched text. Token options are:

'type' => ['list_start'|'list_end'|'item_end'|'item_end'|'target']

'level' => The heading level (1-6).

'count' => Which heading this is in the list.

  • Return: A token indicating the TOC collection point.
  • Access: public

Overrides Text_Wiki_Rule::process() (Simple processing mathod to take matched text and generate replacement text. This is one of the methods you will definitely want to override in your rule class extensions.)

Parameters:

array   &$matches   —  The array of matches from parse().

[ Top ]

renderXhtml   [line 308]

string renderXhtml( array $options)

Renders a token into text matching the requested format.
  • Return: The text rendered from the token options.
  • Access: public

Overrides Text_Wiki_Rule::renderXhtml() (Simple rendering method to take a set of token options and generate replacement text for it. This is another method you will definitely want to override in your rule subclass extensions.)

Parameters:

array   $options   —  The "options" portion of the token (second element).

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:14:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.