2019-04-03 17:16:56 +00:00
|
|
|
<?php
|
2019-05-25 22:24:47 +00:00
|
|
|
declare( strict_types = 1 );
|
2019-04-03 17:16:56 +00:00
|
|
|
|
2020-02-03 18:52:06 +00:00
|
|
|
namespace Wikimedia\Parsoid\Ext\Cite;
|
2019-05-25 22:24:47 +00:00
|
|
|
|
2020-07-28 21:35:18 +00:00
|
|
|
use DOMNode;
|
2020-04-21 23:22:30 +00:00
|
|
|
use Wikimedia\Parsoid\Ext\DOMProcessor;
|
2020-03-04 21:40:55 +00:00
|
|
|
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
2019-04-03 17:16:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wt -> html DOM PostProcessor
|
|
|
|
*/
|
2020-04-21 23:22:30 +00:00
|
|
|
class RefProcessor extends DOMProcessor {
|
2020-01-17 13:12:15 +00:00
|
|
|
|
|
|
|
/**
|
2020-04-21 23:22:30 +00:00
|
|
|
* @inheritDoc
|
2020-01-17 13:12:15 +00:00
|
|
|
*/
|
2020-04-21 23:22:30 +00:00
|
|
|
public function wtPostprocess(
|
2020-07-28 21:35:18 +00:00
|
|
|
ParsoidExtensionAPI $extApi, DOMNode $node, array $options, bool $atTopLevel
|
2019-05-25 22:24:47 +00:00
|
|
|
): void {
|
2019-04-03 17:16:56 +00:00
|
|
|
if ( $atTopLevel ) {
|
2020-02-07 16:17:42 +00:00
|
|
|
$refsData = new ReferencesData();
|
2020-07-28 21:35:18 +00:00
|
|
|
References::processRefs( $extApi, $refsData, $node );
|
|
|
|
References::insertMissingReferencesIntoDOM( $extApi, $refsData, $node );
|
2019-04-03 17:16:56 +00:00
|
|
|
}
|
|
|
|
}
|
2020-04-21 23:22:30 +00:00
|
|
|
|
|
|
|
// FIXME: should implement an htmlPreprocess method as well.
|
2019-04-03 17:16:56 +00:00
|
|
|
}
|