jenkins-bot has submitted this change and it was merged.

Change subject: Display 'cite_error_references_duplicate_key' next to the 
affected ref
......................................................................


Display 'cite_error_references_duplicate_key' next to the affected ref

Follow-up to 5d0fb0309bca864a6680c007eaf03645f590dc58.

Bug: T114898
Change-Id: Id6d0b7f2c0b76b67a50fc981b9255dff99137bed
---
M Cite_body.php
M citeParserTests.txt
2 files changed, 7 insertions(+), 8 deletions(-)

Approvals:
  Alex Monk: Looks good to me, but someone else must approve
  Amire80: Looks good to me, approved
  Eranroz: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/Cite_body.php b/Cite_body.php
index 48b9930..75749c8 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -398,7 +398,7 @@
                if ( $follow != null ) {
                        if ( isset( $this->mRefs[$group][$follow] ) && 
is_array( $this->mRefs[$group][$follow] ) ) {
                                // add text to the note that is being followed
-                               $this->mRefs[$group][$follow]['text'] = 
$this->mRefs[$group][$follow]['text'] . ' ' . $str;
+                               $this->mRefs[$group][$follow]['text'] .= ' ' . 
$str;
                        } else {
                                // insert part of note at the beginning of the 
group
                                $groupsCount = count( $this->mRefs[$group] );
@@ -460,7 +460,8 @@
                } else {
                        if ( $str != null && $str !== '' && $str !== 
$this->mRefs[$group][$key]['text'] ) {
                                // two refs with same key and different content
-                               $this->mReferencesErrors[] = $this->error( 
'cite_error_references_duplicate_key', $key );
+                               // add error message to the original ref
+                               $this->mRefs[$group][$key]['text'] .= ' ' . 
$this->error( 'cite_error_references_duplicate_key', $key );
                        }
                        $this->mRefCallStack[] = array( 'increment', $call, 
$str, $key, $group,
                                $this->mRefs[$group][$key]['key'] );
diff --git a/citeParserTests.txt b/citeParserTests.txt
index d4dc163..b160059 100644
--- a/citeParserTests.txt
+++ b/citeParserTests.txt
@@ -210,11 +210,10 @@
 </p><p><sup id="cite_ref-blank_1-1" class="reference"><a 
href="#cite_note-blank-1">[1]</a></sup>
 </p>
 <ol class="references">
-<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a 
href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a 
href="#cite_ref-blank_1-1">1.1</a></sup></span> <span 
class="reference-text">0</span>
+<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a 
href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a 
href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">0 
<strong class="error mw-ext-cite-error">Cite error: Invalid 
<code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with 
different content</strong></span>
 </li>
 </ol>
-<p><strong class="error mw-ext-cite-error">Cite error: Invalid 
<code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with 
different content</strong>
-</p>
+
 !! end
 
 !! test
@@ -230,11 +229,10 @@
 </p><p><sup id="cite_ref-blank_1-1" class="reference"><a 
href="#cite_note-blank-1">[1]</a></sup>
 </p>
 <ol class="references">
-<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a 
href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a 
href="#cite_ref-blank_1-1">1.1</a></sup></span> <span 
class="reference-text">1</span>
+<li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a 
href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a 
href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">1 
<strong class="error mw-ext-cite-error">Cite error: Invalid 
<code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with 
different content</strong></span>
 </li>
 </ol>
-<p><strong class="error mw-ext-cite-error">Cite error: Invalid 
<code>&lt;ref&gt;</code> tag; name "blank" defined multiple times with 
different content</strong>
-</p>
+
 !! end
 
 !! test

-- 
To view, visit https://gerrit.wikimedia.org/r/244194
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6d0b7f2c0b76b67a50fc981b9255dff99137bed
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Eranroz <eranro...@gmail.com>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to