Merge "Remove redundant embedded attr processor"

This commit is contained in:
jenkins-bot 2024-11-12 17:30:37 +00:00 committed by Gerrit Code Review
commit 6c92ce560b

View file

@ -721,32 +721,20 @@ class References extends ExtensionTagHandler {
$this->addEmbeddedErrors( $extApi, $refsData, $domFragment );
return $extApi->domToHtml( $domFragment, true, true );
};
$processBodyHtml = static function ( Element $n ) use ( $processEmbeddedErrors ) {
$dataMw = DOMDataUtils::getDataMw( $n );
if ( isset( $dataMw->body->html ) ) {
$dataMw->body->html = $processEmbeddedErrors(
$dataMw->body->html
);
}
};
$child = $node->firstChild;
while ( $child !== null ) {
$nextChild = $child->nextSibling;
if ( $child instanceof Element ) {
$extApi->processAttributeEmbeddedHTML(
$child, $processEmbeddedErrors
);
if ( DOMUtils::hasTypeOf( $child, 'mw:Extension/ref' ) ) {
$processBodyHtml( $child );
$about = DOMCompat::getAttribute( $child, 'about' );
'@phan-var string $about'; // assert $about is non-null
$errs = $refsData->embeddedErrors[$about] ?? null;
if ( $errs ) {
self::addErrorsToNode( $child, $errs );
}
} elseif ( DOMUtils::hasTypeOf( $child, 'mw:Extension/references' ) ) {
$processBodyHtml( $child );
} else {
$extApi->processAttributeEmbeddedHTML(
$child, $processEmbeddedErrors
);
}
if ( $child->hasChildNodes() ) {
$this->addEmbeddedErrors( $extApi, $refsData, $child );