mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Remove redundant embedded attr processor
Use the standard one defined for processAttributeEmbeddedHTML by these extension tags. Change-Id: I47a713a8536ddc57a32842afcd40f36854533ab4
This commit is contained in:
parent
b440abc913
commit
20a1448e59
|
@ -707,32 +707,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 );
|
||||
|
|
Loading…
Reference in a new issue