mediawiki-extensions-Cite/tests/parser/citeSmokeTests.txt
Bartosz Dziewoński 3678215a77 Add a newline in wikitext before autogenerated reflist
Previously the reflist was added at the end of the last line of text,
which messes up paragraph wrapping (as seen in many test cases), and
generated invalid HTML when the last line was a list item (T148701).

(second try, previously reverted in 8c933d03c5)

Note this affects only pages where the <references /> tag is missing,
and the references section is auto-generated at the very end of the page.

Bug: T148701
Change-Id: Ib2101346434a4e317b5fc7379215b60c7020cb2b
2020-05-06 20:51:25 +02:00

116 lines
5.5 KiB
Plaintext

!! version 2
!! test
Smoke test for duplicated references with the same text
!! wikitext
<ref name="a">text</ref>
<ref name="a">text</ref>
<ref name="b">other</ref>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text</span>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
</li>
</ol></div>
!! end
!! test
Smoke test for duplicated references with conflicting text
!! wikitext
<ref name="a">text</ref>
<ref name="a">bad</ref>
<ref name="b">other</ref>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code>&lt;ref&gt;</code> tag; name "a" defined multiple times with different content</span></span>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
</li>
</ol></div>
!! end
!! test
Smoke test for references that are reused *before* defined in the text
!! options
language=de
!! wikitext
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a" />
<ref name="a">text</ref>
<ref name="b">other</ref>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-2" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-3" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-4" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-5" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-6" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-7" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-8" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-9" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-10" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1,00</a></sup> <sup><a href="#cite_ref-a_1-1">1,01</a></sup> <sup><a href="#cite_ref-a_1-2">1,02</a></sup> <sup><a href="#cite_ref-a_1-3">1,03</a></sup> <sup><a href="#cite_ref-a_1-4">1,04</a></sup> <sup><a href="#cite_ref-a_1-5">1,05</a></sup> <sup><a href="#cite_ref-a_1-6">1,06</a></sup> <sup><a href="#cite_ref-a_1-7">1,07</a></sup> <sup><a href="#cite_ref-a_1-8">1,08</a></sup> <sup><a href="#cite_ref-a_1-9">1,09</a></sup> <sup><a href="#cite_ref-a_1-10">1,10</a></sup></span> <span class="reference-text">text</span>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
</li>
</ol></div>
!! end
!! test
Smoke test for references that are reused *before* defined in <references>
!! wikitext
<ref name="a" />
<ref name="a" />
<ref name="b">other</ref>
<references>
<ref name="a">text</ref>
</references>
!! html
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">&#91;1&#93;</a></sup>
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">&#91;2&#93;</a></sup>
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text</span>
</li>
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
</li>
</ol></div>
!! end
!! test
T240248: Erroring parser function shouldn't break references
!! wikitext
<ref>something</ref>
{{#ifeq: {{#expr: string < 5 }} | 1 | true | false or error }}
<references />
!! html
<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">&#91;1&#93;</a></sup>
false or error
</p>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">something</span>
</li>
</ol></div>
!! end