Manual:Hooks/InternalParseBeforeSanitize
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.40.0</tvar> (after being deprecated in <tvar name=4>1.35.0</tvar>).</translate> Use an alternative hook which doesn't expose internal half-parsed state, like ParserBeforeInternalParse or ParserAfterTidy |
InternalParseBeforeSanitize | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 860937)</tvar></translate> This hook is called during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. | |
<translate> Define function:</translate> | public static function onInternalParseBeforeSanitize( Parser &$parser, &$text, StripState &$stripState ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"InternalParseBeforeSanitize": "MediaWiki\\Extension\\MyExtension\\Hooks::onInternalParseBeforeSanitize"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> parser/Parser.php |
<translate> Interface:</translate> | InternalParseBeforeSanitizeHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:InternalParseBeforeSanitize extensions</tvar>.</translate>
This hook wass ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.