Chad has uploaded a new change for review. https://gerrit.wikimedia.org/r/89013
Change subject: Add new hook ParserBeforePreprocess ...................................................................... Add new hook ParserBeforePreprocess Allows extensions to modify text prior to it being preprocessed to the DOM. RFC: https://www.mediawiki.org/wiki/Requests_for_comment/New_hook:_ParserBeforePreprocess Change-Id: I227b3bb2bc8fa421e9253e484e880fc17d10d0bc --- M docs/hooks.txt M includes/parser/Parser.php M tests/phpunit/phpunit.php 3 files changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/13/89013/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index 2d1001b..41eebbb 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1787,6 +1787,11 @@ $text: text to parse $stripState: StripState instance being used +'ParserBeforePreprocess': Called before preprocessing text +$parser: Parser object +$text: text to preprocess +$flags: bit flags for preprocessing + 'ParserBeforeStrip': Called at start of parsing time. TODO: No more strip, deprecated ? $parser: parser object diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index eac2202..88eb6fe 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3084,6 +3084,7 @@ * @return PPNode */ function preprocessToDom( $text, $flags = 0 ) { + wfRunHooks( 'ParserBeforePreprocess', array( $this, &$text, $flags ) ); $dom = $this->getPreprocessor()->preprocessToObj( $text, $flags ); return $dom; } diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 1d65e52..e91f5cd 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -11,6 +11,8 @@ // Set a flag which can be used to detect when other scripts have been entered through this entry point or not define( 'MW_PHPUNIT_TEST', true ); +set_include_path( get_include_path() . PATH_SEPARATOR . '/usr/local/share/pear/' ); + // Start up MediaWiki in command-line mode require_once dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php"; -- To view, visit https://gerrit.wikimedia.org/r/89013 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I227b3bb2bc8fa421e9253e484e880fc17d10d0bc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Chad <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
