Adding cite error ref in reference with mismatched group

Bug: T51538
Change-Id: I5492dbaebb7bca79e83be09fdcfe810eaef8c053
This commit is contained in:
sbailey 2020-11-19 10:22:01 -08:00 committed by jenkins-bot
parent 680df4379c
commit 703dc8dc05

View file

@ -111,6 +111,7 @@ class References extends ExtensionTagHandler {
ParsoidExtensionAPI $extApi, DOMElement $node, ReferencesData $refsData
): void {
$doc = $node->ownerDocument;
$errs = [];
// This is data-parsoid from the dom fragment node that's gone through
// dsr computation and template wrapping.
@ -143,6 +144,13 @@ class References extends ExtensionTagHandler {
// elt has a group attribute, what takes precedence?
$groupName = $refDmw->attrs->group ?? $refsData->referencesGroup;
if (
$refsData->inReferencesContent() &&
$groupName !== $refsData->referencesGroup
) {
$errs[] = [ 'key' => 'cite_error_references_group_mismatch' ];
}
// NOTE: This will have been trimmed in Utils::getExtArgInfo()'s call
// to TokenUtils::kvToHash() and ExtensionHandler::normalizeExtOptions()
$refName = $refDmw->attrs->name ?? '';
@ -163,7 +171,6 @@ class References extends ExtensionTagHandler {
$linkBack = $doc->createElement( 'sup' );
$ref = null;
$errs = [];
$hasRefName = strlen( $refName ) > 0;
$hasFollow = strlen( $followName ) > 0;