When adding strip markers, allow closures to be passed in place of text.
The closure is then called during unstrip. Also, add a hook that runs
after unstripGeneral. This is needed for Extension:Cite's I0e136f952.
Change-Id: If83b0623671fd67e5ccc9deaaaab456a6679af8f
$parser: Parser object being used
$text: text that will be returned
+'ParserAfterUnstrip': Called after the first unstripGeneral() in Parser::internalParseHalfParsed()
+$parser: Parser object being used
+$text: text that will be returned
+
'ParserBeforeInternalParse': Called at the beginning of Parser::internalParse().
$parser: Parser object
$text: text to parse
$text = $this->mStripState->unstripGeneral( $text );
+ if ( $isMain ) {
+ Hooks::run( 'ParserAfterUnstrip', array( &$this, &$text ) );
+ }
+
# Clean up special characters, only run once, next-to-last before doBlockLevels
$fixtags = array(
# french spaces, last one Guillemet-left
}
$this->circularRefGuard[$marker] = true;
$this->recursionLevel++;
- $ret = $this->unstripType( $this->tempType, $this->data[$this->tempType][$marker] );
+ $value = $this->data[$this->tempType][$marker];
+ if ( $value instanceof Closure ) {
+ $value = $value();
+ }
+ $ret = $this->unstripType( $this->tempType, $value );
$this->recursionLevel--;
unset( $this->circularRefGuard[$marker] );
return $ret;