Cenarium has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268870

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.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/70/268870/1

diff --git a/Cite_body.php b/Cite_body.php
index 79a8176..04ea6f1 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -1105,13 +1105,30 @@
                        return true;
                }
 
-               $isSectionPreview = 
$parser->getOptions()->getIsSectionPreview();
+               if ( $parser->getOptions()->getIsSectionPreview() ) {
+                       $s = '';
+                       foreach ( $this->mRefs as $group => $refs ) {
+                               if ( !$refs ) {
+                                       continue;
+                               }
+                               $s .= $this->referencesFormat( $group );
+                       }
+                       if ( $s === '' ) {
+                               return true;
+                       }
+                       // add preview of references in its own section
+                       // to make it apparent that this isn't part of the 
preview of the section itself
+                       $text .= "\n" . '<span 
class="mw-ext-cite-section_preview_refs" >'
+                               . "<h2>" . wfMessage( 
'cite_section_preview_refs' )->parse() . "</h2>" . $s . '</span>';
+                       return true;
+               }
+
                foreach ( $this->mRefs as $group => $refs ) {
                        if ( !$refs ) {
                                continue;
                        }
-                       if ( $group === self::DEFAULT_GROUP || 
$isSectionPreview ) {
-                               $text .= $this->referencesFormat( $group, '', 
'' );
+                       if ( $group === self::DEFAULT_GROUP ) {
+                               $text .= $this->referencesFormat( $group );
                        } else {
                                $text .= "\n<br />" .
                                        $this->error( 
'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
diff --git a/i18n/en.json b/i18n/en.json
index 2731396..e735b40 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_refs": "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..25629ba 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_refs": "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: newchange
Gerrit-Change-Id: I62c8dca8ee42e79c6b7cd7f837f4e7ee65f77770
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Cenarium <cenarium.sy...@gmail.com>

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

Reply via email to