mediawiki-extensions-Cite/src/Parsoid/RefProcessor.php
C. Scott Ananian 51c211047a All extension DOM processors should extend Ext\DOMProcessor
Change-Id: Ide9700747b3ecea9da59911c6eb342569be4c9b8
2020-05-03 21:15:41 +00:00

30 lines
678 B
PHP

<?php
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 extends DOMProcessor {
/**
* @inheritDoc
*/
public function wtPostprocess(
ParsoidExtensionAPI $extApi, DOMElement $body, array $options, bool $atTopLevel
): void {
if ( $atTopLevel ) {
$refsData = new ReferencesData();
References::processRefs( $extApi, $refsData, $body );
References::insertMissingReferencesIntoDOM( $extApi, $refsData, $body );
}
}
// FIXME: should implement an htmlPreprocess method as well.
}