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

Class: Text_Wiki_Parse

Source Location: /Text_Wiki-1.1.0/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_List
Parses for bulleted and numbered lists.
Text_Wiki_Parse_Colortext
Parses for colorized text.
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
Parses for bold text.
Text_Wiki_Parse_Html
Parses for blocks of HTML code.
Text_Wiki_Parse_Deflist
Parses for definition lists.
Text_Wiki_Parse_Prefilter
"Pre-filter" the source text.
Text_Wiki_Parse_Strong
Parses for strongly-emphasized text.
Text_Wiki_Parse_Blockquote
Parse for block-quoted text.
Text_Wiki_Parse_Smiley
Smiley rule parser class for Default.
Text_Wiki_Parse_Paragraph
Parses for paragraph blocks.
Text_Wiki_Parse_Horiz
Parses for horizontal ruling lines.
Text_Wiki_Parse_Toc
Looks through parsed text and builds a table of contents.
Text_Wiki_Parse_Underline
Parses for bold text.
Text_Wiki_Parse_Newline
Parses for implied line breaks indicated by newlines.
Text_Wiki_Parse_Table
Parses for table markup.
Text_Wiki_Parse_Url
Parse for URLS in the source text.
Text_Wiki_Parse_Superscript
Parses for superscripted text.
Text_Wiki_Parse_Revise
Parses for text marked as revised (insert/delete).
Text_Wiki_Parse_Raw
Parses for text marked as "raw" (i.e., to be rendered as-is).
Text_Wiki_Parse_Code
Parses for text marked as a code example block.
Text_Wiki_Parse_emphasis
Parses for emphasized text.
Text_Wiki_Parse_Center
Parses for centered lines of text.
Text_Wiki_Parse_Delimiter
Parses for Text_Wiki delimiter characters already in the source text.
Text_Wiki_Parse_Image
Parses for image placement.
Text_Wiki_Parse_Anchor
This class implements a Text_Wiki_Parse to add an anchor target name in the wiki page.
Text_Wiki_Parse_Subscript
Parses for subscripted text.
Text_Wiki_Parse_Italic
Parses for italic text.
Text_Wiki_Parse_Interwiki
Parses for interwiki links.
Text_Wiki_Parse_Heading
Parses for heading text.
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
Parses for an API function documentation block.
Text_Wiki_Parse_Freelink
Parses for freelinked page links.
Text_Wiki_Parse_Break
Parses for explicit line breaks.
Text_Wiki_Parse_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 109]

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

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

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

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

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_Smiley::process()
Generates a replacement token for the matched text. Token options are:
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_Underline::process()
Generates a replacement for the matched text. Token options are:
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_Subscript::process()
Generates a replacement 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 14:37:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.