diff --git a/src/Parsoid/Cite.php b/src/Parsoid/Cite.php index 0f717f4cd..ce8f5f2df 100644 --- a/src/Parsoid/Cite.php +++ b/src/Parsoid/Cite.php @@ -17,8 +17,7 @@ class Cite implements ExtensionModule { return [ 'name' => 'Cite', 'domProcessors' => [ - 'wt2htmlPostProcessor' => RefProcessor::class, - 'html2wtPreProcessor' => [ self::class, 'html2wtPreProcessor' ], + RefProcessor::class, ], 'tags' => [ [ diff --git a/src/Parsoid/RefProcessor.php b/src/Parsoid/RefProcessor.php index c7b76f3b5..149aa8f18 100644 --- a/src/Parsoid/RefProcessor.php +++ b/src/Parsoid/RefProcessor.php @@ -4,35 +4,26 @@ declare( strict_types = 1 ); namespace Wikimedia\Parsoid\Ext\Cite; use DOMElement; +use Wikimedia\Parsoid\Ext\DOMProcessor; use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI; /** * wt -> html DOM PostProcessor */ -class RefProcessor { - /** @var ParsoidExtensionAPI Provides post-processing support */ - private $extApi; +class RefProcessor extends DOMProcessor { /** - * @param ParsoidExtensionAPI $extApi + * @inheritDoc */ - public function __construct( ParsoidExtensionAPI $extApi ) { - $this->extApi = $extApi; - } - - /** - * @param ParsoidExtensionAPI $extApi - * @param DOMElement $body - * @param array $options - * @param bool $atTopLevel - */ - public function run( + public function wtPostprocess( ParsoidExtensionAPI $extApi, DOMElement $body, array $options, bool $atTopLevel ): void { if ( $atTopLevel ) { $refsData = new ReferencesData(); - References::processRefs( $this->extApi, $refsData, $body ); - References::insertMissingReferencesIntoDOM( $this->extApi, $refsData, $body ); + References::processRefs( $extApi, $refsData, $body ); + References::insertMissingReferencesIntoDOM( $extApi, $refsData, $body ); } } + + // FIXME: should implement an htmlPreprocess method as well. }