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

Change subject: In section preview, add preview of references to its own section
......................................................................


In section preview, add preview of references to its own section

This is to make it apparent that this isn't part of the preview
of the section itself. A span class is also added.

Bug: T125981
Change-Id: I62c8dca8ee42e79c6b7cd7f837f4e7ee65f77770
---
M Cite_body.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Cite_body.php b/Cite_body.php
index 79a8176..d7850e2 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -1106,17 +1106,28 @@
                }
 
                $isSectionPreview = 
$parser->getOptions()->getIsSectionPreview();
+
+               $s = '';
                foreach ( $this->mRefs as $group => $refs ) {
                        if ( !$refs ) {
                                continue;
                        }
                        if ( $group === self::DEFAULT_GROUP || 
$isSectionPreview ) {
-                               $text .= $this->referencesFormat( $group, '', 
'' );
+                               $s .= $this->referencesFormat( $group );
                        } else {
-                               $text .= "\n<br />" .
+                               $s .= "\n<br />" .
                                        $this->error( 
'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
                        }
                }
+               if ( $isSectionPreview && $s !== '' ) {
+                       $text .= "\n"
+                               . '<span 
class="mw-ext-cite-cite_section_preview_references" >'
+                               . "<h2>" . wfMessage( 
'cite_section_preview_references' )->escaped() . "</h2>"
+                               . $s
+                               . '</span>';
+               } else {
+                       $text .= $s;
+               }
                return true;
        }
 
diff --git a/i18n/en.json b/i18n/en.json
index 2731396..04f2f60 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -53,6 +53,7 @@
        "cite_references_link_many_accessibility_label": "Jump up to:",
        "cite_references_prefix": "<ol class=\"references\">",
        "cite_references_suffix": "</ol>",
+       "cite_section_preview_references": "Preview of references",
        "cite_warning": "Cite warning: $1",
        "cite_warning_sectionpreview_no_text": "<code>&lt;ref&gt;</code> tag 
with name <code>$1</code> cannot be previewed because it is defined outside the 
current section or not defined at all."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 8c430ca..9a9a334 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -53,6 +53,7 @@
        "cite_references_link_many_accessibility_label": "Text for screen 
readers to describe the jump to citation links (a b c ...) for citations which 
are used in multiple places.\n\nThis is going to be prepended to the first 
link, the following ones will just be read by screen readers as they are 
visible.\n\nSee also:\n* {{msg-mw|Cite references link accessibility label}} - 
if the citation is used one time",
        "cite_references_prefix": "{{notranslate}}",
        "cite_references_suffix": "{{notranslate}}",
+       "cite_section_preview_references": "Header for the section providing a 
preview of references in section preview",
        "cite_warning": "Cite extension.\n\nUsed when there are warnings about 
ref or references tags (less severe than errors).\n\nParameters:\n* $1 - a 
warning message",
        "cite_warning_sectionpreview_no_text": "Cite extension. This warning 
occurs when the tag <code><nowiki><ref name=\"something\" /></nowiki></code> is 
used with the name-option specified but the definition for this named ref is 
outside of the currently being previewed section, or not defined at 
all.\n\nParameters:\n* $1 - key of the ref"
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I62c8dca8ee42e79c6b7cd7f837f4e7ee65f77770
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Cenarium <cenarium.sy...@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Cenarium <cenarium.sy...@gmail.com>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: WMDE-Fisch <christoph.fisc...@wikimedia.de>
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