3 namespace MediaWiki\Tidy
;
5 use Wikimedia\RemexHtml\TreeBuilder\Marker
;
6 use Wikimedia\RemexHtml\TreeBuilder\TreeBuilder
;
11 class RemexCompatBuilder
extends TreeBuilder
{
12 public function reconstructAFE( $sourceStart ) {
13 // These checks are redundant with the parent, but here for performance
14 $entry = $this->afe
->getTail();
15 if ( !$entry ||
$entry instanceof Marker ||
$entry->stackIndex
!== null ) {
19 // Don't reconstruct AFE in file figures to respect the spec,
20 // https://www.mediawiki.org/wiki/Specs/HTML#Media
21 $len = $this->stack
->length();
23 $i = $this->stack
->item( $len - 1 );
24 if ( $i->htmlName
=== 'figcaption' ) {
27 if ( $i->htmlName
=== 'figure' ) {
28 foreach ( $i->attrs
->getValues() as $k => $v ) {
29 if ( $k === 'typeof' && preg_match( '/\bmw:File\b/', $v ) ) {
37 parent
::reconstructAFE( $sourceStart );