| 1 |
<?php |
| 2 |
declare( strict_types=1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Wt2Html\DOM\Processors; |
| 5 |
|
| 6 |
use Wikimedia\Parsoid\Config\Env; |
| 7 |
use Wikimedia\Parsoid\DOM\Node; |
| 8 |
use Wikimedia\Parsoid\Wt2Html\Wt2HtmlDOMProcessor; |
| 9 |
|
| 10 |
class WrapAnnotations implements Wt2HtmlDOMProcessor { |
| 11 |
|
| 12 |
/** |
| 13 |
* Encapsulate template-affected DOM structures by wrapping text nodes into |
| 14 |
* spans and adding RDFa attributes to all subtree roots according to |
| 15 |
* http://www.mediawiki.org/wiki/Parsoid/RDFa_vocabulary#Template_content |
| 16 |
* @inheritDoc |
| 17 |
*/ |
| 18 |
public function run( |
| 19 |
Env $env, Node $root, array $options = [], bool $atTopLevel = false |
| 20 |
): void { |
| 21 |
if ( $env->hasAnnotations ) { |
| 22 |
$op = new AnnotationDOMRangeBuilder( $root->ownerDocument, $options['frame'] ); |
| 23 |
$op->execute( $root ); |
| 24 |
} |
| 25 |
} |
| 26 |
} |