(bug 17865) Add a "ParserAfterParse" hook
authorBrad Jorsch <anomie.wikipedia@gmail.com>
Sun, 17 Jun 2012 00:34:36 +0000 (20:34 -0400)
committerReedy <reedy@wikimedia.org>
Wed, 4 Jul 2012 21:33:19 +0000 (22:33 +0100)
In order to correctly output an error message that might contain
wikilinks, Cite.php needs a hook that is called after the page is parsed
but before the call to replaceLinkHolders().

Change-Id: Iaa2755f994edb081eb1d176f632f7add41640dbf

RELEASE-NOTES-1.20
docs/hooks.txt
includes/parser/Parser.php

index 75d7704..002d177 100644 (file)
@@ -84,6 +84,9 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki.
   "mw-changeslist-line-watched" or "mw-changeslist-line-not-watched", and the
   title itself is surrounded by <span></span> tags with class "mw-title".
 * Added ContribsPager::reallyDoQuery hook allowing extensions to data to MyContribs
+* Added new hook ParserAfterParse to allow extensions to affect parsed output
+  after the parse is complete but before block level processing, link holder
+  replacement, and so on.
 
 === Bug fixes in 1.20 ===
 * (bug 30245) Use the correct way to construct a log page title.
index 9dec097..5bc70c8 100644 (file)
@@ -1470,6 +1470,12 @@ A parser extension which depends on user options should install
 this hook and append its values to the key.
 $hash: reference to a hash key string which can be modified
 
+'ParserAfterParse': Called from Parser::parse() just after the call to
+Parser::internalParse() returns
+$parser: parser object
+$text: text being parsed
+$stripState: stripState used (object)
+
 'ParserAfterStrip': Same as ParserBeforeStrip
 
 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse()
index 7bd2aab..74d1006 100644 (file)
@@ -364,6 +364,7 @@ class Parser {
                # No more strip!
                wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) );
                $text = $this->internalParse( $text );
+               wfRunHooks( 'ParserAfterParse', array( &$this, &$text, &$this->mStripState ) );
 
                $text = $this->mStripState->unstripGeneral( $text );