MediaWiki master
MediaWiki\Parser\Preprocessor Class Reference

Inherited by MediaWiki\Parser\Preprocessor_Hash.

Collaboration diagram for MediaWiki\Parser\Preprocessor:

Public Member Functions

 __construct (Parser $parser, ?WANObjectCache $wanCache=null, array $options=[])
 
 newCustomFrame ( $args)
 Create a new custom frame for programmatic use of parameter replacement.
 
 newFrame ()
 Create a new top-level frame for expansion of a page.
 
 newPartNodeArray ( $values)
 Create a new custom node for programmatic use of parameter replacement.
 
 preprocessToObj ( $text, $flags=0)
 Get the document object model for the given wikitext.
 
 resetParser (?Parser $parser)
 Allows resetting the internal Parser reference after Preprocessor is cloned.
 

Public Attributes

Parser $parser
 
const DOM_FOR_INCLUSION = 1
 Transclusion mode flag for Preprocessor::preprocessToObj()
 
const DOM_LANG_CONVERSION_DISABLED = 2
 Language conversion construct omission flag for Preprocessor::preprocessToObj()
 
const DOM_UNCACHED = 4
 Preprocessor cache bypass flag for Preprocessor::preprocessToObj.
 

Protected Attributes

bool $disableLangConversion
 Whether language variant conversion is disabled.
 
array $rules
 Brace matching rules.
 
WANObjectCache $wanCache
 

Detailed Description

Definition at line 31 of file Preprocessor.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Preprocessor::__construct ( Parser $parser,
?WANObjectCache $wanCache = null,
array $options = [] )
Parameters
Parser$parser
WANObjectCache | null$wanCache
array$optionsMap of additional options, including:
  • disableLangConversion: disable language variant conversion. [Default: false]

Reimplemented in MediaWiki\Parser\Preprocessor_Hash.

Definition at line 79 of file Preprocessor.php.

References MediaWiki\Parser\Preprocessor\$parser, and MediaWiki\Parser\Preprocessor\$wanCache.

Member Function Documentation

◆ newCustomFrame()

MediaWiki\Parser\Preprocessor::newCustomFrame ( $args)
abstract

Create a new custom frame for programmatic use of parameter replacement.

This is useful for certain types of extensions

Parameters
array$args
Returns
PPFrame

Reimplemented in MediaWiki\Parser\Preprocessor_Hash.

◆ newFrame()

MediaWiki\Parser\Preprocessor::newFrame ( )
abstract

Create a new top-level frame for expansion of a page.

Returns
PPFrame

Reimplemented in MediaWiki\Parser\Preprocessor_Hash.

◆ newPartNodeArray()

MediaWiki\Parser\Preprocessor::newPartNodeArray ( $values)
abstract

Create a new custom node for programmatic use of parameter replacement.

This is useful for certain types of extensions

Parameters
array$values

Reimplemented in MediaWiki\Parser\Preprocessor_Hash.

◆ preprocessToObj()

MediaWiki\Parser\Preprocessor::preprocessToObj ( $text,
$flags = 0 )
abstract

Get the document object model for the given wikitext.

Any flag added to the $flags parameter here, or any other parameter liable to cause a change in the DOM tree for the given wikitext, must be passed through the section identifier in the section edit link and thus back to extractSections().

Parameters
string$textWikitext
int$flagsBit field of Preprocessor::DOM_* flags:
  • Preprocessor::DOM_FOR_INCLUSION: treat the wikitext as transcluded content from a page rather than direct content of a page or message. By default, the text is assumed to be undergoing processing for use by direct page views. The use of this flag causes text within <noinclude> tags to be ignored, text within <includeonly> to be included, and text outside of <onlyinclude> to be ignored.
  • Preprocessor::DOM_NO_LANG_CONV: do not parse "-{ ... }-" constructs, which are involved in language variant conversion. (deprecated since 1.36)
  • Preprocessor::DOM_UNCACHED: disable use of the preprocessor cache.
Returns
PPNode

Reimplemented in MediaWiki\Parser\Preprocessor_Hash.

◆ resetParser()

MediaWiki\Parser\Preprocessor::resetParser ( ?Parser $parser)

Allows resetting the internal Parser reference after Preprocessor is cloned.

Do not use this function in new code, since this method will be moved once Parser cloning goes away (T250448)

Parameters
?Parser$parser
Access: internal

Definition at line 99 of file Preprocessor.php.

References MediaWiki\Parser\Preprocessor\$parser.

Member Data Documentation

◆ $disableLangConversion

bool MediaWiki\Parser\Preprocessor::$disableLangConversion
protected

Whether language variant conversion is disabled.

Definition at line 46 of file Preprocessor.php.

◆ $parser

◆ $rules

array MediaWiki\Parser\Preprocessor::$rules
protected
Initial value:
= [
'{' => [
'end' => '}',
'names' => [
2 => 'template',
3 => 'tplarg',
],
'min' => 2,
'max' => 3,
],
'[' => [
'end' => ']',
'names' => [ 2 => null ],
'min' => 2,
'max' => 2,
],
'-{' => [
'end' => '}-',
'names' => [ 2 => null ],
'min' => 2,
'max' => 2,
],
]

Brace matching rules.

Definition at line 49 of file Preprocessor.php.

◆ $wanCache

WANObjectCache MediaWiki\Parser\Preprocessor::$wanCache
protected

◆ DOM_FOR_INCLUSION

const MediaWiki\Parser\Preprocessor::DOM_FOR_INCLUSION = 1

Transclusion mode flag for Preprocessor::preprocessToObj()

Definition at line 33 of file Preprocessor.php.

Referenced by MediaWiki\Parser\Parser\getPreloadText().

◆ DOM_LANG_CONVERSION_DISABLED

const MediaWiki\Parser\Preprocessor::DOM_LANG_CONVERSION_DISABLED = 2

Language conversion construct omission flag for Preprocessor::preprocessToObj()

Definition at line 35 of file Preprocessor.php.

Referenced by MediaWiki\Parser\Preprocessor_Hash\preprocessToObj().

◆ DOM_UNCACHED

const MediaWiki\Parser\Preprocessor::DOM_UNCACHED = 4

Preprocessor cache bypass flag for Preprocessor::preprocessToObj.

Definition at line 37 of file Preprocessor.php.


The documentation for this class was generated from the following file: