MediaWiki master
Preprocessor_Hash Class Reference

Differences from DOM schema: More...

Inherits Preprocessor.

Collaboration diagram for Preprocessor_Hash:

Public Member Functions

 __construct (Parser $parser, WANObjectCache $wanCache=null, array $options=[])
 
 newCustomFrame ( $args)
 
 newFrame ()
 
 newPartNodeArray ( $values)
 
 preprocessToObj ( $text, $flags=0)
 Get the document object model for the given wikitext.
 
- Public Member Functions inherited from Preprocessor
 resetParser (?Parser $parser)
 Allows resetting the internal Parser reference after Preprocessor is cloned.
 

Protected Attributes

int false $cacheThreshold
 Min wikitext size for which to cache DOM tree.
 
const CACHE_VERSION = 4
 Cache format version.
 
- Protected Attributes inherited from Preprocessor
bool $disableLangConversion
 Whether language variant conversion is disabled.
 
array $rules
 Brace matching rules.
 
WANObjectCache $wanCache
 

Additional Inherited Members

- Public Attributes inherited from Preprocessor
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.
 

Detailed Description

Differences from DOM schema:

  • attribute nodes are children
  • "<h>" nodes that aren't at the top are replaced with <possible-h>

Nodes are stored in a recursive array data structure. A node store is an array where each element may be either a scalar (representing a text node) or a "descriptor", which is a two-element array where the first element is the node name and the second element is the node store for the children.

Attributes are represented as children that have a node name starting with "@", and a single text node child.

Todo
: Consider replacing descriptor arrays with objects of a new class. Benchmark and measure resulting memory impact.

Definition at line 45 of file Preprocessor_Hash.php.

Constructor & Destructor Documentation

◆ __construct()

Preprocessor_Hash::__construct ( Parser $parser,
WANObjectCache $wanCache = null,
array $options = [] )
See also
Preprocessor::__construct()
Parameters
Parser$parser
WANObjectCache | null$wanCache
array$optionsAdditional options include:
  • cacheThreshold: min text size for which to cache DOMs. [Default: false]

Reimplemented from Preprocessor.

Definition at line 59 of file Preprocessor_Hash.php.

References Preprocessor\$wanCache.

Member Function Documentation

◆ newCustomFrame()

Preprocessor_Hash::newCustomFrame ( $args)
Parameters
array$args
Returns
PPCustomFrame_Hash

Reimplemented from Preprocessor.

Definition at line 80 of file Preprocessor_Hash.php.

◆ newFrame()

Preprocessor_Hash::newFrame ( )
Returns
PPFrame_Hash

Reimplemented from Preprocessor.

Definition at line 72 of file Preprocessor_Hash.php.

◆ newPartNodeArray()

Preprocessor_Hash::newPartNodeArray ( $values)
Parameters
array$values
Returns
PPNode_Hash_Array

Reimplemented from Preprocessor.

Definition at line 88 of file Preprocessor_Hash.php.

◆ preprocessToObj()

Preprocessor_Hash::preprocessToObj ( $text,
$flags = 0 )

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 from Preprocessor.

Definition at line 111 of file Preprocessor_Hash.php.

Member Data Documentation

◆ $cacheThreshold

int false Preprocessor_Hash::$cacheThreshold
protected

Min wikitext size for which to cache DOM tree.

Definition at line 50 of file Preprocessor_Hash.php.

◆ CACHE_VERSION

const Preprocessor_Hash::CACHE_VERSION = 4
protected

Cache format version.

Definition at line 47 of file Preprocessor_Hash.php.


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