mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Improve clarity of error message when no text is given for a reference.
This commit is contained in:
parent
cae7b7460c
commit
a03e2a48d5
|
@ -27,7 +27,7 @@ $messages['en'] = array(
|
|||
<code><references /></code>',
|
||||
'cite_error_references_invalid_parameters' => 'Invalid <code><references></code> tag; no parameters are allowed, use <code><references /></code>',
|
||||
'cite_error_references_no_backlink_label' => "Ran out of custom backlink labels, define more in the \"''cite_references_link_many_format_backlink_labels''\" message",
|
||||
'cite_error_references_no_text' => 'No text given.',
|
||||
'cite_error_references_no_text' => 'Invalid <code><ref></code> tag; no text was provided for refs named <code>$1</code>',
|
||||
|
||||
/*
|
||||
Output formatting
|
||||
|
|
16
Cite.php
16
Cite.php
|
@ -353,7 +353,7 @@ function wfCite() {
|
|||
'cite_references_link_one',
|
||||
$this->referencesKey( $key ),
|
||||
$this->refKey( $key, $val['count'] ),
|
||||
$this->error( 'cite_error_references_no_text' )
|
||||
$this->error( 'cite_error_references_no_text', $key )
|
||||
);
|
||||
// Standalone named reference, I want to format this like an
|
||||
// anonymous reference because displaying "1. 1.1 Ref text" is
|
||||
|
@ -365,7 +365,7 @@ function wfCite() {
|
|||
'cite_references_link_one',
|
||||
$this->referencesKey( $key ),
|
||||
$this->refKey( $key, $val['count'] ),
|
||||
( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text' ) )
|
||||
( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key ) )
|
||||
);
|
||||
// Named references with >1 occurrences
|
||||
else {
|
||||
|
@ -386,7 +386,7 @@ function wfCite() {
|
|||
wfMsgForContentNoTrans( 'cite_references_link_many',
|
||||
$this->referencesKey( $key ),
|
||||
$list,
|
||||
( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text' ) )
|
||||
( $val['text'] != '' ? $val['text'] : $this->error( 'cite_error_references_no_text', $key ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -619,14 +619,18 @@ function wfCite() {
|
|||
/**
|
||||
* Return an error message based on an error ID
|
||||
*
|
||||
* @param string $key Message name for the error
|
||||
* @param string $key Message name for the error
|
||||
* @param string $param Parameter to pass to the message
|
||||
* @return string XHTML ready for output
|
||||
*/
|
||||
function error( $key ) {
|
||||
function error( $key, $param=null ) {
|
||||
# We rely on the fact that PHP is okay with passing unused argu-
|
||||
# ments to functions. If $1 is not used in the message, wfMsg will
|
||||
# just ignore the extra parameter.
|
||||
return
|
||||
$this->parse(
|
||||
'<strong class="error">' .
|
||||
wfMsg( 'cite_error', wfMsg( $key ) ) .
|
||||
wfMsg( 'cite_error', wfMsg( $key, $param ) ) .
|
||||
'</strong>'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -236,8 +236,8 @@ Erroneous refs
|
|||
</p><p><strong class="error">Cite error: Invalid <code><references></code> tag; no parameters are allowed, use <code><references /></code></strong>
|
||||
</p>
|
||||
<ol class="references"><li id="_note-0"><a href="#_ref-0" title="">↑</a> Also zero, but differently! (Normal ref)</li>
|
||||
<li id="_note-bar"><a href="#_ref-bar_0" title="">↑</a> <strong class="error">Cite error: No text given.</strong></li>
|
||||
<li id="_note-blankwithnoreference"><a href="#_ref-blankwithnoreference_0" title="">↑</a> <strong class="error">Cite error: No text given.</strong></li></ol>
|
||||
<li id="_note-bar"><a href="#_ref-bar_0" title="">↑</a> <strong class="error">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>bar</code></strong></li>
|
||||
<li id="_note-blankwithnoreference"><a href="#_ref-blankwithnoreference_0" title="">↑</a> <strong class="error">Cite error: Invalid <code><ref></code> tag; no text was provided for refs named <code>blankwithnoreference</code></strong></li></ol>
|
||||
|
||||
!! end
|
||||
|
||||
|
|
Loading…
Reference in a new issue