Manual:Hooks/ParserAfterStrip
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.36.0</tvar> (after being deprecated in <tvar name=4>1.14.0</tvar>).</translate> Since the parser rewrite in MW 1.14, this function now behaves identically to ParserBeforeStrip and no longer has special tags (e.g. nowiki, pre, etc.) stripped out first mailarchive:wikitech-l/2009-October/045577.html. If you need to process the stripped content, then the InternalParseBeforeLinks hook might be a good alternative. |
ParserAfterStrip | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 622618)</tvar></translate> | |
<translate> Define function:</translate> | public static function onParserAfterStrip( &$parser, &$text, &$strip_state ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"ParserAfterStrip": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserAfterStrip"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> parser/Parser.php |
<translate> Interface:</translate> | ParserAfterStripHook.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:ParserAfterStrip extensions</tvar>.</translate>
This hook functions identically to ParserBeforeStrip , except it fires after various non-expandable elements (e.g. <nowiki>
, HTML comments, etc.) have been stripped from the text.
As of MW 1.14, the hook was deprecated. From this point there is no difference at all between this and ParserBeforeStrip . The hook was removed altogether in MW 1.36.
If you need to apply transformations to the wiki text after the non-expandable elements have been stripped, then you should investigate the InternalParseBeforeLinks. It is not a direct replacement (there are some restrictions on what you can do) but it should handle the majority of use-cases that genuinely need this specific hook.