From 703dc8dc0529632772dce0a5dcc4053e7ad42f39 Mon Sep 17 00:00:00 2001 From: sbailey Date: Thu, 19 Nov 2020 10:22:01 -0800 Subject: [PATCH] Adding cite error ref in reference with mismatched group Bug: T51538 Change-Id: I5492dbaebb7bca79e83be09fdcfe810eaef8c053 --- src/Parsoid/References.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Parsoid/References.php b/src/Parsoid/References.php index 752a86078..357505967 100644 --- a/src/Parsoid/References.php +++ b/src/Parsoid/References.php @@ -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;