From 3d474cae600701305f4bff6ccb03ff154dca81f0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Sat, 16 Jun 2012 20:34:36 -0400 Subject: [PATCH] (bug 17865) Add a "ParserAfterParse" hook 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 | 3 +++ docs/hooks.txt | 6 ++++++ includes/parser/Parser.php | 1 + 3 files changed, 10 insertions(+) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 75d770463d..002d177b68 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -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 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. diff --git a/docs/hooks.txt b/docs/hooks.txt index 9dec097489..5bc70c8749 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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() diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7bd2aabddc..74d1006b13 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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 ); -- 2.20.1