2008-01-21 16:36:08 +00:00
|
|
|
<?php
|
2010-08-22 14:31:05 +00:00
|
|
|
/**
|
|
|
|
|
* Interfaces for preprocessors
|
|
|
|
|
*
|
2012-04-30 09:22:16 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
2010-08-22 14:31:05 +00:00
|
|
|
* @file
|
2012-04-30 09:22:16 +00:00
|
|
|
* @ingroup Parser
|
2010-08-22 14:31:05 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
/**
|
|
|
|
|
* @ingroup Parser
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
interface Preprocessor {
|
2011-05-28 17:51:33 +00:00
|
|
|
/**
|
|
|
|
|
* Create a new preprocessor object based on an initialised Parser object
|
|
|
|
|
*
|
2014-04-21 23:38:39 +00:00
|
|
|
* @param Parser $parser
|
2011-05-28 17:51:33 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function __construct( $parser );
|
2008-02-18 07:45:44 +00:00
|
|
|
|
2011-05-01 23:54:41 +00:00
|
|
|
/**
|
|
|
|
|
* Create a new top-level frame for expansion of a page
|
|
|
|
|
*
|
|
|
|
|
* @return PPFrame
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function newFrame();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
2011-05-01 23:54:41 +00:00
|
|
|
/**
|
2014-05-10 23:03:45 +00:00
|
|
|
* Create a new custom frame for programmatic use of parameter replacement
|
|
|
|
|
* as used in some extensions.
|
2011-05-01 23:54:41 +00:00
|
|
|
*
|
2014-04-21 23:38:39 +00:00
|
|
|
* @param array $args
|
2011-11-09 20:52:24 +00:00
|
|
|
*
|
2011-05-01 23:54:41 +00:00
|
|
|
* @return PPFrame
|
|
|
|
|
*/
|
2008-06-26 13:05:40 +00:00
|
|
|
function newCustomFrame( $args );
|
|
|
|
|
|
2011-05-28 17:51:33 +00:00
|
|
|
/**
|
2014-05-10 23:03:45 +00:00
|
|
|
* Create a new custom node for programmatic use of parameter replacement
|
|
|
|
|
* as used in some extensions.
|
2011-05-28 17:51:33 +00:00
|
|
|
*
|
2014-04-21 23:38:39 +00:00
|
|
|
* @param array $values
|
2011-05-28 17:51:33 +00:00
|
|
|
*/
|
2010-06-10 15:18:43 +00:00
|
|
|
function newPartNodeArray( $values );
|
|
|
|
|
|
2011-05-01 23:54:41 +00:00
|
|
|
/**
|
|
|
|
|
* Preprocess text to a PPNode
|
|
|
|
|
*
|
2014-04-21 23:38:39 +00:00
|
|
|
* @param string $text
|
|
|
|
|
* @param int $flags
|
2011-11-09 20:52:24 +00:00
|
|
|
*
|
2011-05-01 23:54:41 +00:00
|
|
|
* @return PPNode
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function preprocessToObj( $text, $flags = 0 );
|
|
|
|
|
}
|
|
|
|
|
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
/**
|
|
|
|
|
* @ingroup Parser
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
interface PPFrame {
|
|
|
|
|
const NO_ARGS = 1;
|
|
|
|
|
const NO_TEMPLATES = 2;
|
|
|
|
|
const STRIP_COMMENTS = 4;
|
|
|
|
|
const NO_IGNORE = 8;
|
2008-01-25 04:14:51 +00:00
|
|
|
const RECOVER_COMMENTS = 16;
|
2008-01-21 16:36:08 +00:00
|
|
|
|
2008-01-25 04:14:51 +00:00
|
|
|
const RECOVER_ORIG = 27; // = 1|2|8|16 no constant expression support in PHP yet
|
2008-01-21 16:36:08 +00:00
|
|
|
|
2012-05-22 03:26:25 +00:00
|
|
|
/** This constant exists when $indexOffset is supported in newChild() */
|
|
|
|
|
const SUPPORTS_INDEX_OFFSET = 1;
|
|
|
|
|
|
2008-01-21 16:36:08 +00:00
|
|
|
/**
|
|
|
|
|
* Create a child frame
|
2011-05-28 17:18:50 +00:00
|
|
|
*
|
2014-05-10 23:05:51 +00:00
|
|
|
* @param array|bool $args
|
|
|
|
|
* @param bool|Title $title
|
2012-12-17 10:23:02 +00:00
|
|
|
* @param int $indexOffset A number subtracted from the index attributes of the arguments
|
2011-05-28 17:51:33 +00:00
|
|
|
*
|
2011-05-28 17:18:50 +00:00
|
|
|
* @return PPFrame
|
2008-01-21 16:36:08 +00:00
|
|
|
*/
|
2012-05-22 03:26:25 +00:00
|
|
|
function newChild( $args = false, $title = false, $indexOffset = 0 );
|
2008-01-21 16:36:08 +00:00
|
|
|
|
2014-05-29 00:54:55 +00:00
|
|
|
/**
|
|
|
|
|
* Expand a document tree node, caching the result on its parent with the given key
|
|
|
|
|
*/
|
|
|
|
|
function cachedExpand( $key, $root, $flags = 0 );
|
|
|
|
|
|
2008-01-21 16:36:08 +00:00
|
|
|
/**
|
|
|
|
|
* Expand a document tree node
|
|
|
|
|
*/
|
|
|
|
|
function expand( $root, $flags = 0 );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-01-21 16:36:08 +00:00
|
|
|
/**
|
|
|
|
|
* Implode with flags for expand()
|
|
|
|
|
*/
|
|
|
|
|
function implodeWithFlags( $sep, $flags /*, ... */ );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Implode with no flags specified
|
|
|
|
|
*/
|
|
|
|
|
function implode( $sep /*, ... */ );
|
|
|
|
|
|
|
|
|
|
/**
|
2008-04-14 07:45:50 +00:00
|
|
|
* Makes an object that, when expand()ed, will be the same as one obtained
|
2008-01-21 16:36:08 +00:00
|
|
|
* with implode()
|
2008-04-14 07:45:50 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function virtualImplode( $sep /*, ... */ );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Virtual implode with brackets
|
|
|
|
|
*/
|
|
|
|
|
function virtualBracketedImplode( $start, $sep, $end /*, ... */ );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if there are no arguments in this frame
|
2011-05-28 17:51:33 +00:00
|
|
|
*
|
|
|
|
|
* @return bool
|
2008-01-21 16:36:08 +00:00
|
|
|
*/
|
|
|
|
|
function isEmpty();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
2009-07-02 16:21:30 +00:00
|
|
|
/**
|
|
|
|
|
* Returns all arguments of this frame
|
|
|
|
|
*/
|
|
|
|
|
function getArguments();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns all numbered arguments of this frame
|
|
|
|
|
*/
|
|
|
|
|
function getNumberedArguments();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns all named arguments of this frame
|
|
|
|
|
*/
|
|
|
|
|
function getNamedArguments();
|
|
|
|
|
|
2008-02-18 07:45:44 +00:00
|
|
|
/**
|
2008-04-14 07:45:50 +00:00
|
|
|
* Get an argument to this frame by name
|
2008-02-18 07:45:44 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getArgument( $name );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the infinite loop check is OK, false if a loop is detected
|
2011-05-28 17:51:33 +00:00
|
|
|
*
|
2014-04-21 23:38:39 +00:00
|
|
|
* @param Title $title
|
2011-05-28 17:51:33 +00:00
|
|
|
* @return bool
|
2008-01-21 16:36:08 +00:00
|
|
|
*/
|
|
|
|
|
function loopCheck( $title );
|
2008-01-30 02:55:19 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return true if the frame is a template frame
|
|
|
|
|
*/
|
|
|
|
|
function isTemplate();
|
2011-11-09 20:52:24 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a title of frame
|
|
|
|
|
*
|
|
|
|
|
* @return Title
|
|
|
|
|
*/
|
|
|
|
|
function getTitle();
|
2008-01-21 16:36:08 +00:00
|
|
|
}
|
|
|
|
|
|
2008-02-18 07:45:44 +00:00
|
|
|
/**
|
|
|
|
|
* There are three types of nodes:
|
|
|
|
|
* * Tree nodes, which have a name and contain other nodes as children
|
|
|
|
|
* * Array nodes, which also contain other nodes but aren't considered part of a tree
|
|
|
|
|
* * Leaf nodes, which contain the actual data
|
|
|
|
|
*
|
|
|
|
|
* This interface provides access to the tree structure and to the contents of array nodes,
|
2008-04-14 07:45:50 +00:00
|
|
|
* but it does not provide access to the internal structure of leaf nodes. Access to leaf
|
2008-02-18 07:45:44 +00:00
|
|
|
* data is provided via two means:
|
|
|
|
|
* * PPFrame::expand(), which provides expanded text
|
|
|
|
|
* * The PPNode::split*() functions, which provide metadata about certain types of tree node
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Parser
|
2008-02-18 07:45:44 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
interface PPNode {
|
2008-04-14 07:45:50 +00:00
|
|
|
/**
|
2008-02-18 07:45:44 +00:00
|
|
|
* Get an array-type node containing the children of this node.
|
|
|
|
|
* Returns false if this is not a tree node.
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getChildren();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the first child of a tree node. False if there isn't one.
|
2011-05-01 23:54:41 +00:00
|
|
|
*
|
|
|
|
|
* @return PPNode
|
2008-02-18 07:45:44 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getFirstChild();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the next sibling of any node. False if there isn't one
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getNextSibling();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all children of this tree node which have a given name.
|
|
|
|
|
* Returns an array-type node, or false if this is not a tree node.
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getChildrenOfType( $type );
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the length of the array, or false if this is not an array-type node
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getLength();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns an item of an array-type node
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function item( $i );
|
2008-02-18 07:45:44 +00:00
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
/**
|
2008-02-18 07:45:44 +00:00
|
|
|
* Get the name of this node. The following names are defined here:
|
|
|
|
|
*
|
|
|
|
|
* h A heading node.
|
|
|
|
|
* template A double-brace node.
|
|
|
|
|
* tplarg A triple-brace node.
|
|
|
|
|
* title The first argument to a template or tplarg node.
|
|
|
|
|
* part Subsequent arguments to a template or tplarg node.
|
|
|
|
|
* #nodelist An array-type node
|
|
|
|
|
*
|
|
|
|
|
* The subclass may define various other names for tree and leaf nodes.
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function getName();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
2012-07-10 12:48:06 +00:00
|
|
|
* Split a "<part>" node into an associative array containing:
|
2008-02-18 07:45:44 +00:00
|
|
|
* name PPNode name
|
|
|
|
|
* index String index
|
2008-04-14 07:45:50 +00:00
|
|
|
* value PPNode value
|
2008-02-18 07:45:44 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function splitArg();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
2012-07-10 12:48:06 +00:00
|
|
|
* Split an "<ext>" node into an associative array containing name, attr, inner and close
|
2008-02-18 07:45:44 +00:00
|
|
|
* All values in the resulting array are PPNodes. Inner and close are optional.
|
|
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function splitExt();
|
2008-02-18 07:45:44 +00:00
|
|
|
|
|
|
|
|
/**
|
2012-07-10 12:48:06 +00:00
|
|
|
* Split an "<h>" node
|
2008-02-18 07:45:44 +00:00
|
|
|
*/
|
2008-01-21 16:36:08 +00:00
|
|
|
function splitHeading();
|
|
|
|
|
}
|