(bug 11426) Give error if no text is supplied for a reference. Patch by Thomas Dalton. All parser tests passed.

This commit is contained in:
Aryeh Gregor 2007-09-23 23:38:12 +00:00
parent a5114ab0ec
commit 19d69a96f7
2 changed files with 10 additions and 1 deletions

View file

@ -31,6 +31,7 @@ $wgCiteMessages['en'] = array(
<code>&lt;references /&gt;</code>',
'cite_error_' . CITE_ERROR_REFERENCES_INVALID_PARAMETERS => 'Invalid <code>&lt;references&gt;</code> tag; no parameters are allowed, use <code>&lt;references /&gt;</code>',
'cite_error_' . 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_' . CITE_ERROR_REFERENCES_NO_TEXT => 'No text given.',
/*
Output formatting

View file

@ -44,7 +44,8 @@ $wgCiteErrors = array(
'CITE_ERROR_REF_NO_INPUT',
'CITE_ERROR_REFERENCES_INVALID_INPUT',
'CITE_ERROR_REFERENCES_INVALID_PARAMETERS',
'CITE_ERROR_REFERENCES_NO_BACKLINK_LABEL'
'CITE_ERROR_REFERENCES_NO_BACKLINK_LABEL',
'CITE_ERROR_REFERENCES_NO_TEXT'
)
);
@ -376,6 +377,13 @@ function wfCite() {
$this->refKey( $key ),
$val
);
else if ($val['text']=='') return
wfMsgForContentNoTrans(
'cite_references_link_one',
$this->referencesKey( $key ),
$this->refKey( $key, $val['count'] ),
$this->error(CITE_ERROR_REFERENCES_NO_TEXT)
);
// Standalone named reference, I want to format this like an
// anonymous reference because displaying "1. 1.1 Ref text" is
// overkill and users frequently use named references when they