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

Class: Text_Wiki_Parse

Source Location: /Text_Wiki-0.23.0/Text/Wiki/Parse.php

Class Overview


Baseline rule class for extension into a "real" parser component.


Author(s):

Variables

Methods


Child classes:

Text_Wiki_Parse_List
This class implements a Text_Wiki_Parse to find source text marked as
Text_Wiki_Parse_Colortext
This class implements a Text_Wiki_Parse to find source text marked for coloring.
Text_Wiki_Parse_Tt
Find source text marked for teletype (monospace).
Text_Wiki_Parse_Include
This class implements a Text_Wiki_Parse to include the results of a
Text_Wiki_Parse_Bold
This class implements a Text_Wiki_Rule to find source text marked for
Text_Wiki_Parse_Html
This class implements a Text_Wiki_Parse to find source text marked as HTML to be redndred as-is. The block start is marked by <html> on its own line, and the block end is marked by </html> on its own line.
Text_Wiki_Parse_Deflist
This class implements a Text_Wiki_Parse to find source text marked as a definition list. In short, if a line starts with ':' then it is a definition list item; another ':' on the same lines indicates the end of the definition term and the beginning of the definition narrative.
Text_Wiki_Parse_Prefilter
"Pre-filter" the source text.
Text_Wiki_Parse_Strong
This class implements a Text_Wiki_Parse to find source text marked for
Text_Wiki_Parse_Blockquote
Parse for block-quoted text.
Text_Wiki_Parse_Paragraph
This class implements a Text_Wiki rule to find sections of the source text that are paragraphs. A para is any line not starting with a token delimiter, followed by two newlines.
Text_Wiki_Parse_Horiz
This class implements a Text_Wiki_Parse to find source text marked to be a horizontal rule, as defined by four dashed on their own line.
Text_Wiki_Parse_Toc
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.
Text_Wiki_Parse_Newline
This class implements a Text_Wiki_Parse to mark implied line breaks in the source text, usually a single carriage return in the middle of a paragraph or block-quoted text.
Text_Wiki_Parse_Table
This class implements a Text_Wiki_Parse to find source text marked as a
Text_Wiki_Parse_Url
Parse for URLS in the source text.
Text_Wiki_Parse_Superscript
This class implements a Text_Wiki_Parse to find source text marked for
Text_Wiki_Parse_Revise
This class implements a Text_Wiki_Parse to find source text marked for revision.
Text_Wiki_Parse_Raw
This class implements a Text_Wiki rule to find sections of the source text that are not to be processed by Text_Wiki. These blocks of "raw" text will be rendered as they were found.
Text_Wiki_Parse_Code
This class implements a Text_Wiki_Parse to find sections marked as code
Text_Wiki_Parse_emphasis
This class implements a Text_Wiki_Parse to find source text marked for emphasis (italics) as defined by text surrounded by two single-quotes.
Text_Wiki_Parse_Center
This class implements a Text_Wiki_Parse to find lines marked for centering.
Text_Wiki_Parse_Delimiter
This class implements a Text_Wiki_Parse to find instances of the delimiter character already embedded in the source text; it extracts them and replaces them with a delimited token, then renders them as the delimiter itself when the target format is XHTML.
Text_Wiki_Parse_Image
This class implements a Text_Wiki_Parse to embed the contents of a URL inside the page. Typically used to get script output.
Text_Wiki_Parse_Anchor
This class implements a Text_Wiki_Parse to add an anchor target name in the wiki page.
Text_Wiki_Parse_Italic
This class implements a Text_Wiki_Parse to find source text marked for emphasis (italics) as defined by text surrounded by two single-quotes.
Text_Wiki_Parse_Interwiki
This class implements a Text_Wiki_Parse to find source text marked as an Interwiki link. See the regex for a detailed explanation of the text matching procedure; e.g., "InterWikiName:PageName".
Text_Wiki_Parse_Heading
This class implements a Text_Wiki_Parse to find source text marked to
Text_Wiki_Parse_Phplookup
Find source text marked for lookup in the PHP online manual.
Text_Wiki_Parse_Wikilink
Parse for links to wiki pages.
Text_Wiki_Parse_Tighten
The rule removes all remaining newlines.
Text_Wiki_Parse_Function
Baseline rule class for extension into a "real" parser component.
Text_Wiki_Parse_Freelink
This class implements a Text_Wiki_Parse to find source text marked as a wiki freelink, and automatically create a link to that page.
Text_Wiki_Parse_Break
This class implements a Text_Wiki_Parse to mark forced line breaks in the source text.
Text_Wiki_Parse_Embed
This class implements a Text_Wiki_Parse to embed the contents of a URL inside the page at render-time. Typically used to get script output.

