MediaWiki  master
Preprocessor_Hash Class Reference

Differences from DOM schema: More...

Inheritance diagram for Preprocessor_Hash:
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. More...
- Public Member Functions inherited from Preprocessor
 resetParser (?Parser $parser)
 Allows resetting the internal Parser reference after Preprocessor is cloned. More...

Protected Attributes

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

Additional Inherited Members

- Public Attributes inherited from Preprocessor
Parser $parser
 Transclusion mode flag for Preprocessor::preprocessToObj() More...
 Language conversion construct omission flag for Preprocessor::preprocessToObj() More...
const DOM_UNCACHED = 4
 Preprocessor cache bypass flag for Preprocessor::preprocessToObj. More...

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.

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

Definition at line 43 of file Preprocessor_Hash.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from Preprocessor.

Definition at line 57 of file Preprocessor_Hash.php.

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

Member Function Documentation

◆ newCustomFrame()

Preprocessor_Hash::newCustomFrame (   $args)

Reimplemented from Preprocessor.

Definition at line 78 of file Preprocessor_Hash.php.

References $args.

◆ newFrame()

Preprocessor_Hash::newFrame ( )

Reimplemented from Preprocessor.

Definition at line 70 of file Preprocessor_Hash.php.

◆ newPartNodeArray()

Preprocessor_Hash::newPartNodeArray (   $values)

Reimplemented from Preprocessor.

Definition at line 86 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().

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.

Reimplemented from Preprocessor.

Definition at line 109 of file Preprocessor_Hash.php.

References CACHE_VERSION, Preprocessor\DOM_LANG_CONVERSION_DISABLED, and true.

Member Data Documentation

◆ $cacheThreshold

int false Preprocessor_Hash::$cacheThreshold

Min wikitext size for which to cache DOM tree.

Definition at line 48 of file Preprocessor_Hash.php.


const Preprocessor_Hash::CACHE_VERSION = 4

Cache format version.

Definition at line 45 of file Preprocessor_Hash.php.

Referenced by preprocessToObj().

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