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
|
|
|
|
2019-05-25 22:24:47 +00:00
|
|
|
namespace Parsoid\Ext\Cite;
|
|
|
|
|
|
|
|
use DOMElement;
|
|
|
|
use Parsoid\Config\Env;
|
2019-04-03 17:16:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wt -> html DOM PostProcessor
|
|
|
|
*/
|
|
|
|
class RefProcessor {
|
2019-05-25 22:24:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param DOMElement $body
|
|
|
|
* @param Env $env
|
|
|
|
* @param array $options
|
|
|
|
* @param bool $atTopLevel
|
|
|
|
*/
|
|
|
|
public function run(
|
|
|
|
DOMElement $body, Env $env, array $options = [], bool $atTopLevel = false
|
|
|
|
): void {
|
2019-04-03 17:16:56 +00:00
|
|
|
if ( $atTopLevel ) {
|
|
|
|
$refsData = new ReferencesData( $env );
|
2019-05-25 22:24:47 +00:00
|
|
|
References::processRefs( $env, $refsData, $body );
|
2019-04-03 17:16:56 +00:00
|
|
|
References::insertMissingReferencesIntoDOM( $refsData, $body );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|