Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
RefProcessor
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 wtPostprocess
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 htmlPreprocess
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace Cite\Parsoid;
5
6use Wikimedia\Parsoid\DOM\Element;
7use Wikimedia\Parsoid\DOM\Node;
8use Wikimedia\Parsoid\Ext\DOMProcessor;
9use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
10
11/**
12 * wt -> html DOM PostProcessor
13 * @license GPL-2.0-or-later
14 */
15class RefProcessor extends DOMProcessor {
16
17    /**
18     * @inheritDoc
19     */
20    public function wtPostprocess(
21        ParsoidExtensionAPI $extApi, Node $node, array $options
22    ): void {
23        $refsData = new ReferencesData();
24        References::processRefs( $extApi, $refsData, $node );
25        References::insertMissingReferencesIntoDOM( $extApi, $refsData, $node );
26        if ( $refsData->embeddedErrors ) {
27            References::addEmbeddedErrors( $extApi, $refsData, $node );
28        }
29    }
30
31    /**
32     * html -> wt DOM PreProcessor
33     *
34     * Nothing to do right now.
35     *
36     * But, for example, as part of some future functionality, this could be used to
37     * reconstitute page-level information from local annotations left behind by editing clients.
38     */
39    public function htmlPreprocess( ParsoidExtensionAPI $extApi, Element $root ): void {
40        // TODO
41    }
42}