6 interface Preprocessor
{
7 /** Create a new preprocessor object based on an initialised Parser object */
8 function __construct( $parser );
10 /** Create a new top-level frame for expansion of a page */
13 /** Create a new custom frame for programmatic use of parameter replacement as used in some extensions */
14 function newCustomFrame( $args );
16 /** Create a new custom node for programmatic use of parameter replacement as used in some extensions */
17 function newPartNodeArray( $values );
19 /** Preprocess text to a PPNode */
20 function preprocessToObj( $text, $flags = 0 );
28 const NO_TEMPLATES
= 2;
29 const STRIP_COMMENTS
= 4;
31 const RECOVER_COMMENTS
= 16;
33 const RECOVER_ORIG
= 27; // = 1|2|8|16 no constant expression support in PHP yet
36 * Create a child frame
38 function newChild( $args = false, $title = false );
41 * Expand a document tree node
43 function expand( $root, $flags = 0 );
46 * Implode with flags for expand()
48 function implodeWithFlags( $sep, $flags /*, ... */ );
51 * Implode with no flags specified
53 function implode( $sep /*, ... */ );
56 * Makes an object that, when expand()ed, will be the same as one obtained
59 function virtualImplode( $sep /*, ... */ );
62 * Virtual implode with brackets
64 function virtualBracketedImplode( $start, $sep, $end /*, ... */ );
67 * Returns true if there are no arguments in this frame
72 * Returns all arguments of this frame
74 function getArguments();
77 * Returns all numbered arguments of this frame
79 function getNumberedArguments();
82 * Returns all named arguments of this frame
84 function getNamedArguments();
87 * Get an argument to this frame by name
89 function getArgument( $name );
92 * Returns true if the infinite loop check is OK, false if a loop is detected
94 function loopCheck( $title );
97 * Return true if the frame is a template frame
99 function isTemplate();
103 * There are three types of nodes:
104 * * Tree nodes, which have a name and contain other nodes as children
105 * * Array nodes, which also contain other nodes but aren't considered part of a tree
106 * * Leaf nodes, which contain the actual data
108 * This interface provides access to the tree structure and to the contents of array nodes,
109 * but it does not provide access to the internal structure of leaf nodes. Access to leaf
110 * data is provided via two means:
111 * * PPFrame::expand(), which provides expanded text
112 * * The PPNode::split*() functions, which provide metadata about certain types of tree node
117 * Get an array-type node containing the children of this node.
118 * Returns false if this is not a tree node.
120 function getChildren();
123 * Get the first child of a tree node. False if there isn't one.
125 function getFirstChild();
128 * Get the next sibling of any node. False if there isn't one
130 function getNextSibling();
133 * Get all children of this tree node which have a given name.
134 * Returns an array-type node, or false if this is not a tree node.
136 function getChildrenOfType( $type );
140 * Returns the length of the array, or false if this is not an array-type node
142 function getLength();
145 * Returns an item of an array-type node
150 * Get the name of this node. The following names are defined here:
153 * template A double-brace node.
154 * tplarg A triple-brace node.
155 * title The first argument to a template or tplarg node.
156 * part Subsequent arguments to a template or tplarg node.
157 * #nodelist An array-type node
159 * The subclass may define various other names for tree and leaf nodes.
164 * Split a <part> node into an associative array containing:
172 * Split an <ext> node into an associative array containing name, attr, inner and close
173 * All values in the resulting array are PPNodes. Inner and close are optional.
180 function splitHeading();