Manual talk:Hooks/ParserBeforeStrip

Sanity Check
This hook runs twice (possibly more). To prevent this from happening, just add the following to fnMyHook:

-- Egingell 13:29, 16 August 2007 (UTC)


 * I believe this happens because certain user interface messages go through the parser. Therefore it is run once for the page content, and then however many more times for various UI messages.  I am not 100% sure about this however, so perhaps a bit more investigation is required.  Assuming I am right, then the above code will be useful for extensions where it is important that they only run once per page view, but for most other situations the standard behaviour will cause no problems. --HappyDog 15:03, 27 August 2007 (UTC)

ParserBeforeStrip hook is not always called before strip
I'm using the ParserBeforeStrip hook in a math extension (JsMath) to strip any   tags before the parser strips them. The problem I am having is that the parser sometimes calls the strip command without using this hook. For example, in the function Parser::braceSubstitution there is

instead of

This means that content that is transcluded to another page is not subjected to the ParserBeforeStrip hook before stripping occurs. Is there a reason for the parser not to use this hook in these cases? &mdash; Tommy Ekola 09:29, 5 February 2008 (UTC)