Inherited Variables

Inherited Methods


Class Details

[line 29]
Baseline rule class for extension into a "real" parser component.

Text_Wiki_Rule classes do not stand on their own; they are called by a Text_Wiki object, typcially in the transform()method. Each rule class performs three main activities: parse, process, and render.

The parse() method takes a regex and applies it to the whole block of source text at one time. Each match is sent as $matches to the process() method.

The process() method acts on the matched text from the source, and then processes the source text is some way. This may mean the creation of a delimited token using addToken(). In every case, the process() method returns the text that should replace the matched text from parse().



[ Top ]


Class Variables

$conf = array()

[line 42]

Configuration options for this parser rule.
  • Access: public

Type:   string


[ Top ]

$regex =  null

[line 57]

Regular expression to find matching text for this rule.

Type:   string


[ Top ]

$rule =  null

[line 70]

The name of this rule for new token array elements.
  • Access: public

Type:   string


[ Top ]

$wiki =  null

[line 85]

A reference to the calling Text_Wiki object.

This is needed so that each rule has access to the same source text, token set, URLs, interwiki maps, page names, etc.

  • Access: public

Type:   object


[ Top ]



Method Detail

Text_Wiki_Parse (Constructor)   [line 98]

Text_Wiki_Parse Text_Wiki_Parse( object &$obj)

Constructor for this parser rule.
  • Access: public

Parameters:

object   &$obj   —  The calling "parent" Text_Wiki object.

[ Top ]

getAttrs   [line 221]

array getAttrs( string $text)

Extract 'attribute="value"' portions of wiki markup.

This kind of markup is typically used only in macros, but is useful anywhere.

The syntax is pretty strict; there can be no spaces between the option name, the equals, and the first double-quote; the value must be surrounded by double-quotes. You can escape characters in the value with a backslash, and the backslash will be stripped for you.

  • Return: An associative array of key-value pairs where the key is the option name and the value is the option value.
  • Access: public

Parameters:

string   $text   —  The "attributes" portion of markup.

[ Top ]

getConf   [line 189]

mixed getConf( string $key, [mixed $default = null])

Simple method to safely get configuration key values.
  • Return: The configuration key value (if it exists) or the default value (if not).
  • Access: public

Parameters:

string   $key   —  The configuration key.
mixed   $default   —  If the key does not exist, return this value instead.

[ Top ]

parse   [line 139]

void parse( )

Abstrct method to parse source text for matches.

Applies the rule's regular expression to the source text, passes every match to the process() method, and replaces the matched text with the results of the processing.


Overridden in child classes as:

Text_Wiki_Parse_Prefilter::parse()
Simple parsing method.
Text_Wiki_Parse_Url::parse()
Find three different kinds of URLs in the source text.
Text_Wiki_Parse_Interwiki::parse()
Parser. We override the standard parser so we can find both described interwiki links and standalone links.
Text_Wiki_Parse_Wikilink::parse()
First parses for described links, then for standalone links.
Text_Wiki_Parse_Tighten::parse()
Apply tightening directly to the source text.

[ Top ]

process   [line 167]

string process( &$matches, array $matches)

Abstract method to generate replacements for matched text.
  • Return: The processed text replacement; defaults to the full matched string (i.e., no changes to the text).
  • See: Text_Wiki_Parse::parse()
  • Access: public

Overridden in child classes as:

Text_Wiki_Parse_List::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Colortext::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Tt::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Include::process()
Includes the results of the script directly into the source; the output will subsequently be parsed by the remaining Text_Wiki rules.
Text_Wiki_Parse_Bold::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Html::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Deflist::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Strong::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Blockquote::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Paragraph::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Horiz::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Toc::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Newline::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Table::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Url::process()
Process inline URLs.
Text_Wiki_Parse_Superscript::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Revise::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Raw::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Code::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_emphasis::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Center::process()
Generates a token entry for the matched text.
Text_Wiki_Parse_Delimiter::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Image::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Anchor::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Italic::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Interwiki::process()
Generates a replacement for the matched standalone interwiki text.
Text_Wiki_Parse_Heading::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Phplookup::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Wikilink::process()
Generate a replacement for standalone links.
Text_Wiki_Parse_Function::process()
Text_Wiki_Parse_Freelink::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Break::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Embed::process()
Generates a token entry for the matched text. Token options are:

Parameters:

array   $matches   —  An array of matches from the parse() method as generated by preg_replace_callback. $matches[0] is the full matched string, $matches[1] is the first matched pattern, $matches[2] is the second matched pattern, and so on.
   &$matches   — 

[ Top ]


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