citeParserTests.txt 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. # Force the test runner to ensure the extension is loaded
  2. !! hooks
  3. ref
  4. references
  5. !! endhooks
  6. !! test
  7. Simple <ref>, no <references/>
  8. !! input
  9. Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
  10. !! result
  11. <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  12. </p>
  13. <br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
  14. !! end
  15. !! test
  16. Simple <ref>, with <references/>
  17. !! input
  18. Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
  19. <references/>
  20. !! result
  21. <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  22. </p>
  23. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
  24. !! end
  25. !! article
  26. Template:Simple template
  27. !! text
  28. A ''simple'' template.
  29. !! endarticle
  30. !! test
  31. <ref> with a simple template
  32. !! input
  33. Templating<ref>{{simple template}}</ref>
  34. <references/>
  35. !! result
  36. <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  37. </p>
  38. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> A <i>simple</i> template.</li></ol>
  39. !! end
  40. !! test
  41. <ref> with a <nowiki>
  42. !! input
  43. Templating<ref><nowiki>{{simple template}}</nowiki></ref>
  44. <references/>
  45. !! result
  46. <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  47. </p>
  48. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> {{simple template}}</li></ol>
  49. !! end
  50. !! test
  51. <ref> in a <nowiki>
  52. !! input
  53. Templating<nowiki><ref>{{simple template}}</ref></nowiki>
  54. <references/>
  55. !! result
  56. <p>Templating&lt;ref&gt;{{simple template}}&lt;/ref&gt;
  57. </p><p><br />
  58. </p>
  59. !! end
  60. !! test
  61. <ref> in a <!--comment-->
  62. !! input
  63. Templating<!--<ref>{{simple template}}</ref>-->
  64. <references/>
  65. !! result
  66. <p>Templating
  67. </p><p><br />
  68. </p>
  69. !! end
  70. !! test
  71. <!--comment--> in a <ref> (bug 5384)
  72. !! input
  73. Templating<ref>Text<!--comment--></ref>
  74. <references/>
  75. !! result
  76. <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  77. </p>
  78. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Text</li></ol>
  79. !! end
  80. !! test
  81. <references> after <gallery> (bug 6164)
  82. !! input
  83. <ref>one</ref>
  84. <gallery>Image:Foobar.jpg</gallery>
  85. <references/>
  86. !! result
  87. <p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  88. </p>
  89. <table class="gallery" cellspacing="0" cellpadding="0">
  90. <tr>
  91. <td><div class="gallerybox" style="width: 155px;">
  92. <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="/wiki/File:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" border="0" /></a></div></div>
  93. <div class="gallerytext">
  94. </div>
  95. </div></td>
  96. </tr>
  97. </table>
  98. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> one</li></ol>
  99. !! end
  100. !! test
  101. {{REVISIONID}} on page with <ref> (bug 6299)
  102. !! input
  103. {{REVISIONID}}<ref>elite</ref>
  104. !! result
  105. <p>1337<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  106. </p>
  107. <br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
  108. !! end
  109. !! test
  110. {{REVISIONID}} on page without <ref> (bug 6299 sanity check)
  111. !! input
  112. {{REVISIONID}}
  113. !! result
  114. <p>1337
  115. </p>
  116. !! end
  117. !! test
  118. Blank ref followed by ref with content
  119. !! input
  120. <ref name="blank"/>
  121. <ref name="blank">content</ref>
  122. <references/>
  123. !! result
  124. <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  125. </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  126. </p>
  127. <ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> content</li></ol>
  128. !! end
  129. !! test
  130. Regression: non-blank ref "0" followed by ref with content
  131. !! input
  132. <ref name="blank">0</ref>
  133. <ref name="blank">content</ref>
  134. <references/>
  135. !! result
  136. <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  137. </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  138. </p>
  139. <ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> 0</li></ol>
  140. !! end
  141. !! test
  142. Regression sanity check: non-blank ref "1" followed by ref with content
  143. !! input
  144. <ref name="blank">1</ref>
  145. <ref name="blank">content</ref>
  146. <references/>
  147. !! result
  148. <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  149. </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
  150. </p>
  151. <ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> 1</li></ol>
  152. !! end
  153. !! test
  154. Ref names containing a number
  155. !! input
  156. <ref name="test123test">One</ref>
  157. <ref name="123test">Two</ref>
  158. <ref name="test123">Three</ref>
  159. <references />
  160. !! result
  161. <p><sup id="cite_ref-test123test_0-0" class="reference"><a href="#cite_note-test123test-0" title="">[1]</a></sup>
  162. <sup id="cite_ref-123test_1-0" class="reference"><a href="#cite_note-123test-1" title="">[2]</a></sup>
  163. <sup id="cite_ref-test123_2-0" class="reference"><a href="#cite_note-test123-2" title="">[3]</a></sup>
  164. </p>
  165. <ol class="references"><li id="cite_note-test123test-0"><a href="#cite_ref-test123test_0-0" title="">↑</a> One</li>
  166. <li id="cite_note-123test-1"><a href="#cite_ref-123test_1-0" title="">↑</a> Two</li>
  167. <li id="cite_note-test123-2"><a href="#cite_ref-test123_2-0" title="">↑</a> Three</li></ol>
  168. !! end
  169. !! test
  170. Erroneous refs
  171. !! input
  172. <ref name="0">Zero</ref>
  173. <ref>Also zero, but differently! (Normal ref)</ref>
  174. <ref />
  175. <ref name="foo" name="bar" />
  176. <ref name="blankwithnoreference" />
  177. <references>I'm a references with something to say!</references>
  178. <references name="quasit" />
  179. <references />
  180. !! result
  181. <p><strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
  182. name cannot be a simple integer. Use a descriptive title</strong>
  183. </p><p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  184. </p><p><strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
  185. refs with no content must have a name</strong>
  186. </p><p><sup id="cite_ref-bar_1-0" class="reference"><a href="#cite_note-bar-1" title="">[2]</a></sup>
  187. </p><p><sup id="cite_ref-blankwithnoreference_2-0" class="reference"><a href="#cite_note-blankwithnoreference-2" title="">[3]</a></sup>
  188. </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
  189. no input is allowed. Use <code>&lt;references /&gt;</code></strong>
  190. </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
  191. parameter "group" is allowed only.
  192. Use <code>&lt;references /&gt;</code>, or <code>&lt;references group="..." /&gt;</code></strong>
  193. </p>
  194. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Also zero, but differently! (Normal ref)</li>
  195. <li id="cite_note-bar"><a href="#cite_ref-bar_0" title="">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
  196. no text was provided for refs named <code>bar</code></strong></li>
  197. <li id="cite_note-blankwithnoreference"><a href="#cite_ref-blankwithnoreference_0" title="">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
  198. no text was provided for refs named <code>blankwithnoreference</code></strong></li></ol>
  199. !! end
  200. !! test
  201. Simple <ref>, with <references/> in group
  202. !! input
  203. Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
  204. Wikipedia rocks!<ref group=note>Proceeds of Rockology, vol. XXI</ref>
  205. <references/>
  206. <references group=note/>
  207. !! result
  208. <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
  209. Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[note 1]</a></sup>
  210. </p>
  211. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
  212. <ol class="references"><li id="cite_note-1"><a href="#cite_ref-1" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
  213. !! end
  214. !! test
  215. Simple <ref>, with <references/> in group, with groupname in chinese
  216. !! input
  217. AAA<ref group="参">ref a</ref>BBB<ref group="注">note b</ref>CCC<ref group="参">ref c</ref>
  218. ;refs
  219. <references group="参" />
  220. ;notes
  221. <references group="注" />
  222. !! result
  223. <p>AAA<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[参 1]</a></sup>BBB<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[注 1]</a></sup>CCC<sup id="cite_ref-2" class="reference"><a href="#cite_note-2" title="">[参 2]</a></sup>
  224. </p>
  225. <dl><dt>refs
  226. </dt></dl>
  227. <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> ref a</li>
  228. <li id="cite_note-2"><a href="#cite_ref-2" title="">↑</a> ref c</li></ol>
  229. <dl><dt>notes
  230. </dt></dl>
  231. <ol class="references"><li id="cite_note-1"><a href="#cite_ref-1" title="">↑</a> note b</li></ol>
  232. !! end