public $parsers;
public $conf;
public $shortOutput = false;
- public $dtUniqPrefix;
public function __construct( $conf ) {
if ( !isset( $conf['parsers'] ) ) {
return;
}
- global $wgHooks;
- static $doneHook = false;
- if ( !$doneHook ) {
- $doneHook = true;
- $wgHooks['ParserClearState'][] = array( $this, 'onClearState' );
- }
if ( isset( $this->conf['shortOutput'] ) ) {
$this->shortOutput = $this->conf['shortOutput'];
}
$parser->setFunctionHook( $id, $callback, $flags );
}
}
-
- /**
- * @param Parser $parser
- * @return bool
- */
- public function onClearState( &$parser ) {
- // hack marker prefixes to get identical output
- if ( !isset( $this->dtUniqPrefix ) ) {
- $this->dtUniqPrefix = $parser->uniqPrefix();
- } else {
- $parser->mUniqPrefix = $this->dtUniqPrefix;
- }
- return true;
- }
}