Jump to content

手册:Preprocessor.php

From mediawiki.org
This page is a translated version of the page Manual:Preprocessor.php and the translation is 50% complete.

The file Preprocessor.php contains the Preprocessor class for preprocessors, which offers the PPFrame and PPNode interfaces.

Public methods

  • resetParser() - To be removed when support for parser cloning is being phased out. Allows resetting the internal Parser reference after Preprocessor is cloned.

Abstract methods that return frames:

  • newFrame() - create a new top-level frame for expansion of a page.
  • newCustomFrame() - create a new custom frame for programmatic use of parameter replacement. This is useful for certain types of extensions.

Abstract methods that return nodes:

  • newPartNodeArray() - create a new custom node for programmatic use of parameter replacement. This is useful for certain types of extensions.
  • preprocessToObj() - Preprocess text and return a PPNode object. Both this method and Parser::preprocessToDom() , a wrapper for this method, can be used with the following flags (default: 0) :
    • 1 = 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.
    • 2 = DOM_LANG_CONVERSION_DISABLED - Language conversion construct omission flag
    • 4 = DOM_UNCACHED: disable use of the preprocessor cache.

Extended by