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
This commit is contained in:
cenarium 2016-02-06 13:24:58 +01:00 committed by Alex Monk
parent f7d5029426
commit 71889ff017
3 changed files with 15 additions and 2 deletions

View file

@ -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<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;
}

View file

@ -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."
}

View file

@ -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"
}