diff --git a/Cite_body.php b/Cite_body.php index 79a8176e0..d7850e2a0 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -1106,17 +1106,28 @@ class Cite { } $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
" . + $s .= "\n
" . $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ) ); } } + if ( $isSectionPreview && $s !== '' ) { + $text .= "\n" + . '' + . "

" . wfMessage( 'cite_section_preview_references' )->escaped() . "

" + . $s + . '
'; + } else { + $text .= $s; + } return true; } diff --git a/i18n/en.json b/i18n/en.json index 2731396c4..04f2f6040 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": "
    ", "cite_references_suffix": "
", + "cite_section_preview_references": "Preview of references", "cite_warning": "Cite warning: $1", "cite_warning_sectionpreview_no_text": "<ref> tag with name $1 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 8c430caac..9a9a33457 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 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" }