If there's no main <references /> block on the page, show one automatically below the content

Rather than showing an error

Bug: 66860
Change-Id: I9c7c13269d5ec355ccb280402aa8c0cedd208883
This commit is contained in:
Alex Monk 2014-06-23 22:42:17 +01:00
parent 02b5cd9030
commit 798b453771
3 changed files with 13 additions and 11 deletions

View file

@ -1071,11 +1071,10 @@ class Cite {
if ( count( $refs ) == 0 ) {
continue;
}
$text .= "\n<br />";
if ( $group == CITE_DEFAULT_GROUP ) {
$text .= $this->error( 'cite_error_refs_without_references' );
$text .= $this->referencesFormat( $group, '', '' );
} else {
$text .= $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
$text .= "\n<br />" . $this->error( 'cite_error_group_refs_without_references', htmlspecialchars( $group ) );
}
}
return true;

View file

@ -9,9 +9,11 @@ Simple <ref>, no <references/>
!! input
Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
!! result
<p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
<br /><strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
</p>
Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
</li>
</ol>
!! end
!! test
@ -141,9 +143,11 @@ Templating<ref>Text<!--comment--></ref>
!! input
{{REVISIONID}}<ref>elite</ref>
!! result
<p>1337<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
<br /><strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
</p>
1337<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">elite</span>
</li>
</ol>
!! end
!! test

View file

@ -14,7 +14,6 @@
"cite_error_no_link_label_group": "Ran out of custom link labels for group \"$1\".\nDefine more in the <nowiki>[[MediaWiki:$2]]</nowiki> message.",
"cite_error_references_no_text": "Invalid <code>&lt;ref&gt;</code> tag;\nno text was provided for refs named <code>$1</code>",
"cite_error_included_ref": "Closing <code>&lt;/ref&gt;</code> missing for <code>&lt;ref&gt;</code> tag",
"cite_error_refs_without_references": "<code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found",
"cite_error_group_refs_without_references": "<code>&lt;ref&gt;</code> tags exist for a group named \"$1\", but no corresponding <code>&lt;references group=\"$1\"/&gt;</code> tag was found, or a closing <code>&lt;/ref&gt;</code> is missing",
"cite_error_references_group_mismatch": "<code>&lt;ref&gt;</code> tag in <code>&lt;references&gt;</code> has conflicting group attribute \"$1\".",
"cite_error_references_missing_group": "<code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> has group attribute \"$1\" which does not appear in prior text.",
@ -38,4 +37,4 @@
"cite_references_link_many_accessibility_label": "Jump up to:",
"cite_references_prefix": "<ol class=\"references\">",
"cite_references_suffix": "</ol>"
}
}