mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-09-24 10:48:58 +00:00
Merge "Fix inconsistent error reporting for invisible content"
This commit is contained in:
commit
0d7e04e1ee
|
@ -241,10 +241,7 @@ class Cite {
|
|||
return StatusValue::newFatal( 'cite_error_references_no_key' );
|
||||
}
|
||||
|
||||
// This doesn't catch the null case because that's guaranteed to trigger other errors
|
||||
// FIXME: We allow whitespace-only text, should this be invalid? It leaves a
|
||||
// loophole around the trimmed-text test outside of <references>.
|
||||
if ( $text === '' ) {
|
||||
if ( $text === null || trim( $text ) === '' ) {
|
||||
// <ref> called in <references> has no content.
|
||||
return StatusValue::newFatal(
|
||||
'cite_error_empty_references_define',
|
||||
|
|
|
@ -639,12 +639,43 @@ Attributes are trimmed by the parser, see Sanitizer::decodeTagAttributes()
|
|||
<li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
|
||||
no text was provided for refs named <code>foo</code></span></li>
|
||||
</ol></div>
|
||||
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "unused" defined in <code><references></code> is not used in prior text.</span><br />
|
||||
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> with name "foo" has no content.</span><br />
|
||||
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag with name "unused" defined in <code><references></code> is not used in prior text.</span><br />
|
||||
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag in <code><references></code> has conflicting group attribute "1".</span><br />
|
||||
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> has no name attribute.</span>
|
||||
</p>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Error conditions on non-visible content
|
||||
!! wikitext
|
||||
<ref name="a">x</ref>
|
||||
<ref name="b"> </ref>
|
||||
<ref name="c" />
|
||||
<references>
|
||||
<ref name="a" />
|
||||
<ref name="b" />
|
||||
<ref name="c"> </ref>
|
||||
</references>
|
||||
!! html
|
||||
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup>
|
||||
<sup id="cite_ref-c_3-0" class="reference"><a href="#cite_note-c-3">[3]</a></sup>
|
||||
</p>
|
||||
<div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-a-1"><span class="mw-cite-backlink"><a href="#cite_ref-a_1-0">↑</a></span> <span class="reference-text">x</span>
|
||||
</li>
|
||||
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
|
||||
no text was provided for refs named <code>b</code></span></li>
|
||||
<li id="cite_note-c-3"><span class="mw-cite-backlink"><a href="#cite_ref-c_3-0">↑</a></span> <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag;
|
||||
no text was provided for refs named <code>c</code></span></li>
|
||||
</ol></div>
|
||||
<p><span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> with name "a" has no content.</span><br />
|
||||
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> with name "b" has no content.</span><br />
|
||||
<span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: <code><ref></code> tag defined in <code><references></code> with name "c" has no content.</span>
|
||||
</p>
|
||||
!! end
|
||||
|
||||
!! article
|
||||
MediaWiki:cite_link_label_group-klingon
|
||||
!! text
|
||||
|
|
Loading…
Reference in a new issue