get_display_list()), which avoids parent and children nodes */ class DocNode { /**@{@name Types of nodes */ /** Document node. The root node. No parsed properties \b Added by node emitter: \b opentag_head = '', \b closetag = '', \b elementcontent set from child emitters */ const DOCUMENT = 'document'; /** Text node. No html markup. \b Parsed properties: \b textcontent @sa Muster_SimpleWiki_Parser::_set_rules ($rules->char, $rules->escape) @sa Muster_SimpleWiki_Parser::_char_node (inline non-markup character sets) @sa Muster_SimpleWiki_Parser::_escape_node (escaped characters) @sa Muster_SimpleWiki_Parser::_span_node (when error) @sa Muster_SimpleWiki_Emitter::_text_emit */ const TEXT = 'text'; /** Paragraph node (\
). \b Parsed properties: \b decoration \b Added by node emitter: \b opentag_head = "\n
paragraph)
@sa Muster_SimpleWiki_Parser::_paragraph_node
@sa Muster_SimpleWiki_Emitter::_paragraph_emit
*/
const PARAGRAPH = 'paragraph';
/** Heading node (\
).
No parsed properties
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->linebreak)
@sa Muster_SimpleWiki_Parser::_linebreak_node
@sa Muster_SimpleWiki_Emitter::_linebreak_emit
*/
const LINEBREAK = 'linebreak';
/** Horizontal rule node (\
).
No parsed properties
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->horizontalrule)
@sa Muster_SimpleWiki_Parser::_horizontalrule_node
@sa Muster_SimpleWiki_Emitter::_horizontalrule_emit
*/
const HORIZONTALRULE = 'horizontalrule';
/** Link node (\).
\b Parsed properties: \b target, \b title, \b decoration
\b Added by node emitter: \b linkparts->anchor, \b linkparts->internaladdress, \b linkparts->symlink, \b linkparts->internalselector, \b linkparts->internalversion, \b linkparts->symlinkpath (set by handlers), \b linkparts->externaladdress, \b linkparts->externalprotocol, \b linkparts->externalselector, \b linkparts->rawlink, \b linkparts->rawlinkaddress (set by handlers)
\b Added by node emitter: \b opentag_head = "\nanchor are empty
\b Added by registered symlinks: \b linkparts->symlinkpath (or must be added by registered symlink handler)
\b Added by registered rawlink handler: \b linkparts->rawlinkaddress
\b elementcontent set by caption
\b Added by prepare_link_node: \b linkparts->anchor ("#" stripped out if linkparts->anchor is set, and caption is empty)
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->link)
@sa Muster_SimpleWiki_Parser::_link_node
@sa Muster_SimpleWiki_Emitter::_link_emit
*/
const LINK = 'link';
/** Image node (\).
\b Parsed properties: \b target, \b title, \b decoration
\b Added by node emitter: \b linkparts->internaladdress, \b linkparts->symlink, \b linkparts->internalselector, \b linkparts->externaladdress, \b linkparts->externalprotocol, \b linkparts->externalselector, \b linkparts->rawlink, \b linkparts->rawlinkaddress
\b Added by node emitter: \b opentag_head = "\nsymlinkpath (or must be added by registered symlink handler)
\b Added by prepare_image_node: \b attributes from decoration, classes, properties as styles
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->image)
@sa Muster_SimpleWiki_Parser::_image_node
@sa Muster_SimpleWiki_Emitter::_image_emit
*/
const IMAGE = 'image';
/** Ordered list node (\).
\b Parsed properties: \b level, \b decoration ($rules->list)
\b Added by node emitter: \b opentag_head = "\n
).
\b Parsed properties: \b level, \b decoration
\b Added by node emitter: \b opentag_head = "\n
list)
@sa Muster_SimpleWiki_Parser::_list_node
@sa Muster_SimpleWiki_Emitter::_unordered_list_emit
*/
const UNORDERED_LIST = 'unordered_list';
/** List item node (\
).
\b Parsed properties: \b level, \b decoration
\b Added by node emitter: \b opentag_head = "\n
deflist)
@sa Muster_SimpleWiki_Parser::_deflist_node
@sa Muster_SimpleWiki_Emitter::_def_list_emit
*/
const DEF_LIST = 'def_list';
/** Definition term node (\
).
\b Parsed properties: \b decoration
\b Added by node emitter: \b opentag_head = "\n
table)
@sa Muster_SimpleWiki_Parser::_table_node
@sa Muster_SimpleWiki_Emitter::_table_emit
*/
const TABLE = 'table';
/** Table row node (\
).
\b Parsed properties: \b decoration
\b Added by prepare_node: \b attributes from decoration, classes, properties as styles
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->table)
@sa Muster_SimpleWiki_Parser::_table_node
@sa Muster_SimpleWiki_Emitter::_table_row_emit
*/
const TABLE_ROW = 'table_row';
/** Table headcell node (\ ).
\b Parsed properties: \b decoration
\b Added by node emitter: \b opentag_head = "\n cell)
@sa Muster_SimpleWiki_Parser::_table_node
@sa Muster_SimpleWiki_Emitter::_table_headcell_emit
*/
const TABLE_HEADCELL = 'table_headcell';
/** Table data cell node (\ ).
\b Parsed properties: \b decoration
\b Added by node emitter: \b opentag_head = "\n cell)
@sa Muster_SimpleWiki_Parser::_table_node
@sa Muster_SimpleWiki_Emitter::_table_cell_emit
*/
const TABLE_CELL = 'table_cell';
/** Span node (\).
\b Parsed properties: \b decoration
\b Added by node emitter: \b opentag_head = "\nspan)
@sa Muster_SimpleWiki_Parser::_span_node
@sa Muster_SimpleWiki_Emitter::_span_emit
*/
const SPAN = 'span';
/** itagdef node (\ ).
\b Parsed properties: \b textcontent, \b decoration
\b Added by node emitter: \b opentag_head = "\n
code)
@sa Muster_SimpleWiki_Parser::_code_node
@sa Muster_SimpleWiki_Emitter::_code_emit
*/
const CODE = 'code';
/** Preformatted node (\
).
\b Parsed properties: \b textcontent, \b decoration
\b Added by node emitter: \b opentag_head = "\n
pre)
@sa Muster_SimpleWiki_Parser::_pre_node
@sa Muster_SimpleWiki_Emitter::_preformatted_emit
*/
const PREFORMATTED = 'preformatted';
/** Blockdef node (various).
\b Parsed properties: \b blocktag, \b decoration
\b Added by node emitter: \b knowntag (can be over-ridden by blockdef handler)
\b Added by node emitter: \b opentag_head = "\n<$blocktag", \b opentag_tail = "/>", \b closetag = "\n$blocktag>", \b elementcontent set by child nodes, unless set by blockdef handler. dl... blocktags changed to xmlns form (dl:tag); unknown blocktag returns markup text.
\b Added by prepare_node: \b attributes from decoration, classes, properties as styles
@sa Muster_SimpleWiki_Emitter::$_blocktags for a list of blocktags.
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->blockdef)
@sa Muster_SimpleWiki_Parser::_blockdef_node
@sa Muster_SimpleWiki_Emitter::_blockdef_emit
*/
const BLOCKDEF = 'blockdef';
/** Macro definition.
\b parsed properties: \b macroname, \b textcontent, \b decoration.
\b added by node emitter: \b processed. Automatically set to TRUE
if a macro processor found, otherwise set to false for internal processing control (error).
\b added by macro: \b output. If output is not set, caption is used for text output if available.
@sa Muster_SimpleWiki_Parser::_set_rules ($rules->macro, $rules->blockmacro)
@sa Muster_SimpleWiki_Parser::_macro_node
@sa Muster_SimpleWiki_Parser::_blockmacro_node
@sa Muster_SimpleWiki_Emitter::_macro_emit
*/
const MACRO = 'macro';
/**@}*/
/**@{ @name Standard node properties */
/// A parent node in the document tree.
public $parent;
/// array of child nodes - used to emit content
public $children;
/// holds the type of node - See constants for types
public $type;
/**@}*/
/** Create new node.
initialized children array, sets type and parent, and adds to parent children list.
@param string $type selected from one of the class constants
@param object $parent the parent of the node.
*/
public function __construct($type, $parent=NULL)
{
$this->children = array();
$this->type = $type;
$this->parent = $parent;
if (!empty($parent))
$parent->child_append($this);
}
/** Add child to children list.
Children emit output as content for the current node.
@param object $child
*/
protected function child_append($child)
{
$this->children[] = $child;
}
/** For debug: Returns a clone of properties, leaving out parent and children properties.
*/
public function get_display_list() // for debug
{
$clone = clone $this;
unset($clone->parent);
unset($clone->children);
return $clone;
}
}