mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +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 );
|
$this->addEmbeddedErrors( $extApi, $refsData, $domFragment );
|
||||||
return $extApi->domToHtml( $domFragment, true, true );
|
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;
|
$child = $node->firstChild;
|
||||||
while ( $child !== null ) {
|
while ( $child !== null ) {
|
||||||
$nextChild = $child->nextSibling;
|
$nextChild = $child->nextSibling;
|
||||||
if ( $child instanceof Element ) {
|
if ( $child instanceof Element ) {
|
||||||
|
$extApi->processAttributeEmbeddedHTML(
|
||||||
|
$child, $processEmbeddedErrors
|
||||||
|
);
|
||||||
if ( DOMUtils::hasTypeOf( $child, 'mw:Extension/ref' ) ) {
|
if ( DOMUtils::hasTypeOf( $child, 'mw:Extension/ref' ) ) {
|
||||||
$processBodyHtml( $child );
|
|
||||||
$about = DOMCompat::getAttribute( $child, 'about' );
|
$about = DOMCompat::getAttribute( $child, 'about' );
|
||||||
'@phan-var string $about'; // assert $about is non-null
|
'@phan-var string $about'; // assert $about is non-null
|
||||||
$errs = $refsData->embeddedErrors[$about] ?? null;
|
$errs = $refsData->embeddedErrors[$about] ?? null;
|
||||||
if ( $errs ) {
|
if ( $errs ) {
|
||||||
self::addErrorsToNode( $child, $errs );
|
self::addErrorsToNode( $child, $errs );
|
||||||
}
|
}
|
||||||
} elseif ( DOMUtils::hasTypeOf( $child, 'mw:Extension/references' ) ) {
|
|
||||||
$processBodyHtml( $child );
|
|
||||||
} else {
|
|
||||||
$extApi->processAttributeEmbeddedHTML(
|
|
||||||
$child, $processEmbeddedErrors
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ( $child->hasChildNodes() ) {
|
if ( $child->hasChildNodes() ) {
|
||||||
$this->addEmbeddedErrors( $extApi, $refsData, $child );
|
$this->addEmbeddedErrors( $extApi, $refsData, $child );
|
||||||
|
|
Loading…
Reference in a new issue