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

Class: Text_Wiki_Parse

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

Class Overview


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


Author(s):

Version:

  • Release: @package_version@

Variables

Methods


Child classes:

Text_Wiki_Parse_Default_List
Parses for bulleted and numbered lists.
Text_Wiki_Parse_Default_Colortext
Parses for colorized text.
Text_Wiki_Parse_Default_Tt
Find source text marked for teletype (monospace).
Text_Wiki_Parse_Default_Include
This class implements a Text_Wiki_Parse_Default to include the results of a
Text_Wiki_Parse_Default_Bold
Parses for bold text.
Text_Wiki_Parse_Default_Html
Parses for blocks of HTML code.
Text_Wiki_Parse_Default_Deflist
Parses for definition lists.
Text_Wiki_Parse_Default_Prefilter
"Pre-filter" the source text.
Text_Wiki_Parse_Default_Strong
Parses for strongly-emphasized text.
Text_Wiki_Parse_Default_Blockquote
Parse for block-quoted text.
Text_Wiki_Parse_Default_Smiley
Smiley rule parser class for Default.
Text_Wiki_Parse_Default_Paragraph
Parses for paragraph blocks.
Text_Wiki_Parse_Default_Horiz
Parses for horizontal ruling lines.
Text_Wiki_Parse_Default_Toc
Looks through parsed text and builds a table of contents.
Text_Wiki_Parse_Default_Underline
Parses for bold text.
Text_Wiki_Parse_Default_Newline
Parses for implied line breaks indicated by newlines.
Text_Wiki_Parse_Default_Table
Parses for table markup.
Text_Wiki_Parse_Default_Url
Parse for URLS in the source text.
Text_Wiki_Parse_Default_Superscript
Parses for superscripted text.
Text_Wiki_Parse_Default_Revise
Parses for text marked as revised (insert/delete).
Text_Wiki_Parse_Default_Raw
Parses for text marked as "raw" (i.e., to be rendered as-is).
Text_Wiki_Parse_Default_Code
Parses for text marked as a code example block.
Text_Wiki_Parse_Default_emphasis
Parses for emphasized text.
Text_Wiki_Parse_Default_Center
Parses for centered lines of text.
Text_Wiki_Parse_Default_Delimiter
Parses for Text_Wiki delimiter characters already in the source text.
Text_Wiki_Parse_Default_Image
Parses for image placement.
Text_Wiki_Parse_Default_Anchor
This class implements a Text_Wiki_Parse to add an anchor target name in the wiki page.
Text_Wiki_Parse_Default_Subscript
Parses for subscripted text.
Text_Wiki_Parse_Default_Italic
Parses for italic text.
Text_Wiki_Parse_Default_Interwiki
Parses for interwiki links.
Text_Wiki_Parse_Default_Heading
Parses for heading text.
Text_Wiki_Parse_Default_Phplookup
Find source text marked for lookup in the PHP online manual.
Text_Wiki_Parse_Default_Wikilink
Parse for links to wiki pages.
Text_Wiki_Parse_Default_Tighten
The rule removes all remaining newlines.
Text_Wiki_Parse_Default_Function
Parses for an API function documentation block.
Text_Wiki_Parse_Default_Freelink
Parses for freelinked page links.
Text_Wiki_Parse_Default_Break
Parses for explicit line breaks.
Text_Wiki_Parse_Default_Embed
Embeds the results of a PHP script at render-time.

Inherited Variables

Inherited Methods


Class Details

[line 40]
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 53]

Configuration options for this parser rule.
  • Access: public

Type:   string


[ Top ]

$regex =  null

[line 68]

Regular expression to find matching text for this rule.

Type:   string


[ Top ]

$rule =  null

[line 81]

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

Type:   string


[ Top ]

$wiki =  null

[line 96]

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 146]

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 ]

__construct (Constructor)   [line 109]

Text_Wiki_Parse __construct( object &$obj)

Constructor for this parser rule.
  • Access: public

Overridden in child classes as:

Text_Wiki_Parse_Default_Smiley::__construct()
Constructor.
Text_Wiki_Parse_Default_Url::__construct()
Constructor.
Text_Wiki_Parse_Default_Delimiter::__construct()
Constructor. Overrides the Text_Wiki_Parse_Default constructor so that we can set the $regex property dynamically (we need to include the Text_Wiki $delim character.
Text_Wiki_Parse_Default_Image::__construct()
Constructor.
Text_Wiki_Parse_Default_Wikilink::__construct()
Constructor.
Text_Wiki_Parse_Default_Freelink::__construct()
Constructor. We override the Text_Wiki_Parse_Default constructor so we can explicitly comment each part of the $regex property.

Parameters:

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

[ Top ]

getAttrs   [line 248]

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 216]

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 166]

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_Default_Prefilter::parse()
Simple parsing method.
Text_Wiki_Parse_Default_Url::parse()
Find three different kinds of URLs in the source text.
Text_Wiki_Parse_Default_Interwiki::parse()
Parser. We override the standard parser so we can find both described interwiki links and standalone links.
Text_Wiki_Parse_Default_Wikilink::parse()
First parses for described links, then for standalone links.
Text_Wiki_Parse_Default_Tighten::parse()
Apply tightening directly to the source text.

[ Top ]

process   [line 194]

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_Default_List::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Colortext::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Tt::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Default_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_Default_Bold::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Html::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Deflist::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Strong::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Blockquote::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Default_Smiley::process()
Generates a replacement token for the matched text. Token options are:
Text_Wiki_Parse_Default_Paragraph::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_Horiz::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Default_Toc::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Default_Underline::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Newline::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Default_Table::process()
Generates a replacement for the matched text.
Text_Wiki_Parse_Default_Url::process()
Process inline URLs.
Text_Wiki_Parse_Default_Superscript::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Revise::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Raw::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_Code::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_emphasis::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Center::process()
Generates a token entry for the matched text.
Text_Wiki_Parse_Default_Delimiter::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_Image::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_Anchor::process()
Generates a token entry for the matched text. Token options are:
Text_Wiki_Parse_Default_Subscript::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Italic::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Interwiki::process()
Generates a replacement for the matched standalone interwiki text.
Text_Wiki_Parse_Default_Heading::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Phplookup::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Wikilink::process()
Generate a replacement for standalone links.
Text_Wiki_Parse_Default_Function::process()
Text_Wiki_Parse_Default_Freelink::process()
Generates a replacement for the matched text. Token options are:
Text_Wiki_Parse_Default_Break::process()
Generates a replacement token for the matched text.
Text_Wiki_Parse_Default_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 Tue, 12 Mar 2019 21:49:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.