| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Ext; |
| 5 |
|
| 6 |
use Wikimedia\Parsoid\DOM\Element; |
| 7 |
use Wikimedia\Parsoid\DOM\Node; |
| 8 |
use Wikimedia\Parsoid\Utils\WTUtils as WTU; |
| 9 |
|
| 10 |
/** |
| 11 |
* This class provides helpers needed by extensions. |
| 12 |
* These helpers help with extracting wikitext information from the DOM. |
| 13 |
*/ |
| 14 |
class WTUtils { |
| 15 |
|
| 16 |
/** |
| 17 |
* Is $node a sealed DOMFragment of a specific extension? |
| 18 |
*/ |
| 19 |
public static function isSealedFragmentOfType( Node $node, string $name ): bool { |
| 20 |
return WTU::isSealedFragmentOfType( $node, $name ); |
| 21 |
} |
| 22 |
|
| 23 |
public static function hasVisibleCaption( Element $node ): bool { |
| 24 |
return WTU::hasVisibleCaption( $node ); |
| 25 |
} |
| 26 |
|
| 27 |
public static function textContentFromCaption( Node $node ): string { |
| 28 |
return WTU::textContentFromCaption( $node ); |
| 29 |
} |
| 30 |
|
| 31 |
public static function fromEncapsulatedContent( Node $node ): bool { |
| 32 |
return WTU::fromEncapsulatedContent( $node ); |
| 33 |
} |
| 34 |
} |