MediaWiki REL1_41
Preprocessor Class Reference

Inherited by Preprocessor_Hash.

Collaboration diagram for 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 27 of file Preprocessor.php.

Constructor & Destructor Documentation

◆ __construct()

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 Preprocessor_Hash.

Definition at line 75 of file Preprocessor.php.

References $parser, and $wanCache.

Member Function Documentation

◆ newCustomFrame()

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 Preprocessor_Hash.

◆ newFrame()

Preprocessor::newFrame ( )
abstract

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

Returns
PPFrame

Reimplemented in Preprocessor_Hash.

◆ newPartNodeArray()

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 Preprocessor_Hash.

◆ preprocessToObj()

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 Preprocessor_Hash.

◆ resetParser()

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 95 of file Preprocessor.php.

References $parser.

Member Data Documentation

◆ $disableLangConversion

bool Preprocessor::$disableLangConversion
protected

Whether language variant conversion is disabled.

Definition at line 42 of file Preprocessor.php.

◆ $parser

Parser Preprocessor::$parser

Definition at line 36 of file Preprocessor.php.

Referenced by __construct(), Preprocessor_Hash\__construct(), and resetParser().

◆ $rules

array 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 45 of file Preprocessor.php.

◆ $wanCache

WANObjectCache Preprocessor::$wanCache
protected

Definition at line 39 of file Preprocessor.php.

Referenced by __construct(), and Preprocessor_Hash\__construct().

◆ DOM_FOR_INCLUSION

const Preprocessor::DOM_FOR_INCLUSION = 1

◆ DOM_LANG_CONVERSION_DISABLED

const Preprocessor::DOM_LANG_CONVERSION_DISABLED = 2

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

Definition at line 31 of file Preprocessor.php.

Referenced by Preprocessor_Hash\preprocessToObj().

◆ DOM_UNCACHED

const Preprocessor::DOM_UNCACHED = 4

Preprocessor cache bypass flag for Preprocessor::preprocessToObj.

Definition at line 33 of file Preprocessor.php.


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