Class: Text_Wiki
Source Location: /Text_Wiki-1.2.0RC1/Text/Wiki.php
Parse structured wiki text and render into arbitrary formats such as XHTML.
Author(s):
Version:
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
$delim = "\xFF"
[line 208]
The delimiter for token numbers of parsed elements in source text.
$disable = array(
'Html',
'Include',
'Embed'
)
[line 102]
The list of rules to not-apply to the source text.
$formatConf = array(
'Docbook' => array(),'Latex'=>array(),'Pdf'=>array(),'Plain'=>array(),'Rtf'=>array(),'Xhtml'=>array())
[line 188]
Custom configuration for the output format itself. Even though Text_Wiki will render the tokens from parsed text, the format itself may require some configuration. For example, RTF needs to know font names and sizes, PDF requires page layout information, and DocBook needs a section hierarchy. This array matches the $conf property of the the format-level renderer (e.g., Text_Wiki_Render_Xhtml). In this array, the key is the rendering format name, and the value is an array of key-value configuration pairs corresponding to the $conf property in the rendering format rule.
$parseConf = array()
[line 135]
Custom configuration for rules at the parsing stage. In this array, the key is the parsing rule name, and the value is an array of key-value configuration pairs corresponding to the $conf property in the target parsing rule. For example: $parseConf = array(
'Include' => array(
'base' => '/path/to/scripts/'
)
);
Note that most default rules do not need any parsing configuration.
$renderConf = array(
'Docbook' => array(),'Latex'=>array(),'Pdf'=>array(),'Plain'=>array(),'Rtf'=>array(),'Xhtml'=>array())
[line 157]
Custom configuration for rules at the rendering stage. Because rendering may be different for each target format, the first-level element in this array is always a format name (e.g., 'Xhtml'). Within that first level element, the subsequent elements match the $parseConf format. That is, the sub-key is the rendering rule name, and the sub-value is an array of key-value configuration pairs corresponding to the $conf property in the target rendering rule.
$renderingType = 'preg'
[line 341]
Temporary configuration variable
$rules = array(
'Prefilter',
'Delimiter',
'Code',
'Function',
'Html',
'Raw',
'Include',
'Embed',
'Anchor',
'Heading',
'Toc',
'Horiz',
'Break',
'Blockquote',
'List',
'Deflist',
'Table',
'Image',
'Phplookup',
'Center',
'Newline',
'Paragraph',
'Url',
'Freelink',
'Interwiki',
'Wikilink',
'Colortext',
'Strong',
'Bold',
'Emphasis',
'Italic',
'Underline',
'Tt',
'Superscript',
'Subscript',
'Revise',
'Tighten'
)
[line 51]
The default list of rules, in order, to apply to the source text.
Method Detail
Text_Wiki (Constructor) [line 356]
Text_Wiki Text_Wiki(
[array
$rules = null])
|
|
Constructor. **DEPRECATED** Please use the singleton() or factory() methods.
Parameters:
addPath [line 1312]
void addPath(
string
$type, string
$dir)
|
|
Add a path to a path array.
Parameters:
addToken [line 1116]
string|int addToken(
$rule, [array
$options = array()], [boolean
$id_only = false])
|
|
Add a token to the Text_Wiki tokens array, and return a delimited token number.
Parameters:
changeRule [line 796]
void changeRule(
string
$old, string
$new)
|
|
Change from one rule to another in-place.
Parameters:
deleteRule [line 772]
void deleteRule(
$name, string
$rule)
|
|
Delete (remove or unset) a rule from the $rules property.
Parameters:
disableRule [line 843]
void disableRule(
$name, string
$rule)
|
|
Disables a rule so that it is not applied when parsing.
Parameters:
enableRule [line 821]
void enableRule(
$name, string
$rule)
|
|
Enables a rule so that it is applied when parsing.
Parameters:
error [line 1417]
object PEAR_Error &error(
string
$message)
|
|
Simple error-object generator.
Parameters:
factory [line 435]
Text_Wiki &factory(
[string
$parser = 'Default'], [array
$rules = null])
|
|
Returns a Text_Wiki Parser class for the specified parser.
Parameters:
findFile [line 1362]
string|bool findFile(
array
$type, string
$file)
|
|
Searches a series of paths for a given file.
Parameters:
getFormatConf [line 666]
mixed getFormatConf(
string
$format, [mixed
$key = null])
|
|
Get configuration for a specific format and key.
Parameters:
getParseConf [line 504]
mixed getParseConf(
string
$rule, [string
$key = null])
|
|
Get parser configuration for a specific rule and key.
Parameters:
getPath [line 1336]
array getPath(
[string
$type = null])
|
|
Get the current path array for a path-type.
Parameters:
getRenderConf [line 590]
mixed getRenderConf(
string
$format, string
$rule, [string
$key = null])
|
|
Get renderer configuration for a specific format, rule, and key.
Parameters:
getSource [line 1057]
Returns the parsed source text with delimited token placeholders.
getTokens [line 1077]
array getTokens(
[array
$rules = null])
|
|
Returns tokens that have been parsed out of the source text.
Parameters:
insertRule [line 706]
void insertRule(
string
$name, [string
$tgt = null])
|
|
Inserts a rule into to the rule set.
Parameters:
isError [line 1438]
bool isError(
&$obj, mixed
$obj)
|
|
Simple error checker.
Parameters:
loadFormatObj [line 1275]
bool loadFormatObj(
$format)
|
|
Load a format-render class file.
Parameters:
loadParseObj [line 1204]
bool loadParseObj(
$rule)
|
|
Load a rule parser class file.
Parameters:
loadRenderObj [line 1240]
bool loadRenderObj(
$format,
$rule)
|
|
Load a rule-render class file.
Parameters:
parse [line 903]
void parse(
string
$text)
|
|
Sets the $_source text property, then parses it in place and retains tokens in the $_tokens array property.
Parameters:
render [line 945]
string render(
[string
$format = 'Xhtml'])
|
|
Renders tokens back into the source text, based on the requested format.
Parameters:
setFormatConf [line 632]
void setFormatConf(
string
$format,
$arg1, [
$arg2 = null], string
$key, string
$val)
|
|
Set format configuration for a specific rule and key.
Parameters:
setParseConf [line 469]
void setParseConf(
string
$rule, array|string
$arg1, [string
$arg2 = null])
|
|
Set parser configuration for a specific rule and key.
Parameters:
setRenderConf [line 548]
void setRenderConf(
string
$format, string
$rule, array|string
$arg1, [string
$arg2 = null])
|
|
Set renderer configuration for a specific format, rule, and key.
Parameters:
setToken [line 1173]
void setToken(
int
$id, int
$rule, [array
$options = array()])
|
|
Set or re-set a token with specific information, overwriting any previous rule name and rule options.
Parameters:
singleton [line 411]
&object &singleton(
[string
$parser = 'Default'], [array
$rules = null])
|
|
Singleton. This avoids instantiating multiple Text_Wiki instances where a number of objects are required in one call, e.g. to save memory in a CMS invironment where several parsers are required in a single page. $single = & singleton(); or $single = & singleton('Parser', array('Prefilter', 'Delimiter', 'Code', 'Function', 'Html', 'Raw', 'Include', 'Embed', 'Anchor', 'Heading', 'Toc', 'Horiz', 'Break', 'Blockquote', 'List', 'Deflist', 'Table', 'Image', 'Phplookup', 'Center', 'Newline', 'Paragraph', 'Url', 'Freelink', 'Interwiki', 'Wikilink', 'Colortext', 'Strong', 'Bold', 'Emphasis', 'Italic', 'Underline', 'Tt', 'Superscript', 'Subscript', 'Revise', 'Tighten')); Call using a subset of this list. The order of passing rulesets in the $rules array is important! After calling this, call $single->setParseConf(), setRenderConf() or setFormatConf() as usual for a constructed object of this class. The internal static array of singleton objects has no index on the parser rules, the only index is on the parser name. So if you call this multiple times with different rules but the same parser name, you will get the same static parser object each time.
Parameters:
transform [line 882]
string transform(
string
$text, [string
$format = 'Xhtml'])
|
|
Parses and renders the text passed to it, and returns the results. First, the method parses the source text, applying rules to the text as it goes. These rules will modify the source text in-place, replacing some text with delimited tokens (and populating the $this->tokens array as it goes). Next, the method renders the in-place tokens into the requested output format. Finally, the method returns the transformed text. Note that the source text is transformed in place; once it is transformed, it is no longer the same as the original source text.
Parameters:
Documentation generated on Mon, 11 Mar 2019 14:46:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|