[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/extensions/Cite/ -> citeParserTests.txt (source)

   1  # Force the test runner to ensure the extension is loaded
   2  !! hooks
   3  ref
   4  references
   5  !! endhooks
   6  
   7  !! test
   8  Simple <ref>, no <references/>
   9  !! input
  10  Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
  11  !! result
  12  Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup><ol class="references">
  13  <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>
  14  </li>
  15  </ol>
  16  
  17  !! end
  18  
  19  !! test
  20  Simple <ref>, with <references/>
  21  !! input
  22  Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
  23  
  24  <references/>
  25  !! result
  26  <p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
  27  </p>
  28  <ol class="references">
  29  <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>
  30  </li>
  31  </ol>
  32  
  33  !! end
  34  
  35  
  36  !! article
  37  Template:Simple template
  38  !! text
  39  A ''simple'' template.
  40  !! endarticle
  41  
  42  
  43  !! test
  44  <ref> with a simple template
  45  !! input
  46  Templating<ref>{{simple template}}</ref>
  47  
  48  <references/>
  49  !! result
  50  <p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
  51  </p>
  52  <ol class="references">
  53  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">A <i>simple</i> template.</span>
  54  </li>
  55  </ol>
  56  
  57  !! end
  58  
  59  !! test
  60  <ref> with a <nowiki>
  61  !! input
  62  Templating<ref><nowiki>{{simple template}}</nowiki></ref>
  63  
  64  <references/>
  65  !! result
  66  <p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
  67  </p>
  68  <ol class="references">
  69  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">{{simple template}}</span>
  70  </li>
  71  </ol>
  72  
  73  !! end
  74  
  75  
  76  !! test
  77  <ref> in a <nowiki>
  78  !! input
  79  Templating<nowiki><ref>{{simple template}}</ref></nowiki>
  80  
  81  <references/>
  82  !! result
  83  <p>Templating&lt;ref&gt;{{simple template}}&lt;/ref&gt;
  84  </p><p><br />
  85  </p>
  86  !! end
  87  
  88  !! test
  89  <ref> in a <!--comment-->
  90  !! input
  91  Templating<!--<ref>{{simple template}}</ref>-->
  92  
  93  <references/>
  94  !! result
  95  <p>Templating
  96  </p><p><br />
  97  </p>
  98  !! end
  99  
 100  !! test
 101  <!--comment--> in a <ref> (bug 5384)
 102  !! input
 103  Templating<ref>Text<!--comment--></ref>
 104  
 105  <references/>
 106  !! result
 107  <p>Templating<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
 108  </p>
 109  <ol class="references">
 110  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Text</span>
 111  </li>
 112  </ol>
 113  
 114  !! end
 115  
 116  !! test
 117  <references> after <gallery> (bug 6164)
 118  !! input
 119  <ref>one</ref>
 120  
 121  <gallery>Image:Foobar.jpg</gallery>
 122  
 123  <references/>
 124  !! result
 125  <p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
 126  </p>
 127  <ul class="gallery mw-gallery-traditional">
 128          <li class="gallerybox" style="width: 155px"><div style="width: 155px">
 129              <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
 130              <div class="gallerytext">
 131              </div>
 132          </div></li>
 133  </ul>
 134  <ol class="references">
 135  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">one</span>
 136  </li>
 137  </ol>
 138  
 139  !! end
 140  
 141  !! test
 142  {{REVISIONID}} on page with <ref> (bug 6299)
 143  !! input
 144  {{REVISIONID}}<ref>elite</ref>
 145  !! result
 146  1337<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup><ol class="references">
 147  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">elite</span>
 148  </li>
 149  </ol>
 150  
 151  !! end
 152  
 153  !! test
 154  {{REVISIONID}} on page without <ref> (bug 6299 sanity check)
 155  !! input
 156  {{REVISIONID}}
 157  !! result
 158  <p>1337
 159  </p>
 160  !! end
 161  
 162  !! test
 163  Blank ref followed by ref with content
 164  !! input
 165  <ref name="blank"/>
 166  
 167  <ref name="blank">content</ref>
 168  
 169  <references/>
 170  !! result
 171  <p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 172  </p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 173  </p>
 174  <ol class="references">
 175  <li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">content</span>
 176  </li>
 177  </ol>
 178  
 179  !! end
 180  
 181  !! test
 182  Regression: non-blank ref "0" followed by ref with content
 183  !! input
 184  <ref name="blank">0</ref>
 185  
 186  <ref name="blank">content</ref>
 187  
 188  <references/>
 189  !! result
 190  <p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 191  </p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 192  </p>
 193  <ol class="references">
 194  <li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">0</span>
 195  </li>
 196  </ol>
 197  
 198  !! end
 199  
 200  !! test
 201  Regression sanity check: non-blank ref "1" followed by ref with content
 202  !! input
 203  <ref name="blank">1</ref>
 204  
 205  <ref name="blank">content</ref>
 206  
 207  <references/>
 208  !! result
 209  <p><sup id="cite_ref-blank_1-0" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 210  </p><p><sup id="cite_ref-blank_1-1" class="reference"><a href="#cite_note-blank-1">[1]</a></sup>
 211  </p>
 212  <ol class="references">
 213  <li id="cite_note-blank-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-blank_1-0">1.0</a></sup> <sup><a href="#cite_ref-blank_1-1">1.1</a></sup></span> <span class="reference-text">1</span>
 214  </li>
 215  </ol>
 216  
 217  !! end
 218  
 219  !! test
 220  Ref names containing a number
 221  !! input
 222  <ref name="test123test">One</ref>
 223  <ref name="123test">Two</ref>
 224  <ref name="test123">Three</ref>
 225  
 226  <references />
 227  !! result
 228  <p><sup id="cite_ref-test123test_1-0" class="reference"><a href="#cite_note-test123test-1">[1]</a></sup>
 229  <sup id="cite_ref-123test_2-0" class="reference"><a href="#cite_note-123test-2">[2]</a></sup>
 230  <sup id="cite_ref-test123_3-0" class="reference"><a href="#cite_note-test123-3">[3]</a></sup>
 231  </p>
 232  <ol class="references">
 233  <li id="cite_note-test123test-1"><span class="mw-cite-backlink"><a href="#cite_ref-test123test_1-0">↑</a></span> <span class="reference-text">One</span>
 234  </li>
 235  <li id="cite_note-123test-2"><span class="mw-cite-backlink"><a href="#cite_ref-123test_2-0">↑</a></span> <span class="reference-text">Two</span>
 236  </li>
 237  <li id="cite_note-test123-3"><span class="mw-cite-backlink"><a href="#cite_ref-test123_3-0">↑</a></span> <span class="reference-text">Three</span>
 238  </li>
 239  </ol>
 240  
 241  !! end
 242  
 243  !! test
 244  Erroneous refs
 245  !! input
 246  <ref name="0">Zero</ref>
 247  
 248  <ref>Also zero, but differently! (Normal ref)</ref>
 249  
 250  <ref />
 251  
 252  <ref name="foo" name="bar" />
 253  
 254  <ref name="blankwithnoreference" />
 255  
 256  <references name="quasit" />
 257  
 258  <references />
 259  !! result
 260  <p><strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 261  name cannot be a simple integer. Use a descriptive title</strong>
 262  </p><p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
 263  </p><p><strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 264  refs with no content must have a name</strong>
 265  </p><p><sup id="cite_ref-bar_2-0" class="reference"><a href="#cite_note-bar-2">[2]</a></sup>
 266  </p><p><sup id="cite_ref-blankwithnoreference_3-0" class="reference"><a href="#cite_note-blankwithnoreference-3">[3]</a></sup>
 267  </p><p><strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
 268  parameter "group" is allowed only.
 269  Use <code>&lt;references /&gt;</code>, or <code>&lt;references group="..." /&gt;</code></strong>
 270  </p>
 271  <ol class="references">
 272  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">Also zero, but differently! (Normal ref)</span>
 273  </li>
 274  <li id="cite_note-bar"><span class="mw-cite-backlink"><a href="#cite_ref-bar_0">↑</a></span> <strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 275  no text was provided for refs named <code>bar</code></strong></li>
 276  <li id="cite_note-blankwithnoreference"><span class="mw-cite-backlink"><a href="#cite_ref-blankwithnoreference_0">↑</a></span> <strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 277  no text was provided for refs named <code>blankwithnoreference</code></strong></li>
 278  </ol>
 279  
 280  !! end
 281  
 282  
 283  !! test
 284  Simple <ref>, with <references/> in group
 285  !! input
 286  Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
 287  Wikipedia rocks!<ref group=note>Proceeds of Rockology, vol. XXI</ref>
 288  
 289  <references/>
 290  <references group=note/>
 291  !! result
 292  <p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
 293  Wikipedia rocks!<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[note 1]</a></sup>
 294  </p>
 295  <ol class="references">
 296  <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>
 297  </li>
 298  </ol>
 299  <ol class="references">
 300  <li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">Proceeds of Rockology, vol. XXI</span>
 301  </li>
 302  </ol>
 303  
 304  !! end
 305  
 306  !! test
 307  Simple <ref>, with <references/> in group, with groupname in chinese 
 308  !! input
 309  AAA<ref group="参">ref a</ref>BBB<ref group="注">note b</ref>CCC<ref group="参">ref c</ref>
 310  
 311  ;refs
 312  <references group="参" />
 313  ;notes
 314  <references group="注" />
 315  !! result
 316  <p>AAA<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[参 1]</a></sup>BBB<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[注 1]</a></sup>CCC<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[参 2]</a></sup>
 317  </p>
 318  <dl><dt>refs</dt></dl>
 319  <ol class="references">
 320  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">ref a</span>
 321  </li>
 322  <li id="cite_note-3"><span class="mw-cite-backlink"><a href="#cite_ref-3">↑</a></span> <span class="reference-text">ref c</span>
 323  </li>
 324  </ol>
 325  <dl><dt>notes</dt></dl>
 326  <ol class="references">
 327  <li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">note b</span>
 328  </li>
 329  </ol>
 330  
 331  !! end
 332  
 333  !! test
 334  <ref> defined in <references>
 335  !! input
 336  <ref name="foo"/>
 337  
 338  <references>
 339  <ref name="foo">BAR</ref>
 340  </references>
 341  !! result
 342  <p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
 343  </p>
 344  <ol class="references">
 345  <li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
 346  </li>
 347  </ol>
 348  
 349  !! end
 350  
 351  !! test
 352  <ref> defined in <references> called with #tag
 353  !! input
 354  <ref name="foo"/>
 355  
 356  {{#tag:references|
 357  <ref name="foo">BAR</ref>
 358  }}
 359  !! result
 360  <p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[1]</a></sup>
 361  </p>
 362  <ol class="references">
 363  <li id="cite_note-foo-1"><span class="mw-cite-backlink"><a href="#cite_ref-foo_1-0">↑</a></span> <span class="reference-text">BAR</span>
 364  </li>
 365  </ol>
 366  
 367  !! end
 368  
 369  !! test
 370  <ref> defined in <references> error conditions
 371  !! input
 372  <ref name="foo" group="2"/>
 373  
 374  <references group="2">
 375  <ref name="foo"/>
 376  <ref name="unused">BAR</ref>
 377  <ref name="foo" group="1">bad group</ref>
 378  <ref>BAR BAR</ref>
 379  </references>
 380  !! result
 381  <p><sup id="cite_ref-foo_1-0" class="reference"><a href="#cite_note-foo-1">[2 1]</a></sup>
 382  </p>
 383  <ol class="references">
 384  <li id="cite_note-foo"><span class="mw-cite-backlink"><a href="#cite_ref-foo_0">↑</a></span> <strong class="error mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 385  no text was provided for refs named <code>foo</code></strong></li>
 386  </ol>
 387  <p><strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> tag with name "unused" defined in <code>&lt;references&gt;</code> is not used in prior text.</strong><br />
 388  <strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> tag in <code>&lt;references&gt;</code> has conflicting group attribute "1".</strong><br />
 389  <strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> has no name attribute.</strong>
 390  </p>
 391  !! end
 392  
 393  !! article
 394  MediaWiki:cite_link_label_group-klingon
 395  !! text
 396  wa' cha' wej loS vagh jav Soch chorgh Hut wa'maH
 397  !! endarticle
 398  
 399  !! test
 400  <ref> with custom group link
 401  !! input
 402  Wikipedia rocks!<ref group="klingon">Proceeds of Rockology, vol. XXI</ref>
 403  
 404  <references group="klingon"/>
 405  !! result
 406  <p>Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[wa']</a></sup>
 407  </p>
 408  <ol class="references">
 409  <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>
 410  </li>
 411  </ol>
 412  
 413  !! end
 414  
 415  !! test
 416  Bug 31374 regression check: nested strip items
 417  !! input
 418  {{#tag:ref|note<ref>reference</ref>|group=Note}}
 419  <references group=Note />
 420  <references />
 421  !! result
 422  <p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[Note 1]</a></sup>
 423  </p>
 424  <ol class="references">
 425  <li id="cite_note-2"><span class="mw-cite-backlink"><a href="#cite_ref-2">↑</a></span> <span class="reference-text">note<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></span>
 426  </li>
 427  </ol>
 428  <ol class="references">
 429  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">reference</span>
 430  </li>
 431  </ol>
 432  
 433  !! end
 434  
 435  !! test
 436  Bug 13073 regression check: wrapped <references>
 437  !! input
 438  <ref>
 439  foo
 440  </ref>
 441  <div><references /></div>
 442  !! result
 443  <p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
 444  </p>
 445  <div><ol class="references">
 446  <li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">
 447  foo</span>
 448  </li>
 449  </ol></div>
 450  
 451  !! end


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1