Zeta Components Manual :: Docs For Class ezcDocumentWikiVisitor
Document::ezcDocumentWikiVisitor
Class ezcDocumentWikiVisitor
Abstract visitor base for Wiki documents represented by the parser AST.
Source for this file: /Document/src/document/wiki/visitor.php
Implements interfaces:
Version: | //autogen// |
Descendants
Child Class | Description |
---|---|
ezcDocumentWikiDocbookVisitor | Docbook visitor for the Wiki AST. |
Member Variables
protected ezcDocumentWikiDocumentNode |
$ast
Reference to the AST root node. |
protected array |
$errors
= array()
Aggregated minor errors during document processing. |
protected array |
$footnoteCounter
= 0
Label dependant foot note counters for footnote auto enumeration. |
protected array |
$footnotes
= array()
List with footnotes for later rendering. |
protected ezcDocumentWiki |
$wiki
Wiki document handler |
Method Summary
public void |
__construct(
$document
, $path
)
Create visitor from Wiki document handler. |
protected void |
addFootnote(
$node
)
Add footnote |
public array |
getErrors(
)
Return list of errors occured during visiting the document. |
public ezcDocumentWikiFootnoteNode |
hasFootnoteTarget(
$number
, $node
)
Check for internal footnote reference target |
protected string |
nodeListToString(
$nodes
)
Node list to string |
protected string |
nodeToString(
$node
)
Transform a node tree into a string |
protected void |
preProcessAst(
$node
)
Pre process AST |
public void |
triggerError(
$level
, $message
, [ $file
= null] , [ $line
= null] , [ $position
= null] )
Trigger visitor error |
public mixed |
visit(
$ast
)
Docarate Wiki AST |
protected void |
visitChildren(
$root
, $node
)
Visit children |
protected void |
visitText(
$root
, $node
)
Visit text node |
Methods
__construct
Create visitor from Wiki document handler.
Parameters:
Name | Type | Description |
---|---|---|
$document |
ezcDocumentWiki | |
$path |
string |
addFootnote
Add footnote
Parameters:
Name | Type | Description |
---|---|---|
$node |
ezcDocumentWikiNode |
getErrors
Return list of errors occured during visiting the document.
May be an empty array, if on errors occured, or a list of ezcDocumentVisitException objects.
Implementation of:
Method | Description |
---|---|
ezcDocumentErrorReporting::getErrors() |
Return list of errors occured during visiting the document. |
hasFootnoteTarget
Check for internal footnote reference target
Returns the target name, when an internal reference target exists and sets it to used, and false otherwise.
Parameters:
Name | Type | Description |
---|---|---|
$number |
int | |
$node |
ezcDocumentWikiNode |
nodeListToString
Node list to string
Extract the contents of a node list and return a single string for the array of nodes.
Parameters:
Name | Type | Description |
---|---|---|
$nodes |
array |
nodeToString
Transform a node tree into a string
Transform a node tree, with all its subnodes into a string by only getting the textuual contents from ezcDocumentWikiTextLineNode objects.
Parameters:
Name | Type | Description |
---|---|---|
$node |
ezcDocumentWikiNode |
preProcessAst
Pre process AST
Performs multiple preprocessing steps on the AST:
Collect all possible reference targets in the AST to know the actual destianation for references while decorating. The references are stored in an internal structure and you may request the actual link by using the getReferenceTarget() method.
Aggregate list items into lists. In Wiki there are only list items, which are aggregated to lists depending on their bullet type. The related list items are aggregated into one list.
Parameters:
Name | Type | Description |
---|---|---|
$node |
ezcDocumentWikiNode |
triggerError
Trigger visitor error
Emit a vistitor error, and convert it to an exception depending on the error reporting settings.
Parameters:
Name | Type | Description |
---|---|---|
$level |
int | |
$message |
string | |
$file |
string | |
$line |
int | |
$position |
int |
Implementation of:
Method | Description |
---|---|
ezcDocumentErrorReporting::triggerError() |
Trigger parser error. |
visit
Docarate Wiki AST
Visit the Wiki abstract syntax tree.
Parameters:
Name | Type | Description |
---|---|---|
$ast |
ezcDocumentWikiDocumentNode |
Redefined in descendants as:
Method | Description |
---|---|
ezcDocumentWikiDocbookVisitor::visit() |
Docarate Wiki AST |
visitChildren
Visit children
Just recurse into node and visit its children, ignoring the actual node.
Parameters:
Name | Type | Description |
---|---|---|
$root |
DOMNode | |
$node |
ezcDocumentWikiNode |
visitText
Visit text node
Parameters:
Name | Type | Description |
---|---|---|
$root |
DOMNode | |
$node |
ezcDocumentWikiNode |