Manual:Hooks/ParserBeforeTidy

Category:MediaWiki hooks#ParserBeforeTidy Category:Hooks added in MediaWiki 1.5.0#ParserBeforeTidy Category:MediaWiki deprecated or obsolete features#ParserBeforeTidy Category:Hooks removed in MediaWiki 1.36.0#ParserBeforeTidy Category:Hooks deprecated in MediaWiki 1.35.0#ParserBeforeTidy
ParserBeforeTidy
Available from version 1.5.0
Removed in version 1.36.0 (Gerrit change 619861)Category:Removed hooks#ParserBeforeTidy
Used to process the nearly-rendered HTML code for the page (but before any HTML-tidying occurs)
Define function:
public static function onParserBeforeTidy( Parser &$parser, string &$text ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ParserBeforeTidy": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserBeforeTidy"
	}
}
Called from: File(s): parser/Parser.phpCategory:MediaWiki hooks included in Parser.php#ParserBeforeTidy
Function(s): internalParseHalfParsed
Interface: ParserBeforeTidyHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ParserBeforeTidy extensions.

Details

This hook allows to intercept processing after all HTML has been generated but before it has been standardized (via RemexHtml).

  • $parser: Parser object
  • &$text: Actual text as a string

Example

$text will hold the text for the page. To change the page text, modify this value. E.g. to add the phrase "The mighty oracle gives forth this proclamation: " to the front of the page text, you would use the following code:

$text = "The mighty oracle gives forth this proclamation: " . $text;

See also

Category:Hooks added in MediaWiki 1.5.0 Category:Hooks deprecated in MediaWiki 1.35.0 Category:Hooks removed in MediaWiki 1.36.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in Parser.php Category:Removed hooks