* Fix regression(?) in behavior of initial-whitespace-pre in <center>
[lhc/web/wiklou.git] / maintenance / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # disabled do not run test
23 #
24 # For testing purposes, temporary articles can created:
25 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
26 # where '/' denotes a newline.
27
28 # This is the standard article assumed to exist.
29 !! article
30 Main Page
31 !! text
32 blah blah
33 !! endarticle
34
35 ###
36 ### Basic tests
37 ###
38 !! test
39 Blank input
40 !! input
41 !! result
42 !! end
43
44
45 !! test
46 Simple paragraph
47 !! input
48 This is a simple paragraph.
49 !! result
50 <p>This is a simple paragraph.
51 </p>
52 !! end
53
54 !! test
55 Simple list
56 !! input
57 * Item 1
58 * Item 2
59 !! result
60 <ul><li> Item 1
61 </li><li> Item 2
62 </li></ul>
63
64 !! end
65
66 !! test
67 Italics and bold
68 !! input
69 * plain
70 * plain''italic''plain
71 * plain''italic''plain''italic''plain
72 * plain'''bold'''plain
73 * plain'''bold'''plain'''bold'''plain
74 * plain''italic''plain'''bold'''plain
75 * plain'''bold'''plain''italic''plain
76 * plain''italic'''bold-italic'''italic''plain
77 * plain'''bold''bold-italic''bold'''plain
78 * plain'''''bold-italic'''italic''plain
79 * plain'''''bold-italic''bold'''plain
80 * plain''italic'''bold-italic'''''plain
81 * plain'''bold''bold-italic'''''plain
82 * plain l'''italic''plain
83 !! result
84 <ul><li> plain
85 </li><li> plain<i>italic</i>plain
86 </li><li> plain<i>italic</i>plain<i>italic</i>plain
87 </li><li> plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<b>bold</b>plain
89 </li><li> plain<i>italic</i>plain<b>bold</b>plain
90 </li><li> plain<b>bold</b>plain<i>italic</i>plain
91 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
92 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
93 </li><li> plain<i><b>bold-italic</b>italic</i>plain
94 </li><li> plain<b><i>bold-italic</i>bold</b>plain
95 </li><li> plain<i>italic<b>bold-italic</b></i>plain
96 </li><li> plain<b>bold<i>bold-italic</i></b>plain
97 </li><li> plain l'<i>italic</i>plain
98 </li></ul>
99
100 !! end
101
102 ###
103 ### <nowiki> test cases
104 ###
105
106 !! test
107 <nowiki> unordered list
108 !! input
109 <nowiki>* This is not an unordered list item.</nowiki>
110 !! result
111 <p>* This is not an unordered list item.
112 </p>
113 !! end
114
115 !! test
116 <nowiki> spacing
117 !! input
118 <nowiki>Lorem ipsum dolor
119
120 sed abit.
121 sed nullum.
122
123 :and a colon
124 </nowiki>
125 !! result
126 <p>Lorem ipsum dolor
127
128 sed abit.
129 sed nullum.
130
131 :and a colon
132
133 </p>
134 !! end
135
136 !! test
137 nowiki 3
138 !! input
139 :There is not nowiki.
140 :There is <nowiki>nowiki</nowiki>.
141
142 #There is not nowiki.
143 #There is <nowiki>nowiki</nowiki>.
144
145 *There is not nowiki.
146 *There is <nowiki>nowiki</nowiki>.
147 !! result
148 <dl><dd>There is not nowiki.
149 </dd><dd>There is nowiki.
150 </dd></dl>
151 <ol><li>There is not nowiki.
152 </li><li>There is nowiki.
153 </li></ol>
154 <ul><li>There is not nowiki.
155 </li><li>There is nowiki.
156 </li></ul>
157
158 !! end
159
160
161 ###
162 ### Comments
163 ###
164 !! test
165 Comment test 1
166 !! input
167 <!-- comment 1 --> asdf
168 <!-- comment 2 -->
169 !! result
170 <pre>asdf
171 </pre>
172
173 !! end
174
175 !! test
176 Comment test 2
177 !! input
178 asdf
179 <!-- comment 1 -->
180 jkl
181 !! result
182 <p>asdf
183 jkl
184 </p>
185 !! end
186
187 !! test
188 Comment test 3
189 !! input
190 asdf
191 <!-- comment 1 -->
192 <!-- comment 2 -->
193 jkl
194 !! result
195 <p>asdf
196 jkl
197 </p>
198 !! end
199
200 !! test
201 Comment test 4
202 !! input
203 asdf<!-- comment 1 -->jkl
204 !! result
205 <p>asdfjkl
206 </p>
207 !! end
208
209 !! test
210 Comment spacing
211 !! input
212 a
213 <!-- foo --> b <!-- bar -->
214 c
215 !! result
216 <p>a
217 </p>
218 <pre> b
219 </pre>
220 <p>c
221 </p>
222 !! end
223
224 !! test
225 Comment whitespace
226 !! input
227 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
228 !! result
229
230 !! end
231
232 !! test
233 Comment semantics and delimiters
234 !! input
235 <!-- --><!----><!-----><!------>
236 !! result
237
238 !! end
239
240 !! test
241 Comment semantics and delimiters, redux
242 !! input
243 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
244 -- foo -- funky huh? ... -->
245 !! result
246
247 !! end
248
249 !! test
250 Comment semantics and delimiters: directors cut
251 !! input
252 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
253 everything starting with < followed by !-- until the first -- and > we see,
254 that wouldn't be valid XML however, since in XML -- has to terminate a comment
255 -->-->
256 !! result
257 <p>-->
258 </p>
259 !! end
260
261 !! test
262 Comment semantics: nesting
263 !! input
264 <!--<!-- no, we're not going to do anything fancy here -->-->
265 !! result
266 <p>-->
267 </p>
268 !! end
269
270 !! test
271 Comment semantics: unclosed comment at end
272 !! input
273 <!--This comment will run out to the end of the document
274 !! result
275
276 !! end
277
278
279 ###
280 ### Preformatted text
281 ###
282 !! test
283 Preformatted text
284 !! input
285 This is some
286 Preformatted text
287 With ''italic''
288 And '''bold'''
289 And a [[Main Page|link]]
290 !! result
291 <pre>This is some
292 Preformatted text
293 With <i>italic</i>
294 And <b>bold</b>
295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
296 </pre>
297 !! end
298
299 !! test
300 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
301 !! input
302 <pre><nowiki>
303 <b>
304 <cite>
305 <em>
306 </nowiki></pre>
307 !! result
308 <pre>
309 &lt;b&gt;
310 &lt;cite&gt;
311 &lt;em&gt;
312 </pre>
313
314 !! end
315
316 !! test
317 Regression with preformatted in <center>
318 !! input
319 <center>
320 Blah
321 </center>
322 !! result
323 <center>
324 <pre>Blah
325 </pre>
326 </center>
327
328 !! end
329
330 !! test
331 <pre> with attributes (bug 3202)
332 !! input
333 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
334 !! result
335 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
336
337 !! end
338
339 !! test
340 <pre> with width attribute (bug 3202)
341 !! input
342 <pre width="8">Narrow screen goodies</pre>
343 !! result
344 <pre width="8">Narrow screen goodies</pre>
345
346 !! end
347
348 !! test
349 <pre> with forbidden attribute (bug 3202)
350 !! input
351 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
352 !! result
353 <pre width="8">Narrow screen goodies</pre>
354
355 !! end
356
357 !! test
358 <pre> with forbidden attribute values (bug 3202)
359 !! input
360 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
361 !! result
362 <pre width="8">Narrow screen goodies</pre>
363
364 !! end
365
366 ###
367 ### Definition lists
368 ###
369 !! test
370 Simple definition
371 !! input
372 ; name : Definition
373 !! result
374 <dl><dt> name&nbsp;</dt><dd> Definition
375 </dd></dl>
376
377 !! end
378
379 !! test
380 Simple definition
381 !! input
382 : Indented text
383 !! result
384 <dl><dd> Indented text
385 </dd></dl>
386
387 !! end
388
389 !! test
390 Definition list with no space
391 !! input
392 ;name:Definition
393 !! result
394 <dl><dt>name</dt><dd>Definition
395 </dd></dl>
396
397 !!end
398
399 !! test
400 Definition list with URL link
401 !! input
402 ; http://example.com/ : definition
403 !! result
404 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
405 </dd></dl>
406
407 !! end
408
409 !! test
410 Definition list with bracketed URL link
411 !! input
412 ;[http://www.example.com/ Example]:Something about it
413 !! result
414 <dl><dt><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">Example</a></dt><dd>Something about it
415 </dd></dl>
416
417 !! end
418
419 !! test
420 Definition list with wikilink containing colon
421 !! input
422 ; [[Help:FAQ]]: The least-read page on Wikipedia
423 !! result
424 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit" class="new" title="Help:FAQ">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
425 </dd></dl>
426
427 !! end
428
429 # At Brion's and JeLuF's insistence... :)
430 !! test
431 Definition list with wikilink containing colon
432 !! input
433 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
434 !! result
435 <dl><dt> <a href="news:alt.wikipedia.rox" class='external free' title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
436 </dd></dl>
437
438 !! end
439
440 !! test
441 Malformed definition list with colon
442 !! input
443 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
444 !! result
445 <dl><dt> <a href="news:alt.wikipedia.rox" class='external free' title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
446 </dt></dl>
447
448 !! end
449
450 !! test
451 Definition lists: colon in external link text
452 !! input
453 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
454 !! result
455 <dl><dt> <a href="http://www.wikipedia2.org/" class='external text' title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
456 </dd></dl>
457
458 !! end
459
460 !! test
461 Definition lists: colon in HTML attribute
462 !! input
463 ;<b style="display: inline">bold</b>
464 !! result
465 <dl><dt><b style="display: inline">bold</b>
466 </dt></dl>
467
468 !! end
469
470
471 !! test
472 Definition lists: self-closed tag
473 !! input
474 ;one<br/>two : two-line fun
475 !! result
476 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
477 </dd></dl>
478
479 !! end
480
481
482 ###
483 ### External links
484 ###
485 !! test
486 External links: non-bracketed
487 !! input
488 Non-bracketed: http://example.com
489 !! result
490 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
491 </p>
492 !! end
493
494 !! test
495 External links: numbered
496 !! input
497 Numbered: [http://example.com]
498 Numbered: [http://example.net]
499 Numbered: [http://example.org]
500 !! result
501 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
502 Numbered: <a href="http://example.net" class='external autonumber' title="http://example.net" rel="nofollow">[2]</a>
503 Numbered: <a href="http://example.org" class='external autonumber' title="http://example.org" rel="nofollow">[3]</a>
504 </p>
505 !!end
506
507 !! test
508 External links: specified text
509 !! input
510 Specified text: [http://example.com link]
511 !! result
512 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
513 </p>
514 !!end
515
516 !! test
517 External links: trail
518 !! input
519 Linktrails should not work for external links: [http://example.com link]s
520 !! result
521 <p>Linktrails should not work for external links: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>s
522 </p>
523 !! end
524
525 !! test
526 External links: dollar sign in URL
527 !! input
528 http://example.com/1$2345
529 !! result
530 <p><a href="http://example.com/1$2345" class='external free' title="http://example.com/1$2345" rel="nofollow">http://example.com/1$2345</a>
531 </p>
532 !! end
533
534 !! test
535 External links: dollar sign in URL (named)
536 !! input
537 [http://example.com/1$2345]
538 !! result
539 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
540 </p>
541 !!end
542
543 !! test
544 External links: open square bracket forbidden in URL (bug 4377)
545 !! input
546 http://example.com/1[2345
547 !! result
548 <p><a href="http://example.com/1" class='external free' title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
549 </p>
550 !! end
551
552 !! test
553 External links: open square bracket forbidden in URL (named) (bug 4377)
554 !! input
555 [http://example.com/1[2345]
556 !! result
557 <p><a href="http://example.com/1" class='external text' title="http://example.com/1" rel="nofollow">[2345</a>
558 </p>
559 !!end
560
561 !! test
562 External links: nowiki in URL link text (bug 6230)
563 !!input
564 [http://example.com/ <nowiki>''example site''</nowiki>]
565 !! result
566 <p><a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow">''example site''</a>
567 </p>
568 !! end
569
570 !! test
571 External links: newline forbidden in text (bug 6230 regression check)
572 !! input
573 [http://example.com/ first
574 second]
575 !! result
576 <p>[<a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a> first
577 second]
578 </p>
579 !!end
580
581 !! test
582 External image
583 !! input
584 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
585 !! result
586 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
587 </p>
588 !! end
589
590 !! test
591 External image from https
592 !! input
593 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
594 !! result
595 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
596 </p>
597 !! end
598
599 !! test
600 Link to non-http image, no img tag
601 !! input
602 Link to non-http image, no img tag: ftp://example.com/test.jpg
603 !! result
604 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external free' title="ftp://example.com/test.jpg" rel="nofollow">ftp://example.com/test.jpg</a>
605 </p>
606 !! end
607
608 !! test
609 External links: terminating separator
610 !! input
611 Terminating separator: http://example.com/thing,
612 !! result
613 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
614 </p>
615 !! end
616
617 !! test
618 External links: intervening separator
619 !! input
620 Intervening separator: http://example.com/1,2,3
621 !! result
622 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external free' title="http://example.com/1,2,3" rel="nofollow">http://example.com/1,2,3</a>
623 </p>
624 !! end
625
626 !! test
627 External links: old bug with URL in query
628 !! input
629 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
630 !! result
631 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external text' title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
632 </p>
633 !! end
634
635 !! test
636 External links: old URL-in-URL bug, mixed protocols
637 !! input
638 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
639 !! result
640 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external text' title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
641 </p>
642 !!end
643
644 !! test
645 External links: URL in text
646 !! input
647 URL in text: [http://example.com http://example.com]
648 !! result
649 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
650 </p>
651 !! end
652
653 !! test
654 External links: Clickable images
655 !! input
656 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
657 !! result
658 <p>ja-style clickable images: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
659 </p>
660 !!end
661
662 !! test
663 External links: raw ampersand
664 !! input
665 Old &amp; use: http://x&y
666 !! result
667 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
668 </p>
669 !! end
670
671 !! test
672 External links: encoded ampersand
673 !! input
674 Old &amp; use: http://x&amp;y
675 !! result
676 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
677 </p>
678 !! end
679
680 !! test
681 External links: encoded equals (bug 6102)
682 !! input
683 http://example.com/?foo&#61;bar
684 !! result
685 <p><a href="http://example.com/?foo=bar" class='external free' title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
686 </p>
687 !! end
688
689 !! test
690 External links: [raw ampersand]
691 !! input
692 Old &amp; use: [http://x&y]
693 !! result
694 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
695 </p>
696 !! end
697
698 !! test
699 External links: [encoded ampersand]
700 !! input
701 Old &amp; use: [http://x&amp;y]
702 !! result
703 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
704 </p>
705 !! end
706
707 !! test
708 External links: [encoded equals] (bug 6102)
709 !! input
710 [http://example.com/?foo&#61;bar]
711 !! result
712 <p><a href="http://example.com/?foo=bar" class='external autonumber' title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
713 </p>
714 !! end
715
716 !! test
717 External links: www.jpeg.org (bug 554)
718 !! input
719 http://www.jpeg.org
720 !!result
721 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
722 </p>
723 !! end
724
725 !! test
726 External links: URL within URL (original bug 2)
727 !! input
728 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
729 !! result
730 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class='external autonumber' title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" rel="nofollow">[1]</a>
731 </p>
732 !! end
733
734 !! test
735 BUG 361: URL inside bracketed URL
736 !! input
737 [http://www.example.com/foo http://www.example.com/bar]
738 !! result
739 <p><a href="http://www.example.com/foo" class='external text' title="http://www.example.com/foo" rel="nofollow">http://www.example.com/bar</a>
740 </p>
741 !! end
742
743 !! test
744 BUG 361: URL within URL, not bracketed
745 !! input
746 http://www.example.com/foo?=http://www.example.com/bar
747 !! result
748 <p><a href="http://www.example.com/foo?=http://www.example.com/bar" class='external free' title="http://www.example.com/foo?=http://www.example.com/bar" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a>
749 </p>
750 !! end
751
752 !! test
753 BUG 289: ">"-token in URL-tail
754 !! input
755 http://www.example.com/<hello>
756 !! result
757 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
758 </p>
759 !!end
760
761 !! test
762 BUG 289: literal ">"-token in URL-tail
763 !! input
764 http://www.example.com/<b>html</b>
765 !! result
766 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a><b>html</b>
767 </p>
768 !!end
769
770 !! test
771 BUG 289: ">"-token in bracketed URL
772 !! input
773 [http://www.example.com/<hello> stuff]
774 !! result
775 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
776 </p>
777 !!end
778
779 !! test
780 BUG 289: literal ">"-token in bracketed URL
781 !! input
782 [http://www.example.com/<b>html</b> stuff]
783 !! result
784 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
785 </p>
786 !!end
787
788 !! test
789 BUG 289: literal double quote at end of URL
790 !! input
791 http://www.example.com/"hello"
792 !! result
793 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
794 </p>
795 !!end
796
797 !! test
798 BUG 289: literal double quote in bracketed URL
799 !! input
800 [http://www.example.com/"hello" stuff]
801 !! result
802 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
803 </p>
804 !!end
805
806 !! test
807 External links: invalid character
808 Fixme: the missing char seems to have gone missing
809 !! options
810 disabled
811 !! input
812 [http://www.example.com test]
813 !! result
814 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a> test]
815 </p>
816 !! end
817
818 !! test
819 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
820 !! input
821 [http://www.example.com test]
822 !! result
823 <p><a href="http://www.example.com" class='external text' title="http://www.example.com" rel="nofollow">test</a>
824 </p>
825 !! end
826
827 !! test
828 External links: wiki links within external link (Bug 3695)
829 !! input
830 [http://example.com [[wikilink]] embedded in ext link]
831 !! result
832 <p><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"></a><a href="/index.php?title=Wikilink&amp;action=edit" class="new" title="Wikilink">wikilink</a><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"> embedded in ext link</a>
833 </p>
834 !! end
835
836 !! test
837 BUG 787: Links with one slash after the url protocol are invalid
838 !! input
839 http:/example.com
840
841 [http:/example.com title]
842 !! result
843 <p>http:/example.com
844 </p><p>[http:/example.com title]
845 </p>
846 !! end
847
848 !! test
849 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
850 !! input
851 ''[http://example.com text'']
852 [http://example.com '''text]'''
853 ''Something [http://example.com in italic'']
854 ''Something [http://example.com mixed''''', even bold]'''
855 '''''Now [http://example.com both''''']
856 !! result
857 <p><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>text</i></a>
858 <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><b>text</b></a>
859 <i>Something </i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>in italic</i></a>
860 <i>Something </i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
861 <i><b>Now </b></i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i><b>both</b></i></a>
862 </p>
863 !! end
864
865
866 !! test
867 Bug 4781: %26 in URL
868 !! input
869 http://www.example.com/?title=AT%26T
870 !! result
871 <p><a href="http://www.example.com/?title=AT%26T" class='external free' title="http://www.example.com/?title=AT%26T" rel="nofollow">http://www.example.com/?title=AT%26T</a>
872 </p>
873 !! end
874
875 !! test
876 Bug 4781, 5267: %26 in URL
877 !! input
878 http://www.example.com/?title=100%25_Bran
879 !! result
880 <p><a href="http://www.example.com/?title=100%25_Bran" class='external free' title="http://www.example.com/?title=100%25_Bran" rel="nofollow">http://www.example.com/?title=100%25_Bran</a>
881 </p>
882 !! end
883
884 !! test
885 Bug 4781, 5267: %28, %29 in URL
886 !! input
887 http://www.example.com/?title=Ben-Hur_%281959_film%29
888 !! result
889 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class='external free' title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
890 </p>
891 !! end
892
893
894 !! test
895 Bug 4781: %26 in autonumber URL
896 !! input
897 [http://www.example.com/?title=AT%26T]
898 !! result
899 <p><a href="http://www.example.com/?title=AT%26T" class='external autonumber' title="http://www.example.com/?title=AT%26T" rel="nofollow">[1]</a>
900 </p>
901 !! end
902
903 !! test
904 Bug 4781, 5267: %26 in autonumber URL
905 !! input
906 [http://www.example.com/?title=100%25_Bran]
907 !! result
908 <p><a href="http://www.example.com/?title=100%25_Bran" class='external autonumber' title="http://www.example.com/?title=100%25_Bran" rel="nofollow">[1]</a>
909 </p>
910 !! end
911
912 !! test
913 Bug 4781, 5267: %28, %29 in autonumber URL
914 !! input
915 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
916 !! result
917 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class='external autonumber' title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">[1]</a>
918 </p>
919 !! end
920
921
922 !! test
923 Bug 4781: %26 in bracketed URL
924 !! input
925 [http://www.example.com/?title=AT%26T link]
926 !! result
927 <p><a href="http://www.example.com/?title=AT%26T" class='external text' title="http://www.example.com/?title=AT%26T" rel="nofollow">link</a>
928 </p>
929 !! end
930
931 !! test
932 Bug 4781, 5267: %26 in bracketed URL
933 !! input
934 [http://www.example.com/?title=100%25_Bran link]
935 !! result
936 <p><a href="http://www.example.com/?title=100%25_Bran" class='external text' title="http://www.example.com/?title=100%25_Bran" rel="nofollow">link</a>
937 </p>
938 !! end
939
940 !! test
941 Bug 4781, 5267: %28, %29 in bracketed URL
942 !! input
943 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
944 !! result
945 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class='external text' title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">link</a>
946 </p>
947 !! end
948
949 !! test
950 External link containing double-single-quotes in text '' (bug 4598 sanity check)
951 !! input
952 Some [http://example.com/ pretty ''italics'' and stuff]!
953 !! result
954 <p>Some <a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
955 </p>
956 !! end
957
958 !! test
959 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
960 !! input
961 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
962 !! result
963 <p><i>Some </i><a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
964 </p>
965 !! end
966
967
968
969 ###
970 ### Quotes
971 ###
972
973 !! test
974 Quotes
975 !! input
976 Normal text. '''Bold text.''' Normal text. ''Italic text.''
977
978 Normal text. '''''Bold italic text.''''' Normal text.
979 !!result
980 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
981 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
982 </p>
983 !! end
984
985
986 !! test
987 Unclosed and unmatched quotes
988 !! input
989 '''''Bold italic text '''with bold deactivated''' in between.'''''
990
991 '''''Bold italic text ''with italic deactivated'' in between.'''''
992
993 '''Bold text..
994
995 ..spanning two paragraphs (should not work).'''
996
997 '''Bold tag left open
998
999 ''Italic tag left open
1000
1001 Normal text.
1002
1003 <!-- Unmatching number of opening, closing tags: -->
1004 '''This year''''s election ''should'' beat '''last year''''s.
1005
1006 ''Tom'''s car is bigger than ''Susan'''s.
1007 !! result
1008 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1009 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1010 </p><p><b>Bold text..</b>
1011 </p><p>..spanning two paragraphs (should not work).
1012 </p><p><b>Bold tag left open</b>
1013 </p><p><i>Italic tag left open</i>
1014 </p><p>Normal text.
1015 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1016 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1017 </p>
1018 !! end
1019
1020 ###
1021 ### Tables
1022 ###
1023 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1024 ###
1025
1026 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1027 # is the bare minimun required by the spec, see:
1028 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1029 !! test
1030 A table with no data.
1031 !! input
1032 {||}
1033 !! result
1034 !! end
1035
1036 # A table with nothing but a caption is invalid XHTML, we might want to render
1037 # this as <p>caption</p>
1038 !! test
1039 A table with nothing but a caption
1040 !! input
1041 {|
1042 |+ caption
1043 |}
1044 !! result
1045 <table>
1046 <caption> caption
1047 </caption><tr><td></td></tr></table>
1048
1049 !! end
1050
1051 !! test
1052 Simple table
1053 !! input
1054 {|
1055 | 1 || 2
1056 |-
1057 | 3 || 4
1058 |}
1059 !! result
1060 <table>
1061 <tr>
1062 <td> 1 </td><td> 2
1063 </td></tr>
1064 <tr>
1065 <td> 3 </td><td> 4
1066 </td></tr></table>
1067
1068 !! end
1069
1070 !! test
1071 Multiplication table
1072 !! input
1073 {| border="1" cellpadding="2"
1074 |+Multiplication table
1075 |-
1076 ! &times; !! 1 !! 2 !! 3
1077 |-
1078 ! 1
1079 | 1 || 2 || 3
1080 |-
1081 ! 2
1082 | 2 || 4 || 6
1083 |-
1084 ! 3
1085 | 3 || 6 || 9
1086 |-
1087 ! 4
1088 | 4 || 8 || 12
1089 |-
1090 ! 5
1091 | 5 || 10 || 15
1092 |}
1093 !! result
1094 <table border="1" cellpadding="2">
1095 <caption>Multiplication table
1096 </caption>
1097 <tr>
1098 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1099 </th></tr>
1100 <tr>
1101 <th> 1
1102 </th><td> 1 </td><td> 2 </td><td> 3
1103 </td></tr>
1104 <tr>
1105 <th> 2
1106 </th><td> 2 </td><td> 4 </td><td> 6
1107 </td></tr>
1108 <tr>
1109 <th> 3
1110 </th><td> 3 </td><td> 6 </td><td> 9
1111 </td></tr>
1112 <tr>
1113 <th> 4
1114 </th><td> 4 </td><td> 8 </td><td> 12
1115 </td></tr>
1116 <tr>
1117 <th> 5
1118 </th><td> 5 </td><td> 10 </td><td> 15
1119 </td></tr></table>
1120
1121 !! end
1122
1123 !! test
1124 Table rowspan
1125 !! input
1126 {| align=right border=1
1127 | Cell 1, row 1
1128 |rowspan=2| Cell 2, row 1 (and 2)
1129 | Cell 3, row 1
1130 |-
1131 | Cell 1, row 2
1132 | Cell 3, row 2
1133 |}
1134 !! result
1135 <table align="right" border="1">
1136 <tr>
1137 <td> Cell 1, row 1
1138 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1139 </td><td> Cell 3, row 1
1140 </td></tr>
1141 <tr>
1142 <td> Cell 1, row 2
1143 </td><td> Cell 3, row 2
1144 </td></tr></table>
1145
1146 !! end
1147
1148 !! test
1149 Nested table
1150 !! input
1151 {| border=1
1152 | &alpha;
1153 |
1154 {| bgcolor=#ABCDEF border=2
1155 |nested
1156 |-
1157 |table
1158 |}
1159 |the original table again
1160 |}
1161 !! result
1162 <table border="1">
1163 <tr>
1164 <td> &alpha;
1165 </td><td>
1166 <table bgcolor="#ABCDEF" border="2">
1167 <tr>
1168 <td>nested
1169 </td></tr>
1170 <tr>
1171 <td>table
1172 </td></tr></table>
1173 </td><td>the original table again
1174 </td></tr></table>
1175
1176 !! end
1177
1178 !! test
1179 Invalid attributes in table cell (bug 1830)
1180 !! input
1181 {|
1182 |Cell:|broken
1183 |}
1184 !! result
1185 <table>
1186 <tr>
1187 <td>broken
1188 </td></tr></table>
1189
1190 !! end
1191
1192
1193 # FIXME: this one has incorrect tag nesting still.
1194 !! test
1195 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1196 !! input
1197 {|
1198 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1199 !! result
1200 <table>
1201 <tr>
1202 <td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1203 </td>
1204 </tr>
1205 </table>
1206
1207 !! end
1208
1209
1210 ###
1211 ### Internal links
1212 ###
1213 !! test
1214 Plain link, capitalized
1215 !! input
1216 [[Main Page]]
1217 !! result
1218 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1219 </p>
1220 !! end
1221
1222 !! test
1223 Plain link, uncapitalized
1224 !! input
1225 [[main Page]]
1226 !! result
1227 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1228 </p>
1229 !! end
1230
1231 !! test
1232 Piped link
1233 !! input
1234 [[Main Page|The Main Page]]
1235 !! result
1236 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1237 </p>
1238 !! end
1239
1240 !! test
1241 Broken link
1242 !! input
1243 [[Zigzagzogzagzig]]
1244 !! result
1245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1246 </p>
1247 !! end
1248
1249 !! test
1250 Link with prefix
1251 !! input
1252 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1253 !! result
1254 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1255 </p>
1256 !! end
1257
1258 !! test
1259 Link with suffix
1260 !! input
1261 [[Main Page]]xxx, [[Main Page]]XXX
1262 !! result
1263 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1264 </p>
1265 !! end
1266
1267 !! test
1268 Link with 3 brackets
1269 !! input
1270 [[[main page]]]
1271 !! result
1272 <p>[[[main page]]]
1273 </p>
1274 !! end
1275
1276 !! test
1277 Piped link with 3 brackets
1278 !! input
1279 [[[main page|the main page]]]
1280 !! result
1281 <p>[[[main page|the main page]]]
1282 </p>
1283 !! end
1284
1285 !! test
1286 Link with multiple pipes
1287 !! input
1288 [[Main Page|The|Main|Page]]
1289 !! result
1290 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1291 </p>
1292 !! end
1293
1294 !! test
1295 Link to namespaces
1296 !! input
1297 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1298 !! result
1299 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
1300 </p>
1301 !! end
1302
1303 !! test
1304 Piped link to namespace
1305 !! input
1306 [[Meta:Disclaimers|The disclaimers]]
1307 !! result
1308 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1309 </p>
1310 !! end
1311
1312 !! test
1313 Link containing }
1314 !! input
1315 [[Usually caused by a typo (oops}]]
1316 !! result
1317 <p>[[Usually caused by a typo (oops}]]
1318 </p>
1319 !! end
1320
1321 !! test
1322 Link containing % (not as a hex sequence)
1323 !! input
1324 [[7% Solution]]
1325 !! result
1326 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1327 </p>
1328 !! end
1329
1330 !! test
1331 Link containing % as a single hex sequence interpreted to char
1332 !! input
1333 [[7%25 Solution]]
1334 !! result
1335 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1336 </p>
1337 !!end
1338
1339 !! test
1340 Link containing % as a double hex sequence interpreted to hex sequence
1341 !! input
1342 [[7%2525 Solution]]
1343 !! result
1344 <p>[[7%2525 Solution]]
1345 </p>
1346 !!end
1347
1348 !! test
1349 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1350 Example for such a section: == < ==
1351 !! input
1352 [[%23%3c]][[%23%3e]]
1353 !! result
1354 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1355 </p>
1356 !! end
1357
1358 !! test
1359 Link containing "<#" and ">#" as a hex sequences
1360 !! input
1361 [[%3c%23]][[%3e%23]]
1362 !! result
1363 <p>[[%3c%23]][[%3e%23]]
1364 </p>
1365 !! end
1366
1367 !! test
1368 Link containing double-single-quotes '' (bug 4598)
1369 !! input
1370 [[Lista d''e paise d''o munno]]
1371 !! result
1372 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a>
1373 </p>
1374 !! end
1375
1376 !! test
1377 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1378 !! input
1379 Some [[Link|pretty ''italics'' and stuff]]!
1380 !! result
1381 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1382 </p>
1383 !! end
1384
1385 !! test
1386 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1387 !! input
1388 ''Some [[Link|pretty ''italics'' and stuff]]!
1389 !! result
1390 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit" class="new" title="Link"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1391 </p>
1392 !! end
1393
1394 !! test
1395 Plain link to URL
1396 !! input
1397 [[http://www.example.org]]
1398 !! result
1399 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
1400 </p>
1401 !! end
1402
1403 # I'm fairly sure the expected result here is wrong.
1404 # We want these to be URL links, not pseudo-pages with URLs for titles....
1405 # However the current output is also pretty screwy.
1406 #
1407 # ----
1408 # I'm changing it to match the current output--it arguably makes more
1409 # sense in the light of the test above. Old expected result was:
1410 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&amp;action=edit" class="new" title="Http://www.example.org">an example URL</a>
1411 #</p>
1412 # But I think this test is bordering on "garbage in, garbage out" anyway.
1413 # -- wtm
1414 !! test
1415 Piped link to URL
1416 !! input
1417 Piped link to URL: [[http://www.example.org|an example URL]]
1418 !! result
1419 <p>Piped link to URL: [<a href="http://www.example.org|an" class='external text' title="http://www.example.org|an" rel="nofollow">example URL</a>]
1420 </p>
1421 !! end
1422
1423 !! test
1424 BUG 2: [[page|http://url/]] should link to page, not http://url/
1425 !! input
1426 [[Main Page|http://url/]]
1427 !! result
1428 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1429 </p>
1430 !! end
1431
1432 !! test
1433 BUG 337: Escaped self-links should be bold
1434 !! options
1435 title=[[Bug462]]
1436 !! input
1437 [[Bu&#103;462]] [[Bug462]]
1438 !! result
1439 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1440 </p>
1441 !! end
1442
1443 !! test
1444 Self-link to section should not be bold
1445 !! options
1446 title=[[Main Page]]
1447 !! input
1448 [[Main Page#section]]
1449 !! result
1450 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1451 </p>
1452 !! end
1453
1454 !! test
1455 <nowiki> inside a link
1456 !! input
1457 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1458 !! result
1459 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1460 </p>
1461 !! end
1462
1463 ###
1464 ### Interwiki links (see maintenance/interwiki.sql)
1465 ###
1466
1467 !! test
1468 Inline interwiki link
1469 !! input
1470 [[MeatBall:SoftSecurity]]
1471 !! result
1472 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1473 </p>
1474 !! end
1475
1476 !! test
1477 Inline interwiki link with empty title (bug 2372)
1478 !! input
1479 [[MeatBall:]]
1480 !! result
1481 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class='extiw' title="meatball:">MeatBall:</a>
1482 </p>
1483 !! end
1484
1485 !! test
1486 Interwiki link encoding conversion (bug 1636)
1487 !! input
1488 *[[Wikipedia:ro:Olteni&#0355;a]]
1489 *[[Wikipedia:ro:Olteni&#355;a]]
1490 !! result
1491 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class='extiw' title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
1492 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class='extiw' title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
1493 </li></ul>
1494
1495 !! end
1496
1497 !! test
1498 Interwiki link with fragment (bug 2130)
1499 !! input
1500 [[MeatBall:SoftSecurity#foo]]
1501 !! result
1502 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1503 </p>
1504 !! end
1505
1506 ##
1507 ## XHTML tidiness
1508 ###
1509
1510 !! test
1511 <br> to <br />
1512 !! input
1513 1<br>2<br />3
1514 !! result
1515 <p>1<br />2<br />3
1516 </p>
1517 !! end
1518
1519 !! test
1520 Incorrecly removing closing slashes from correctly formed XHTML
1521 !! input
1522 <br style="clear:both;" />
1523 !! result
1524 <p><br style="clear:both;" />
1525 </p>
1526 !! end
1527
1528 !! test
1529 Failing to transform badly formed HTML into correct XHTML
1530 !! input
1531 <br clear=left>
1532 <br clear=right>
1533 <br clear=all>
1534 !! result
1535 <p><br clear="left" />
1536 <br clear="right" />
1537 <br clear="all" />
1538 </p>
1539 !!end
1540
1541 !! test
1542 Horizontal ruler (should it add that extra space?)
1543 !! input
1544 <hr>
1545 <hr >
1546 foo <hr
1547 > bar
1548 !! result
1549 <hr />
1550 <hr />
1551 foo <hr /> bar
1552
1553 !! end
1554
1555 ###
1556 ### Block-level elements
1557 ###
1558 !! test
1559 Common list
1560 !! input
1561 *Common list
1562 * item 2
1563 *item 3
1564 !! result
1565 <ul><li>Common list
1566 </li><li> item 2
1567 </li><li>item 3
1568 </li></ul>
1569
1570 !! end
1571
1572 !! test
1573 Numbered list
1574 !! input
1575 #Numbered list
1576 #item 2
1577 # item 3
1578 !! result
1579 <ol><li>Numbered list
1580 </li><li>item 2
1581 </li><li> item 3
1582 </li></ol>
1583
1584 !! end
1585
1586 !! test
1587 Mixed list
1588 !! input
1589 *Mixed list
1590 *# with numbers
1591 ** and bullets
1592 *# and numbers
1593 *bullets again
1594 **bullet level 2
1595 ***bullet level 3
1596 ***#Number on level 4
1597 **bullet level 2
1598 **#Number on level 3
1599 **#Number on level 3
1600 *#number level 2
1601 *Level 1
1602 !! result
1603 <ul><li>Mixed list
1604 <ol><li> with numbers
1605 </li></ol>
1606 <ul><li> and bullets
1607 </li></ul>
1608 <ol><li> and numbers
1609 </li></ol>
1610 </li><li>bullets again
1611 <ul><li>bullet level 2
1612 <ul><li>bullet level 3
1613 <ol><li>Number on level 4
1614 </li></ol>
1615 </li></ul>
1616 </li><li>bullet level 2
1617 <ol><li>Number on level 3
1618 </li><li>Number on level 3
1619 </li></ol>
1620 </li></ul>
1621 <ol><li>number level 2
1622 </li></ol>
1623 </li><li>Level 1
1624 </li></ul>
1625
1626 !! end
1627
1628 !! test
1629 List items are not parsed correctly following a <pre> block (bug 785)
1630 !! input
1631 * <pre>foo</pre>
1632 * <pre>bar</pre>
1633 * zar
1634 !! result
1635 <ul><li> <pre>foo</pre>
1636 </li><li> <pre>bar</pre>
1637 </li><li> zar
1638 </li></ul>
1639
1640 !! end
1641
1642 ###
1643 ### Magic Words
1644 ###
1645
1646 !! test
1647 Magic Word: {{CURRENTDAY}}
1648 !! input
1649 {{CURRENTDAY}}
1650 !! result
1651 <p>1
1652 </p>
1653 !! end
1654
1655 !! test
1656 Magic Word: {{CURRENTDAY2}}
1657 !! input
1658 {{CURRENTDAY2}}
1659 !! result
1660 <p>01
1661 </p>
1662 !! end
1663
1664 !! test
1665 Magic Word: {{CURRENTDAYNAME}}
1666 !! input
1667 {{CURRENTDAYNAME}}
1668 !! result
1669 <p>Thursday
1670 </p>
1671 !! end
1672
1673 !! test
1674 Magic Word: {{CURRENTDOW}}
1675 !! input
1676 {{CURRENTDOW}}
1677 !! result
1678 <p>4
1679 </p>
1680 !! end
1681
1682 !! test
1683 Magic Word: {{CURRENTMONTH}}
1684 !! input
1685 {{CURRENTMONTH}}
1686 !! result
1687 <p>01
1688 </p>
1689 !! end
1690
1691 !! test
1692 Magic Word: {{CURRENTMONTHABBREV}}
1693 !! input
1694 {{CURRENTMONTHABBREV}}
1695 !! result
1696 <p>Jan
1697 </p>
1698 !! end
1699
1700 !! test
1701 Magic Word: {{CURRENTMONTHNAME}}
1702 !! input
1703 {{CURRENTMONTHNAME}}
1704 !! result
1705 <p>January
1706 </p>
1707 !! end
1708
1709 !! test
1710 Magic Word: {{CURRENTMONTHNAMEGEN}}
1711 !! input
1712 {{CURRENTMONTHNAMEGEN}}
1713 !! result
1714 <p>January
1715 </p>
1716 !! end
1717
1718 !! test
1719 Magic Word: {{CURRENTTIME}}
1720 !! input
1721 {{CURRENTTIME}}
1722 !! result
1723 <p>00:02
1724 </p>
1725 !! end
1726
1727 !! test
1728 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1729 !! input
1730 {{CURRENTWEEK}}
1731 !! result
1732 <p>1
1733 </p>
1734 !! end
1735
1736 !! test
1737 Magic Word: {{CURRENTYEAR}}
1738 !! input
1739 {{CURRENTYEAR}}
1740 !! result
1741 <p>1970
1742 </p>
1743 !! end
1744
1745 !! test
1746 Magic Word: {{FULLPAGENAME}}
1747 !! options
1748 title=[[User:Ævar Arnfjörð Bjarmason]]
1749 !! input
1750 {{FULLPAGENAME}}
1751 !! result
1752 <p>User:Ævar Arnfjörð Bjarmason
1753 </p>
1754 !! end
1755
1756 !! test
1757 Magic Word: {{FULLPAGENAMEE}}
1758 !! options
1759 title=[[User:Ævar Arnfjörð Bjarmason]]
1760 !! input
1761 {{FULLPAGENAMEE}}
1762 !! result
1763 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1764 </p>
1765 !! end
1766
1767 !! test
1768 Magic Word: {{NAMESPACE}}
1769 !! options
1770 title=[[User:Ævar Arnfjörð Bjarmason]]
1771 disabled # FIXME
1772 !! input
1773 {{NAMESPACE}}
1774 !! result
1775 <p>User
1776 </p>
1777 !! end
1778
1779 !! test
1780 Magic Word: {{NAMESPACEE}}
1781 !! options
1782 title=[[User:Ævar Arnfjörð Bjarmason]]
1783 disabled # FIXME
1784 !! input
1785 {{NAMESPACEE}}
1786 !! result
1787 <p>User
1788 </p>
1789 !! end
1790
1791 !! test
1792 Magic Word: {{NUMBEROFARTICLES}}
1793 !! input
1794 {{NUMBEROFARTICLES}}
1795 !! result
1796 <p>1
1797 </p>
1798 !! end
1799
1800 !! test
1801 Magic Word: {{NUMBEROFFILES}}
1802 !! input
1803 {{NUMBEROFFILES}}
1804 !! result
1805 <p>1
1806 </p>
1807 !! end
1808
1809 !! test
1810 Magic Word: {{PAGENAME}}
1811 !! options
1812 title=[[User:Ævar Arnfjörð Bjarmason]]
1813 disabled # FIXME
1814 !! input
1815 {{PAGENAME}}
1816 !! result
1817 <p>Ævar Arnfjörð Bjarmason
1818 </p>
1819 !! end
1820
1821 !! test
1822 Magic Word: {{PAGENAMEE}}
1823 !! options
1824 title=[[User:Ævar Arnfjörð Bjarmason]]
1825 !! input
1826 {{PAGENAMEE}}
1827 !! result
1828 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1829 </p>
1830 !! end
1831
1832 !! test
1833 Magic Word: {{REVISIONID}}
1834 !! input
1835 {{REVISIONID}}
1836 !! result
1837 <p>1337
1838 </p>
1839 !! end
1840
1841 !! test
1842 Magic Word: {{SCRIPTPATH}}
1843 !! input
1844 {{SCRIPTPATH}}
1845 !! result
1846 <p>/
1847 </p>
1848 !! end
1849
1850 !! test
1851 Magic Word: {{SERVER}}
1852 !! input
1853 {{SERVER}}
1854 !! result
1855 <p><a href="http://localhost" class='external free' title="http://localhost" rel="nofollow">http://localhost</a>
1856 </p>
1857 !! end
1858
1859 !! test
1860 Magic Word: {{SERVERNAME}}
1861 !! input
1862 {{SERVERNAME}}
1863 !! result
1864 <p>Britney Spears
1865 </p>
1866 !! end
1867
1868 !! test
1869 Magic Word: {{SITENAME}}
1870 !! input
1871 {{SITENAME}}
1872 !! result
1873 <p>MediaWiki
1874 </p>
1875 !! end
1876
1877 !! test
1878 Namespace 1 {{ns:1}}
1879 !! input
1880 {{ns:1}}
1881 !! result
1882 <p>Talk
1883 </p>
1884 !! end
1885
1886 !! test
1887 Namespace 1 {{ns:01}}
1888 !! input
1889 {{ns:01}}
1890 !! result
1891 <p>Talk
1892 </p>
1893 !! end
1894
1895 !! test
1896 Namespace 0 {{ns:0}} (bug 4783)
1897 !! input
1898 {{ns:0}}
1899 !! result
1900
1901 !! end
1902
1903 !! test
1904 Namespace 0 {{ns:00}} (bug 4783)
1905 !! input
1906 {{ns:00}}
1907 !! result
1908
1909 !! end
1910
1911 !! test
1912 Namespace -1 {{ns:-1}}
1913 !! input
1914 {{ns:-1}}
1915 !! result
1916 <p>Special
1917 </p>
1918 !! end
1919
1920 !! test
1921 Namespace Project {{ns:User}}
1922 !! input
1923 {{ns:User}}
1924 !! result
1925 <p>User
1926 </p>
1927 !! end
1928
1929
1930 ###
1931 ### Magic links
1932 ###
1933 !! test
1934 Magic links: internal link to RFC (bug 479)
1935 !! input
1936 [[RFC 123]]
1937 !! result
1938 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1939 </p>
1940 !! end
1941
1942 !! test
1943 Magic links: RFC (bug 479)
1944 !! input
1945 RFC 822
1946 !! result
1947 <p><a href='http://www.ietf.org/rfc/rfc822.txt' class='external' title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1948 </p>
1949 !! end
1950
1951 !! test
1952 Magic links: ISBN (bug 1937)
1953 !! input
1954 ISBN 0-306-40615-2
1955 !! result
1956 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1957 </p>
1958 !! end
1959
1960 !! test
1961 Magic links: PMID incorrectly converts space to underscore
1962 !! input
1963 PMID 1234
1964 !! result
1965 <p><a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234' class='external' title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234">PMID 1234</a>
1966 </p>
1967 !! end
1968
1969 ###
1970 ### Templates
1971 ####
1972
1973 !! test
1974 Nonexistant template
1975 !! input
1976 {{thistemplatedoesnotexist}}
1977 !! result
1978 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1979 </p>
1980 !! end
1981
1982 !! article
1983 Template:test
1984 !! text
1985 This is a test template
1986 !! endarticle
1987
1988 !! test
1989 Simple template
1990 !! input
1991 {{test}}
1992 !! result
1993 <p>This is a test template
1994 </p>
1995 !! end
1996
1997 !! test
1998 Template with explicit namespace
1999 !! input
2000 {{Template:test}}
2001 !! result
2002 <p>This is a test template
2003 </p>
2004 !! end
2005
2006
2007 !! article
2008 Template:paramtest
2009 !! text
2010 This is a test template with parameter {{{param}}}
2011 !! endarticle
2012
2013 !! test
2014 Template parameter
2015 !! input
2016 {{paramtest|param=foo}}
2017 !! result
2018 <p>This is a test template with parameter foo
2019 </p>
2020 !! end
2021
2022 !! article
2023 Template:paramtestnum
2024 !! text
2025 [[{{{1}}}|{{{2}}}]]
2026 !! endarticle
2027
2028 !! test
2029 Template unnamed parameter
2030 !! input
2031 {{paramtestnum|Main Page|the main page}}
2032 !! result
2033 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2034 </p>
2035 !! end
2036
2037 !! article
2038 Template:templatesimple
2039 !! text
2040 (test)
2041 !! endarticle
2042
2043 !! article
2044 Template:templateredirect
2045 !! text
2046 #redirect [[Template:templatesimple]]
2047 !! endarticle
2048
2049 !! article
2050 Template:templateasargtestnum
2051 !! text
2052 {{{{{1}}}}}
2053 !! endarticle
2054
2055 !! article
2056 Template:templateasargtest
2057 !! text
2058 {{template{{{templ}}}}}
2059 !! endarticle
2060
2061 !! article
2062 Template:templateasargtest2
2063 !! text
2064 {{{{{templ}}}}}
2065 !! endarticle
2066
2067 !! test
2068 Template with template name as unnamed argument
2069 !! input
2070 {{templateasargtestnum|templatesimple}}
2071 !! result
2072 <p>(test)
2073 </p>
2074 !! end
2075
2076 !! test
2077 Template with template name as argument
2078 !! input
2079 {{templateasargtest|templ=simple}}
2080 !! result
2081 <p>(test)
2082 </p>
2083 !! end
2084
2085 !! test
2086 Template with template name as argument (2)
2087 !! input
2088 {{templateasargtest2|templ=templatesimple}}
2089 !! result
2090 <p>(test)
2091 </p>
2092 !! end
2093
2094 !! article
2095 Template:templateasargtestdefault
2096 !! text
2097 {{{{{templ|templatesimple}}}}}
2098 !! endarticle
2099
2100 !! article
2101 Template:templa
2102 !! text
2103 '''templ'''
2104 !! endarticle
2105
2106 !! test
2107 Template with default value
2108 !! input
2109 {{templateasargtestdefault}}
2110 !! result
2111 <p>(test)
2112 </p>
2113 !! end
2114
2115 !! test
2116 Template with default value (value set)
2117 !! input
2118 {{templateasargtestdefault|templ=templa}}
2119 !! result
2120 <p><b>templ</b>
2121 </p>
2122 !! end
2123
2124 !! test
2125 Template redirect
2126 !! input
2127 {{templateredirect}}
2128 !! result
2129 <p>(test)
2130 </p>
2131 !! end
2132
2133 !! test
2134 Template with argument in separate line
2135 !! input
2136 {{ templateasargtest |
2137 templ = simple }}
2138 !! result
2139 <p>(test)
2140 </p>
2141 !! end
2142
2143 !! test
2144 Template with complex template as argument
2145 !! input
2146 {{paramtest|
2147 param ={{ templateasargtest |
2148 templ = simple }}}}
2149 !! result
2150 <p>This is a test template with parameter (test)
2151 </p>
2152 !! end
2153
2154 !! test
2155 Template with thumb image (wiht link in description)
2156 !! input
2157 {{paramtest|
2158 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2159 !! result
2160 This is a test template with parameter <div class="thumb tright"><div style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="Image:Noimage.png">Image:Noimage.png</a> <div class="thumbcaption" ><a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">link</a> <a href="/index.php?title=No_link&amp;action=edit" class="new" title="No link">caption</a></div></div></div>
2161
2162 !! end
2163
2164 !! article
2165 Template:complextemplate
2166 !! text
2167 {{{1}}} {{paramtest|
2168 param ={{{param}}}}}
2169 !! endarticle
2170
2171 !! test
2172 Template with complex arguments
2173 !! input
2174 {{complextemplate|
2175 param ={{ templateasargtest |
2176 templ = simple }}|[[Template:complextemplate|link]]}}
2177 !! result
2178 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2179 </p>
2180 !! end
2181
2182 !! test
2183 BUG 553: link with two variables in a piped link
2184 !! input
2185 {|
2186 |[[{{{1}}}|{{{2}}}]]
2187 |}
2188 !! result
2189 <table>
2190 <tr>
2191 <td>[[{{{1}}}|{{{2}}}]]
2192 </td></tr></table>
2193
2194 !! end
2195
2196 !! test
2197 Magic variable as template parameter
2198 !! input
2199 {{paramtest|param={{SITENAME}}}}
2200 !! result
2201 <p>This is a test template with parameter MediaWiki
2202 </p>
2203 !! end
2204
2205 !! article
2206 Template:linktest
2207 !! text
2208 [[{{{param}}}|link]]
2209 !! endarticle
2210
2211 !! test
2212 Template parameter as link source
2213 !! input
2214 {{linktest|param=Main Page}}
2215 !! result
2216 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2217 </p>
2218 !! end
2219
2220
2221 !!article
2222 Template:paramtest2
2223 !! text
2224 including another template, {{paramtest|param={{{arg}}}}}
2225 !! endarticle
2226
2227 !! test
2228 Template passing argument to another template
2229 !! input
2230 {{paramtest2|arg='hmm'}}
2231 !! result
2232 <p>including another template, This is a test template with parameter 'hmm'
2233 </p>
2234 !! end
2235
2236 !! article
2237 Template:Linktest2
2238 !! text
2239 Main Page
2240 !! endarticle
2241
2242 !! test
2243 Template as link source
2244 !! input
2245 [[{{linktest2}}]]
2246 !! result
2247 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2248 </p>
2249 !! end
2250
2251
2252 !! article
2253 Template:loop1
2254 !! text
2255 {{loop2}}
2256 !! endarticle
2257
2258 !! article
2259 Template:loop2
2260 !! text
2261 {{loop1}}
2262 !! endarticle
2263
2264 !! test
2265 Template infinite loop
2266 !! input
2267 {{loop1}}
2268 !! result
2269 <p>{{loop1}}<!-- WARNING: template loop detected -->
2270 </p>
2271 !! end
2272
2273 !! test
2274 Template from main namespace
2275 !! input
2276 {{:Main Page}}
2277 !! result
2278 <p>blah blah
2279 </p>
2280 !! end
2281
2282 !! article
2283 Template:table
2284 !! text
2285 {|
2286 | 1 || 2
2287 |-
2288 | 3 || 4
2289 |}
2290 !! endarticle
2291
2292 !! test
2293 BUG 529: Template with table, not included at beginning of line
2294 !! input
2295 foo {{table}}
2296 !! result
2297 <p>foo
2298 </p>
2299 <table>
2300 <tr>
2301 <td> 1 </td><td> 2
2302 </td></tr>
2303 <tr>
2304 <td> 3 </td><td> 4
2305 </td></tr></table>
2306
2307 !! end
2308
2309 !! test
2310 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2311 !! input
2312 foo
2313 {{table}}
2314 !! result
2315 <p>foo
2316 </p>
2317 <table>
2318 <tr>
2319 <td> 1 </td><td> 2
2320 </td></tr>
2321 <tr>
2322 <td> 3 </td><td> 4
2323 </td></tr></table>
2324
2325 !! end
2326
2327 !! test
2328 BUG 41: Template parameters shown as broken links
2329 !! input
2330 {{{parameter}}}
2331 !! result
2332 <p>{{{parameter}}}
2333 </p>
2334 !! end
2335
2336
2337 !! article
2338 Template:MSGNW test
2339 !! text
2340 ''None'' of '''this''' should be
2341 * interepreted
2342 but rather passed unmodified
2343 {{test}}
2344 !! endarticle
2345
2346 # hmm, fix this or just deprecate msgnw and document its behavior?
2347 !! test
2348 msgnw keyword
2349 !! options
2350 disabled
2351 !! input
2352 {{msgnw:MSGNW test}}
2353 !! result
2354 <p>''None'' of '''this''' should be
2355 * interepreted
2356 but rather passed unmodified
2357 {{test}}
2358 </p>
2359 !! end
2360
2361 !! test
2362 int keyword
2363 !! input
2364 {{int:youhavenewmessages|lots of money|not!}}
2365 !! result
2366 <p>You have lots of money (not!).
2367 </p>
2368 !! end
2369
2370 !! article
2371 Template:Includes
2372 !! text
2373 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2374 !! endarticle
2375
2376 !! test
2377 <includeonly> and <noinclude> being included
2378 !! input
2379 {{Includes}}
2380 !! result
2381 <p>Foobar
2382 </p>
2383 !! end
2384
2385 !! article
2386 Template:Includes2
2387 !! text
2388 <onlyinclude>Foo</onlyinclude>bar
2389 !! endarticle
2390
2391 !! test
2392 <onlyinclude> being included
2393 !! input
2394 {{Includes2}}
2395 !! result
2396 <p>Foo
2397 </p>
2398 !! end
2399
2400
2401 !! article
2402 Template:Includes3
2403 !! text
2404 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2405 !! endarticle
2406
2407 !! test
2408 <onlyinclude> and <includeonly> being included
2409 !! input
2410 {{Includes3}}
2411 !! result
2412 <p>Foo
2413 </p>
2414 !! end
2415
2416 !! test
2417 <includeonly> and <noinclude> on a page
2418 !! input
2419 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2420 !! result
2421 <p>Foozar
2422 </p>
2423 !! end
2424
2425 !! test
2426 <onlyinclude> on a page
2427 !! input
2428 <onlyinclude>Foo</onlyinclude>bar
2429 !! result
2430 <p>Foobar
2431 </p>
2432 !! end
2433
2434 ###
2435 ### Pre-save transform tests
2436 ###
2437 !! test
2438 pre-save transform: subst:
2439 !! options
2440 PST
2441 !! input
2442 {{subst:test}}
2443 !! result
2444 This is a test template
2445 !! end
2446
2447 !! test
2448 pre-save transform: normal template
2449 !! options
2450 PST
2451 !! input
2452 {{test}}
2453 !! result
2454 {{test}}
2455 !! end
2456
2457 !! test
2458 pre-save transform: nonexistant template
2459 !! options
2460 PST
2461 !! input
2462 {{thistemplatedoesnotexist}}
2463 !! result
2464 {{thistemplatedoesnotexist}}
2465 !! end
2466
2467
2468 !! test
2469 pre-save transform: subst magic variables
2470 !! options
2471 PST
2472 !! input
2473 {{subst:SITENAME}}
2474 !! result
2475 MediaWiki
2476 !! end
2477
2478 # This is bug 89, which I fixed. -- wtm
2479 !! test
2480 pre-save transform: subst: templates with parameters
2481 !! options
2482 pst
2483 !! input
2484 {{subst:paramtest|param="something else"}}
2485 !! result
2486 This is a test template with parameter "something else"
2487 !! end
2488
2489 !! article
2490 Template:nowikitest
2491 !! text
2492 <nowiki>'''not wiki'''</nowiki>
2493 !! endarticle
2494
2495 !! test
2496 pre-save transform: nowiki in subst (bug 1188)
2497 !! options
2498 pst
2499 !! input
2500 {{subst:nowikitest}}
2501 !! result
2502 <nowiki>'''not wiki'''</nowiki>
2503 !! end
2504
2505
2506 !! article
2507 Template:commenttest
2508 !! text
2509 This template has <!-- a comment --> in it.
2510 !! endarticle
2511
2512 !! test
2513 pre-save transform: comment in subst (bug 1936)
2514 !! options
2515 pst
2516 !! input
2517 {{subst:commenttest}}
2518 !! result
2519 This template has <!-- a comment --> in it.
2520 !! end
2521
2522 !! test
2523 pre-save transform: unclosed tag
2524 !! options
2525 pst noxml
2526 !! input
2527 <nowiki>'''not wiki'''
2528 !! result
2529 <nowiki>'''not wiki'''
2530 !! end
2531
2532 !! test
2533 pre-save transform: mixed tag case
2534 !! options
2535 pst noxml
2536 !! input
2537 <NOwiki>'''not wiki'''</noWIKI>
2538 !! result
2539 <NOwiki>'''not wiki'''</noWIKI>
2540 !! end
2541
2542 !! test
2543 pre-save transform: unclosed comment in <nowiki>
2544 !! options
2545 pst noxml
2546 !! input
2547 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2548 !! result
2549 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2550 !!end
2551
2552 !! article
2553 Template:dangerous
2554 !!text
2555 <span onmouseover="alert('crap')">Oh no</span>
2556 !!endarticle
2557
2558 !!test
2559 (confirming safety of fix for subst bug 1936)
2560 !! input
2561 {{Template:dangerous}}
2562 !! result
2563 <p><span>Oh no</span>
2564 </p>
2565 !! end
2566
2567 !! test
2568 pre-save transform: comment containing gallery (bug 5024)
2569 !! options
2570 pst
2571 !! input
2572 <!-- <gallery>data</gallery> -->
2573 !!result
2574 <!-- <gallery>data</gallery> -->
2575 !!end
2576
2577 !! test
2578 pre-save transform: comment containing extension
2579 !! options
2580 pst
2581 !! input
2582 <!-- <tag>data</tag> -->
2583 !!result
2584 <!-- <tag>data</tag> -->
2585 !!end
2586
2587 !! test
2588 pre-save transform: comment containing nowiki
2589 !! options
2590 pst
2591 !! input
2592 <!-- <nowiki>data</nowiki> -->
2593 !!result
2594 <!-- <nowiki>data</nowiki> -->
2595 !!end
2596
2597 !! test
2598 pre-save transform: comment containing math
2599 !! options
2600 pst
2601 !! input
2602 <!-- <math>data</math> -->
2603 !!result
2604 <!-- <math>data</math> -->
2605 !!end
2606
2607
2608 ###
2609 ### Message transform tests
2610 ###
2611 !! test
2612 message transform: magic variables
2613 !! options
2614 msg
2615 !! input
2616 {{SITENAME}}
2617 !! result
2618 MediaWiki
2619 !! end
2620
2621 !! test
2622 message transform: should not transform wiki markup
2623 !! options
2624 msg
2625 !! input
2626 ''test''
2627 !! result
2628 ''test''
2629 !! end
2630
2631 ###
2632 ### Images
2633 ###
2634 !! test
2635 Simple image
2636 !! input
2637 [[Image:foobar.jpg]]
2638 !! result
2639 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2640 </p>
2641 !! end
2642
2643 !! test
2644 Right-aligned image
2645 !! input
2646 [[Image:foobar.jpg|right]]
2647 !! result
2648 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2649
2650 !! end
2651
2652 !! test
2653 Image with caption
2654 !! input
2655 [[Image:foobar.jpg|right|Caption text]]
2656 !! result
2657 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Caption text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2658
2659 !! end
2660
2661 !! test
2662 Image with frame and link
2663 !! input
2664 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2665 !! result
2666 <div class="thumb tleft"><div style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This is a test image Main Page" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
2667
2668 !! end
2669
2670 !! test
2671 Link to image page- image page normally doesn't exists, hence edit link
2672 TODO: Add test with existing image page
2673 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2674 !! input
2675 [[:Image:test]]
2676 !! result
2677 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2678 </p>
2679 !! end
2680
2681 !! test
2682 Frameless image caption with a free URL
2683 !! input
2684 [[Image:foobar.jpg|http://example.com]]
2685 !! result
2686 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="http://example.com" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2687 </p>
2688 !! end
2689
2690 !! test
2691 Thumbnail image caption with a free URL
2692 !! input
2693 [[Image:foobar.jpg|thumb|http://example.com]]
2694 !! result
2695 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="http://example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
2696
2697 !! end
2698
2699 !! test
2700 BUG 1887: A ISBN with a thumbnail
2701 !! input
2702 [[Image:foobar.jpg|thumb|ISBN 12354]]
2703 !! result
2704 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="ISBN 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=12354" class="internal">ISBN 12354</a></div></div></div>
2705
2706 !! end
2707
2708 !! test
2709 BUG 1887: A RFC with a thumbnail
2710 !! input
2711 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2712 !! result
2713 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is RFC 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is <a href='http://www.ietf.org/rfc/rfc12354.txt' class='external' title="http://www.ietf.org/rfc/rfc12354.txt">RFC 12354</a></div></div></div>
2714
2715 !! end
2716
2717 !! test
2718 BUG 1887: A mailto link with a thumbnail
2719 !! input
2720 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2721 !! result
2722 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="Please mailto:nobody@example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>Please <a href="mailto:nobody@example.com" class='external free' title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
2723
2724 !! end
2725
2726 !! test
2727 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2728 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2729 !! input
2730 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2731 !! result
2732 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="&lt;math&gt;2+2&lt;/math&gt;" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
2733
2734 !! end
2735
2736 !! test
2737 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2738 !! options
2739 math
2740 !! input
2741 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2742 !! result
2743 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="2 + 2" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
2744
2745 !! end
2746
2747 # Pending resolution to bug 368
2748 !! test
2749 BUG 648: Frameless image caption with a link
2750 !! input
2751 [[Image:foobar.jpg|text with a [[link]] in it]]
2752 !! result
2753 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2754 </p>
2755 !! end
2756
2757 !! test
2758 BUG 648: Frameless image caption with a link (suffix)
2759 !! input
2760 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2761 !! result
2762 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a linkfoo in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2763 </p>
2764 !! end
2765
2766 !! test
2767 BUG 648: Frameless image caption with an interwiki link
2768 !! input
2769 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2770 !! result
2771 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a MeatBall:Link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2772 </p>
2773 !! end
2774
2775 !! test
2776 BUG 648: Frameless image caption with a piped interwiki link
2777 !! input
2778 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2779 !! result
2780 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2781 </p>
2782 !! end
2783
2784 !! test
2785 Escape HTML special chars in image alt text
2786 !! input
2787 [[Image:foobar.jpg|& < > "]]
2788 !! result
2789 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2790 </p>
2791 !! end
2792
2793 !! test
2794 BUG 499: Alt text should have &#1234;, not &amp;1234;
2795 !! input
2796 [[Image:foobar.jpg|&#9792;]]
2797 !! result
2798 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&#9792;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2799 </p>
2800 !! end
2801
2802 !! test
2803 Broken image caption with link
2804 !! input
2805 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
2806 !! result
2807 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
2808 </p>
2809 !! end
2810
2811 !! test
2812 Image caption containing another image
2813 !! input
2814 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
2815 !! result
2816 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is a caption with another Image:Icon.png inside it!" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
2817
2818 !! end
2819
2820 !! test
2821 Image caption containing a newline
2822 !! input
2823 [[Image:Foobar.jpg|This
2824 *is some text]]
2825 !! result
2826 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This *is some text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2827 </p>
2828 !!end
2829
2830
2831 !! test
2832 Bug 3090: External links other than http: in image captions
2833 !! input
2834 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
2835 !! result
2836 <div class="thumb tright"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" alt="This caption has irc and Secure ext links in it." width="200" height="23" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div>This caption has <a href="irc://example.net" class='external text' title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class='external text' title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
2837
2838 !! end
2839
2840
2841 ###
2842 ### Subpages
2843 ###
2844 !! article
2845 Subpage test/subpage
2846 !! text
2847 foo
2848 !! endarticle
2849
2850 !! test
2851 Subpage link
2852 !! options
2853 subpage title=[[Subpage test]]
2854 !! input
2855 [[/subpage]]
2856 !! result
2857 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
2858 </p>
2859 !! end
2860
2861 !! test
2862 Subpage noslash link
2863 !! options
2864 subpage title=[[Subpage test]]
2865 !!input
2866 [[/subpage/]]
2867 !! result
2868 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
2869 </p>
2870 !! end
2871
2872 !! test
2873 Disabled subpages
2874 !! input
2875 [[/subpage]]
2876 !! result
2877 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
2878 </p>
2879 !! end
2880
2881 !! test
2882 BUG 561: {{/Subpage}}
2883 !! options
2884 subpage title=[[Page]]
2885 !! input
2886 {{/Subpage}}
2887 !! result
2888 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
2889 </p>
2890 !! end
2891
2892 ###
2893 ### Categories
2894 ###
2895 !! article
2896 Category:MediaWiki User's Guide
2897 !! text
2898 blah
2899 !! endarticle
2900
2901 !! test
2902 Link to category
2903 !! input
2904 [[:Category:MediaWiki User's Guide]]
2905 !! result
2906 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
2907 </p>
2908 !! end
2909
2910 !! test
2911 Simple category
2912 !! options
2913 cat
2914 !! input
2915 [[Category:MediaWiki User's Guide]]
2916 !! result
2917 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
2918 !! end
2919
2920 ###
2921 ### Inter-language links
2922 ###
2923 !! test
2924 Inter-language links
2925 !! options
2926 ill
2927 !! input
2928 [[es:Alimento]]
2929 [[fr:Nourriture]]
2930 [[zh:&#39135;&#21697;]]
2931 !! result
2932 es:Alimento fr:Nourriture zh:食品
2933 !! end
2934
2935 ###
2936 ### Sections
2937 ###
2938 !! test
2939 Basic section headings
2940 !! options
2941 title=[[Parser test script]]
2942 !! input
2943 == Headline 1 ==
2944 Some text
2945
2946 ==Headline 2==
2947 More
2948 ===Smaller headline===
2949 Blah blah
2950 !! result
2951 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
2952 <p>Some text
2953 </p>
2954 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
2955 <p>More
2956 </p>
2957 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
2958 <p>Blah blah
2959 </p>
2960 !! end
2961
2962 !! test
2963 Section headings with TOC
2964 !! options
2965 title=[[Parser test script]]
2966 !! input
2967 == Headline 1 ==
2968 === Subheadline 1 ===
2969 ===== Skipping a level =====
2970 ====== Skipping a level ======
2971
2972 == Headline 2 ==
2973 Some text
2974 ===Another headline===
2975 !! result
2976 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
2977 <ul>
2978 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
2979 <ul>
2980 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
2981 <ul>
2982 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
2983 <ul>
2984 <li class='toclevel-4'><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
2985 </ul>
2986 </li>
2987 </ul>
2988 </li>
2989 </ul>
2990 </li>
2991 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
2992 <ul>
2993 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
2994 </ul>
2995 </li>
2996 </ul>
2997 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
2998 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
2999 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
3000 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
3001 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
3002 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
3003 <p>Some text
3004 </p>
3005 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
3006
3007 !! end
3008
3009 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3010 !! test
3011 Handling of sections up to level 6 and beyond
3012 !! input
3013 = Level 1 Heading=
3014 == Level 2 Heading==
3015 === Level 3 Heading===
3016 ==== Level 4 Heading====
3017 ===== Level 5 Heading=====
3018 ====== Level 6 Heading======
3019 ======= Level 7 Heading=======
3020 ======== Level 8 Heading========
3021 ========= Level 9 Heading=========
3022 ========== Level 10 Heading==========
3023 !! result
3024 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3025 <ul>
3026 <li class='toclevel-1'><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3027 <ul>
3028 <li class='toclevel-2'><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3029 <ul>
3030 <li class='toclevel-3'><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3031 <ul>
3032 <li class='toclevel-4'><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
3033 <ul>
3034 <li class='toclevel-5'><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
3035 <ul>
3036 <li class='toclevel-6'><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
3037 <li class='toclevel-6'><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
3038 <li class='toclevel-6'><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
3039 <li class='toclevel-6'><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
3040 <li class='toclevel-6'><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
3041 </ul>
3042 </li>
3043 </ul>
3044 </li>
3045 </ul>
3046 </li>
3047 </ul>
3048 </li>
3049 </ul>
3050 </li>
3051 </ul>
3052 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3053 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</div><a name="Level_1_Heading"></a><h1> Level 1 Heading</h1>
3054 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</div><a name="Level_2_Heading"></a><h2> Level 2 Heading</h2>
3055 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</div><a name="Level_3_Heading"></a><h3> Level 3 Heading</h3>
3056 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</div><a name="Level_4_Heading"></a><h4> Level 4 Heading</h4>
3057 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</div><a name="Level_5_Heading"></a><h5> Level 5 Heading</h5>
3058 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</div><a name="Level_6_Heading"></a><h6> Level 6 Heading</h6>
3059 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</div><a name=".3D_Level_7_Heading.3D"></a><h6>= Level 7 Heading=</h6>
3060 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</div><a name=".3D.3D_Level_8_Heading.3D.3D"></a><h6>== Level 8 Heading==</h6>
3061 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</div><a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6>=== Level 9 Heading===</h6>
3062 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</div><a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6>==== Level 10 Heading====</h6>
3063
3064 !! end
3065
3066 !! test
3067 Resolving duplicate section names
3068 !! options
3069 title=[[Parser test script]]
3070 !! input
3071 == Foo bar ==
3072 == Foo bar ==
3073 !! result
3074 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
3075 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</div><a name="Foo_bar_2"></a><h2> Foo bar </h2>
3076
3077 !! end
3078
3079 !! article
3080 Template:sections
3081 !! text
3082 ===Section 1===
3083 ==Section 2==
3084 !! endarticle
3085
3086 !! test
3087 Template with sections, __NOTOC__
3088 !! options
3089 title=[[Parser test script]]
3090 !! input
3091 __NOTOC__
3092 ==Section 0==
3093 {{sections}}
3094 ==Section 4==
3095 !! result
3096 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
3097 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
3098 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
3099 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
3100
3101 !! end
3102
3103 !! test
3104 __NOEDITSECTION__ keyword
3105 !! input
3106 __NOEDITSECTION__
3107 ==Section 1==
3108 ==Section 2==
3109 !! result
3110 <a name="Section_1"></a><h2>Section 1</h2>
3111 <a name="Section_2"></a><h2>Section 2</h2>
3112
3113 !! end
3114
3115 !! test
3116 Link inside a section heading
3117 !! options
3118 title=[[Parser test script]]
3119 !! input
3120 ==Section with a [[Main Page|link]] in it==
3121 !! result
3122 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</div><a name="Section_with_a_link_in_it"></a><h2>Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</h2>
3123
3124 !! end
3125
3126
3127 !! test
3128 BUG 1219 URL next to image (good)
3129 !! input
3130 http://example.com [[Image:foobar.jpg]]
3131 !! result
3132 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3133 </p>
3134 !!end
3135
3136 !! test
3137 BUG 1219 URL next to image (broken)
3138 !! input
3139 http://example.com[[Image:foobar.jpg]]
3140 !! result
3141 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3142 </p>
3143 !!end
3144
3145 !! test
3146 Bug 1186 news: in the middle of text
3147 !! input
3148 http://en.wikinews.org/wiki/Wikinews:Workplace
3149 !! result
3150 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class='external free' title="http://en.wikinews.org/wiki/Wikinews:Workplace" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3151 </p>
3152 !!end
3153
3154
3155 !! test
3156 Namespaced link must have a title
3157 !! input
3158 [[Project:]]
3159 !! result
3160 <p>[[Project:]]
3161 </p>
3162 !!end
3163
3164 !! test
3165 Namespaced link must have a title (bad fragment version)
3166 !! input
3167 [[Project:#fragment]]
3168 !! result
3169 <p>[[Project:#fragment]]
3170 </p>
3171 !!end
3172
3173
3174 !! test
3175 div with no attributes
3176 !! input
3177 <div>HTML rocks</div>
3178 !! result
3179 <div>HTML rocks</div>
3180
3181 !! end
3182
3183 !! test
3184 div with double-quoted attribute
3185 !! input
3186 <div id="rock">HTML rocks</div>
3187 !! result
3188 <div id="rock">HTML rocks</div>
3189
3190 !! end
3191
3192 !! test
3193 div with single-quoted attribute
3194 !! input
3195 <div id='rock'>HTML rocks</div>
3196 !! result
3197 <div id="rock">HTML rocks</div>
3198
3199 !! end
3200
3201 !! test
3202 div with unquoted attribute
3203 !! input
3204 <div id=rock>HTML rocks</div>
3205 !! result
3206 <div id="rock">HTML rocks</div>
3207
3208 !! end
3209
3210 !! test
3211 div with illegal double attributes
3212 !! input
3213 <div align="center" align="right">HTML rocks</div>
3214 !! result
3215 <div align="right">HTML rocks</div>
3216
3217 !!end
3218
3219 !! test
3220 HTML multiple attributes correction
3221 !! input
3222 <p class="error" class="awesome">Awesome!</p>
3223 !! result
3224 <p class="awesome">Awesome!</p>
3225
3226 !!end
3227
3228 !! test
3229 Table multiple attributes correction
3230 !! input
3231 {|
3232 !+ class="error" class="awesome"| status
3233 |}
3234 !! result
3235 <table>
3236 <tr>
3237 <th class="awesome"> status
3238 </th></tr></table>
3239
3240 !!end
3241
3242 !! test
3243 DIV IN UPPERCASE
3244 !! input
3245 <DIV ALIGN="center">HTML ROCKS</DIV>
3246 !! result
3247 <div align="center">HTML ROCKS</div>
3248
3249 !!end
3250
3251
3252 !! test
3253 text with amp in the middle of nowhere
3254 !! input
3255 Remember AT&T?
3256 !!result
3257 <p>Remember AT&amp;T?
3258 </p>
3259 !! end
3260
3261 !! test
3262 text with character entity: eacute
3263 !! input
3264 I always thought &eacute; was a cute letter.
3265 !! result
3266 <p>I always thought &eacute; was a cute letter.
3267 </p>
3268 !! end
3269
3270 !! test
3271 text with undefined character entity: xacute
3272 !! input
3273 I always thought &xacute; was a cute letter.
3274 !! result
3275 <p>I always thought &amp;xacute; was a cute letter.
3276 </p>
3277 !! end
3278
3279
3280 ###
3281 ### Media links
3282 ###
3283
3284 !! test
3285 Media link
3286 !! input
3287 [[Media:Foobar.jpg]]
3288 !! result
3289 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 Media link with text
3295 !! input
3296 [[Media:Foobar.jpg|A neat file to look at]]
3297 !! result
3298 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
3299 </p>
3300 !! end
3301
3302 # FIXME: this is still bad HTML tag nesting
3303 !! test
3304 Media link with nasty text
3305 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3306 !! input
3307 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3308 !! result
3309 <a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
3310
3311 !! end
3312
3313 !! test
3314 Media link to nonexistent file (bug 1702)
3315 !! input
3316 [[Media:No such.jpg]]
3317 !! result
3318 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class='new' title="No such.jpg">Media:No such.jpg</a>
3319 </p>
3320 !! end
3321
3322 !! test
3323 Image link to nonexistent file (bug 1850 - good)
3324 !! input
3325 [[Image:No such.jpg]]
3326 !! result
3327 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3328 </p>
3329 !! end
3330
3331 !! test
3332 :Image link to nonexistent file (bug 1850 - bad)
3333 !! input
3334 [[:Image:No such.jpg]]
3335 !! result
3336 <p><a href="/index.php?title=Image:No_such.jpg&amp;action=edit" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3337 </p>
3338 !! end
3339
3340
3341
3342 !! test
3343 Character reference normalization in link text (bug 1938)
3344 !! input
3345 [[Main Page|this&that]]
3346 !! result
3347 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3348 </p>
3349 !!end
3350
3351 !! test
3352 Empty attribute crash test (bug 2067)
3353 !! input
3354 <font color="">foo</font>
3355 !! result
3356 <p><font color="">foo</font>
3357 </p>
3358 !! end
3359
3360 !! test
3361 Empty attribute crash test single-quotes (bug 2067)
3362 !! input
3363 <font color=''>foo</font>
3364 !! result
3365 <p><font color="">foo</font>
3366 </p>
3367 !! end
3368
3369 !! test
3370 Attribute test: equals, then nothing
3371 !! input
3372 <font color=>foo</font>
3373 !! result
3374 <p><font>foo</font>
3375 </p>
3376 !! end
3377
3378 !! test
3379 Attribute test: unquoted value
3380 !! input
3381 <font color=x>foo</font>
3382 !! result
3383 <p><font color="x">foo</font>
3384 </p>
3385 !! end
3386
3387 !! test
3388 Attribute test: unquoted but illegal value (hash)
3389 !! input
3390 <font color=#x>foo</font>
3391 !! result
3392 <p><font color="#x">foo</font>
3393 </p>
3394 !! end
3395
3396 !! test
3397 Attribute test: no value
3398 !! input
3399 <font color>foo</font>
3400 !! result
3401 <p><font color="color">foo</font>
3402 </p>
3403 !! end
3404
3405 !! test
3406 Bug 2095: link with three closing brackets
3407 !! input
3408 [[Main Page]]]
3409 !! result
3410 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3411 </p>
3412 !! end
3413
3414 !! test
3415 Bug 2095: link with pipe and three closing brackets
3416 !! input
3417 [[Main Page|link]]]
3418 !! result
3419 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3420 </p>
3421 !! end
3422
3423 !! test
3424 Bug 2095: link with pipe and three closing brackets, version 2
3425 !! input
3426 [[Main Page|[http://example.com/]]]
3427 !! result
3428 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3429 </p>
3430 !! end
3431
3432
3433 ###
3434 ### Safety
3435 ###
3436
3437 !! article
3438 Template:Dangerous attribute
3439 !! text
3440 " onmouseover="alert(document.cookie)
3441 !! endarticle
3442
3443 !! article
3444 Template:Dangerous style attribute
3445 !! text
3446 border-size: expression(alert(document.cookie))
3447 !! endarticle
3448
3449 !! article
3450 Template:Div style
3451 !! text
3452 <div style="float: right; {{{1}}}">Magic div</div>
3453 !! endarticle
3454
3455 !! test
3456 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3457 !! input
3458 <div title="{{test}}"></div>
3459 !! result
3460 <div title="This is a test template"></div>
3461
3462 !! end
3463
3464 !! test
3465 Bug 2304: HTML attribute safety (dangerous template; 2309)
3466 !! input
3467 <div title="{{dangerous attribute}}"></div>
3468 !! result
3469 <div title=""></div>
3470
3471 !! end
3472
3473 !! test
3474 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3475 !! input
3476 <div style="{{dangerous style attribute}}"></div>
3477 !! result
3478 <div></div>
3479
3480 !! end
3481
3482 !! test
3483 Bug 2304: HTML attribute safety (safe parameter; 2309)
3484 !! input
3485 {{div style|width: 200px}}
3486 !! result
3487 <div style="float: right; width: 200px">Magic div</div>
3488
3489 !! end
3490
3491 !! test
3492 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3493 !! input
3494 {{div style|width: expression(alert(document.cookie))}}
3495 !! result
3496 <div>Magic div</div>
3497
3498 !! end
3499
3500 !! test
3501 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3502 !! input
3503 {{div style|"><script>alert(document.cookie)</script>}}
3504 !! result
3505 <div>Magic div</div>
3506
3507 !! end
3508
3509 !! test
3510 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3511 !! input
3512 {{div style|" ><script>alert(document.cookie)</script>}}
3513 !! result
3514 <div style="float: right;">Magic div</div>
3515
3516 !! end
3517
3518 !! test
3519 Bug 2304: HTML attribute safety (link)
3520 !! input
3521 <div title="[[Main Page]]"></div>
3522 !! result
3523 <div title="&#91;&#91;Main Page]]"></div>
3524
3525 !! end
3526
3527 !! test
3528 Bug 2304: HTML attribute safety (italics)
3529 !! input
3530 <div title="''foobar''"></div>
3531 !! result
3532 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3533
3534 !! end
3535
3536 !! test
3537 Bug 2304: HTML attribute safety (bold)
3538 !! input
3539 <div title="'''foobar'''"></div>
3540 !! result
3541 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3542
3543 !! end
3544
3545
3546 !! test
3547 Bug 2304: HTML attribute safety (ISBN)
3548 !! input
3549 <div title="ISBN 1234567890"></div>
3550 !! result
3551 <div title="&#73;SBN 1234567890"></div>
3552
3553 !! end
3554
3555 !! test
3556 Bug 2304: HTML attribute safety (RFC)
3557 !! input
3558 <div title="RFC 1234"></div>
3559 !! result
3560 <div title="&#82;FC 1234"></div>
3561
3562 !! end
3563
3564 !! test
3565 Bug 2304: HTML attribute safety (PMID)
3566 !! input
3567 <div title="PMID 1234567890"></div>
3568 !! result
3569 <div title="&#80;MID 1234567890"></div>
3570
3571 !! end
3572
3573 !! test
3574 Bug 2304: HTML attribute safety (web link)
3575 !! input
3576 <div title="http://example.com/"></div>
3577 !! result
3578 <div title="http&#58;//example.com/"></div>
3579
3580 !! end
3581
3582 !! test
3583 Bug 2304: HTML attribute safety (named web link)
3584 !! input
3585 <div title="[http://example.com/ link]"></div>
3586 !! result
3587 <div title="&#91;http&#58;//example.com/ link]"></div>
3588
3589 !! end
3590
3591 !! test
3592 Bug 3244: HTML attribute safety (extension; safe)
3593 !! input
3594 <div style="<nowiki>background:blue</nowiki>"></div>
3595 !! result
3596 <div style="background:blue"></div>
3597
3598 !! end
3599
3600 !! test
3601 Bug 3244: HTML attribute safety (extension; unsafe)
3602 !! input
3603 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3604 !! result
3605 <div></div>
3606
3607 !! end
3608
3609 !! test
3610 Math section safety when disabled
3611 !! input
3612 <math><script>alert(document.cookies);</script></math>
3613 !! result
3614 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3615 </p>
3616 !! end
3617
3618 # More MSIE fun discovered by Tom Gilder
3619
3620 !! test
3621 MSIE CSS safety test: spurious slash
3622 !! input
3623 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3624 !! result
3625 <div>evil</div>
3626
3627 !! end
3628
3629 !! test
3630 MSIE CSS safety test: hex code
3631 !! input
3632 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3633 !! result
3634 <div>evil</div>
3635
3636 !! end
3637
3638 !! test
3639 MSIE CSS safety test: comment in url
3640 !! input
3641 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3642 !! result
3643 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3644
3645 !! end
3646
3647 !! test
3648 MSIE CSS safety test: comment in expression
3649 !! input
3650 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3651 !! result
3652 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3653
3654 !! end
3655
3656
3657 !! test
3658 Table attribute legitimate extension
3659 !! input
3660 {|
3661 !+ style="<nowiki>color:blue</nowiki>"| status
3662 |}
3663 !! result
3664 <table>
3665 <tr>
3666 <th style="color:blue"> status
3667 </th></tr></table>
3668
3669 !!end
3670
3671 !! test
3672 Table attribute safety
3673 !! input
3674 {|
3675 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3676 |}
3677 !! result
3678 <table>
3679 <tr>
3680 <th> status
3681 </th></tr></table>
3682
3683 !! end
3684
3685
3686 !! article
3687 Template:Identity
3688 !! text
3689 {{{1}}}
3690 !! endarticle
3691
3692 !! test
3693 Expansion of multi-line templates in attribute values (bug 6255)
3694 !! input
3695 <div style="background: {{identity|#00FF00}}">-</div>
3696 !! result
3697 <div style="background: #00FF00">-</div>
3698
3699 !! end
3700
3701
3702 !! test
3703 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3704 !! input
3705 <div style="background:
3706 #00FF00">-</div>
3707 !! result
3708 <div style="background: #00FF00">-</div>
3709
3710 !! end
3711
3712 !! test
3713 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3714 !! input
3715 <div style="background: &#10;#00FF00">-</div>
3716 !! result
3717 <div style="background: &#10;#00FF00">-</div>
3718
3719 !! end
3720
3721 ###
3722 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3723 ###
3724 !! test
3725 Parser hook: empty input
3726 !! input
3727 <tag></tag>
3728 !! result
3729 <pre>
3730 string(0) ""
3731 array(0) {
3732 }
3733 </pre>
3734
3735 !! end
3736
3737 !! test
3738 Parser hook: empty input using terminated empty elements
3739 !! input
3740 <tag/>
3741 !! result
3742 <pre>
3743 NULL
3744 array(0) {
3745 }
3746 </pre>
3747
3748 !! end
3749
3750 !! test
3751 Parser hook: empty input using terminated empty elements (space before)
3752 !! input
3753 <tag />
3754 !! result
3755 <pre>
3756 NULL
3757 array(0) {
3758 }
3759 </pre>
3760
3761 !! end
3762
3763 !! test
3764 Parser hook: basic input
3765 !! input
3766 <tag>input</tag>
3767 !! result
3768 <pre>
3769 string(5) "input"
3770 array(0) {
3771 }
3772 </pre>
3773
3774 !! end
3775
3776
3777 !! test
3778 Parser hook: case insensetive
3779 !! input
3780 <TAG>input</TAG>
3781 !! result
3782 <pre>
3783 string(5) "input"
3784 array(0) {
3785 }
3786 </pre>
3787
3788 !! end
3789
3790
3791 !! test
3792 Parser hook: case insensetive, redux
3793 !! input
3794 <TaG>input</TAg>
3795 !! result
3796 <pre>
3797 string(5) "input"
3798 array(0) {
3799 }
3800 </pre>
3801
3802 !! end
3803
3804 !! test
3805 Parser hook: nested tags
3806 !! options
3807 noxml
3808 !! input
3809 <tag><tag></tag></tag>
3810 !! result
3811 <pre>
3812 string(5) "<tag>"
3813 array(0) {
3814 }
3815 </pre>&lt;/tag&gt;
3816
3817 !! end
3818
3819 !! test
3820 Parser hook: basic arguments
3821 !! input
3822 <tag width=200 height = "100" depth = '50' square></tag>
3823 !! result
3824 <pre>
3825 string(0) ""
3826 array(4) {
3827 ["width"]=>
3828 string(3) "200"
3829 ["height"]=>
3830 string(3) "100"
3831 ["depth"]=>
3832 string(2) "50"
3833 ["square"]=>
3834 string(6) "square"
3835 }
3836 </pre>
3837
3838 !! end
3839
3840 !! test
3841 Parser hook: argument containing a forward slash (bug 5344)
3842 !! input
3843 <tag filename='/tmp/bla'></tag>
3844 !! result
3845 <pre>
3846 string(0) ""
3847 array(1) {
3848 ["filename"]=>
3849 string(8) "/tmp/bla"
3850 }
3851 </pre>
3852
3853 !! end
3854
3855 !! test
3856 Parser hook: empty input using terminated empty elements (bug 2374)
3857 !! input
3858 <tag foo=bar/>text
3859 !! result
3860 <pre>
3861 NULL
3862 array(1) {
3863 ["foo"]=>
3864 string(3) "bar"
3865 }
3866 </pre>text
3867
3868 !! end
3869
3870 # </tag> should be output literally since there is no matching tag that begins it
3871 !! test
3872 Parser hook: basic arguments using terminated empty elements (bug 2374)
3873 !! input
3874 <tag width=200 height = "100" depth = '50' square/>
3875 other stuff
3876 </tag>
3877 !! result
3878 <pre>
3879 NULL
3880 array(4) {
3881 ["width"]=>
3882 string(3) "200"
3883 ["height"]=>
3884 string(3) "100"
3885 ["depth"]=>
3886 string(2) "50"
3887 ["square"]=>
3888 string(6) "square"
3889 }
3890 </pre>
3891 <p>other stuff
3892 &lt;/tag&gt;
3893 </p>
3894 !! end
3895
3896 ###
3897 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3898 ###
3899
3900 !! test
3901 Parser hook: static parser hook not inside a comment
3902 !! input
3903 <statictag>hello, world</statictag>
3904 <statictag action=flush/>
3905 !! result
3906 <p>hello, world
3907 </p>
3908 !! end
3909
3910
3911 !! test
3912 Parser hook: static parser hook inside a comment
3913 !! input
3914 <!-- <statictag>hello, world</statictag> -->
3915 <statictag action=flush/>
3916 !! result
3917 <p><br />
3918 </p>
3919 !! end
3920
3921 # Nested template calls; this case was broken by Parser.php rev 1.506,
3922 # since reverted.
3923
3924 !! article
3925 Template:One-parameter
3926 !! text
3927 (My parameter is: {{{1}}})
3928 !! endarticle
3929
3930 !! article
3931 Template:Map-one-parameter
3932 !! text
3933 {{{{{1}}}|{{{2}}}}}
3934 !! endarticle
3935
3936 !! test
3937 Nested template calls
3938 !! input
3939 {{Map-one-parameter|One-parameter|param}}
3940 !! result
3941 <p>(My parameter is: param)
3942 </p>
3943 !! end
3944
3945
3946 ###
3947 ### Sanitizer
3948 ###
3949 !! test
3950 Sanitizer: Closing of open tags
3951 !! input
3952 <s></s><table></table>
3953 !! result
3954 <s></s><table></table>
3955
3956 !! end
3957
3958 !! test
3959 Sanitizer: Closing of open but not closed tags
3960 !! input
3961 <s>foo
3962 !! result
3963 <p><s>foo</s>
3964 </p>
3965 !! end
3966
3967 !! test
3968 Sanitizer: Closing of closed but not open tags
3969 !! input
3970 </s>
3971 !! result
3972 <p>&lt;/s&gt;
3973 </p>
3974 !! end
3975
3976 !! test
3977 Sanitizer: Closing of closed but not open table tags
3978 !! input
3979 Table not started</td></tr></table>
3980 !! result
3981 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
3982 </p>
3983 !! end
3984
3985 !! test
3986 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
3987 !! input
3988 <span id="æ: v">byte</span>[[#æ: v|backlink]]
3989 !! result
3990 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
3991 </p>
3992 !! end
3993
3994 !! test
3995 Sanitizer: Validating the contents of the id attribute (bug 4515)
3996 !! options
3997 disabled
3998 !! input
3999 <br id=9 />
4000 !! result
4001 Something, but defenetly not <br id="9" />...
4002 !! end
4003
4004 !! test
4005 Language converter: output gets cut off unexpectedly (bug 5757)
4006 !! options
4007 language=zh
4008 !! input
4009 this bit is safe: }-
4010
4011 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4012
4013 then we get cut off here: }-
4014
4015 all additional text is vanished
4016 !! result
4017 <p>this bit is safe: }-
4018 </p><p>but if we add a conversion instance: xxx
4019 </p><p>then we get cut off here: }-
4020 </p><p>all additional text is vanished
4021 </p>
4022 !! end
4023
4024 !! test
4025 Self closed html pairs (bug 5487)
4026 !! options
4027 !! input
4028 <center><font id="bug" />Centered text</center>
4029 <div><font id="bug2" />In div text</div>
4030 !! result
4031 <center>&lt;font id="bug" /&gt;Centered text</center>
4032 <div>&lt;font id="bug2" /&gt;In div text</div>
4033
4034 !! end
4035
4036 #
4037 #
4038 #
4039
4040 !! test
4041 HTML bullet list, closed tags (bug 5497)
4042 !! input
4043 <ul>
4044 <li>One</li>
4045 <li>Two</li>
4046 </ul>
4047 !! result
4048 <ul>
4049 <li>One</li>
4050 <li>Two</li>
4051 </ul>
4052
4053 !! end
4054
4055 !! test
4056 HTML bullet list, unclosed tags (bug 5497)
4057 !! input
4058 <ul>
4059 <li>One
4060 <li>Two
4061 </ul>
4062 !! result
4063 <ul>
4064 <li>One
4065 </li><li>Two
4066 </li></ul>
4067
4068 !! end
4069
4070 !! test
4071 HTML ordered list, closed tags (bug 5497)
4072 !! input
4073 <ol>
4074 <li>One</li>
4075 <li>Two</li>
4076 </ol>
4077 !! result
4078 <ol>
4079 <li>One</li>
4080 <li>Two</li>
4081 </ol>
4082
4083 !! end
4084
4085 !! test
4086 HTML ordered list, unclosed tags (bug 5497)
4087 !! input
4088 <ol>
4089 <li>One
4090 <li>Two
4091 </ol>
4092 !! result
4093 <ol>
4094 <li>One
4095 </li><li>Two
4096 </li></ol>
4097
4098 !! end
4099
4100 !! test
4101 HTML nested bullet list, closed tags (bug 5497)
4102 !! input
4103 <ul>
4104 <li>One</li>
4105 <li>Two:
4106 <ul>
4107 <li>Sub-one</li>
4108 <li>Sub-two</li>
4109 </ul>
4110 </li>
4111 </ul>
4112 !! result
4113 <ul>
4114 <li>One</li>
4115 <li>Two:
4116 <ul>
4117 <li>Sub-one</li>
4118 <li>Sub-two</li>
4119 </ul>
4120 </li>
4121 </ul>
4122
4123 !! end
4124
4125 !! test
4126 HTML nested bullet list, open tags (bug 5497)
4127 !! input
4128 <ul>
4129 <li>One
4130 <li>Two:
4131 <ul>
4132 <li>Sub-one
4133 <li>Sub-two
4134 </ul>
4135 </ul>
4136 !! result
4137 <ul>
4138 <li>One
4139 </li><li>Two:
4140 <ul>
4141 <li>Sub-one
4142 </li><li>Sub-two
4143 </li></ul>
4144 </li></ul>
4145
4146 !! end
4147
4148 !! test
4149 HTML nested ordered list, closed tags (bug 5497)
4150 !! input
4151 <ol>
4152 <li>One</li>
4153 <li>Two:
4154 <ol>
4155 <li>Sub-one</li>
4156 <li>Sub-two</li>
4157 </ol>
4158 </li>
4159 </ol>
4160 !! result
4161 <ol>
4162 <li>One</li>
4163 <li>Two:
4164 <ol>
4165 <li>Sub-one</li>
4166 <li>Sub-two</li>
4167 </ol>
4168 </li>
4169 </ol>
4170
4171 !! end
4172
4173 !! test
4174 HTML nested ordered list, open tags (bug 5497)
4175 !! input
4176 <ol>
4177 <li>One
4178 <li>Two:
4179 <ol>
4180 <li>Sub-one
4181 <li>Sub-two
4182 </ol>
4183 </ol>
4184 !! result
4185 <ol>
4186 <li>One
4187 </li><li>Two:
4188 <ol>
4189 <li>Sub-one
4190 </li><li>Sub-two
4191 </li></ol>
4192 </li></ol>
4193
4194 !! end
4195
4196 !! test
4197 HTML ordered list item with parameters oddity
4198 !! input
4199 <ol><li id="fragment">One</li></ol>
4200 !! result
4201 <ol><li id="fragment">One</li></ol>
4202
4203 !! end
4204
4205 !!test
4206 bug 5918: autonumbering
4207 !! input
4208 [http://first/] [http://second] [ftp://ftp]
4209
4210 ftp://inlineftp
4211
4212 [mailto:enclosed@mail.tld With target]
4213
4214 [mailto:enclosed@mail.tld]
4215
4216 mailto:inline@mail.tld
4217 !! result
4218 <p><a href="http://first/" class='external autonumber' title="http://first/" rel="nofollow">[1]</a> <a href="http://second" class='external autonumber' title="http://second" rel="nofollow">[2]</a> <a href="ftp://ftp" class='external autonumber' title="ftp://ftp" rel="nofollow">[3]</a>
4219 </p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4220 </p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4221 </p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4222 </p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4223 </p>
4224 !! end
4225
4226
4227 #
4228 # Security and HTML correctness
4229 # From Nick Jenkins' fuzz testing
4230 #
4231
4232 !! test
4233 Fuzz testing: Parser13
4234 !! input
4235 {|
4236 | http://a|
4237 !! result
4238 <table>
4239 <tr>
4240 <td>
4241 </td>
4242 </tr>
4243 </table>
4244
4245 !! end
4246
4247 !! test
4248 Fuzz testing: Parser14
4249 !! input
4250 == onmouseover= ==
4251 http://__TOC__
4252 !! result
4253 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</div><a name="onmouseover.3D"></a><h2> onmouseover= </h2>
4254 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4255 <ul>
4256 <li class='toclevel-1'><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4257 </ul>
4258 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4259
4260 !! end
4261
4262 !! test
4263 Fuzz testing: Parser14-table
4264 !! input
4265 ==a==
4266 {| STYLE=__TOC__
4267 !! result
4268 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</div><a name="a"></a><h2>a</h2>
4269 <table style="&#95;_TOC&#95;_">
4270 <tr><td></td></tr>
4271 </table>
4272
4273 !! end
4274
4275 # Known to produce bogus xml (extra </td>)
4276 !! test
4277 Fuzz testing: Parser16
4278 !! options
4279 noxml
4280 !! input
4281 {|
4282 !https://||||||
4283 !! result
4284 <table>
4285 <tr>
4286 <th>https://</th><th></th><th></th><th>
4287 </td>
4288 </tr>
4289 </table>
4290
4291 !! end
4292
4293 !! test
4294 Fuzz testing: Parser21
4295 !! input
4296 {|
4297 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4298 |
4299 !! result
4300 <table>
4301 <tr>
4302 <th> <a href="irc://{{ftp://a" class='external free' title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4303 </th><td>
4304 </td>
4305 </tr>
4306 </table>
4307
4308 !! end
4309
4310 !! test
4311 Fuzz testing: Parser22
4312 !! input
4313 http://===r:::https://b
4314
4315 {|
4316 !!result
4317 <p><a href="http://===r:::https://b" class='external free' title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4318 </p>
4319 <table>
4320 <tr><td></td></tr>
4321 </table>
4322
4323 !! end
4324
4325 # Known to produce bad XML for now
4326 !! test
4327 Fuzz testing: Parser24
4328 !! options
4329 noxml
4330 !! input
4331 {|
4332 {{{|
4333 <u CLASS=
4334 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4335 <br style="onmouseover='alert(document.cookie);' " />
4336
4337 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4338 |
4339 !! result
4340 <table>
4341
4342 <u class="&#124;">} &gt;
4343 <br style="onmouseover='alert(document.cookie);'" />
4344
4345 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4346 <tr>
4347 <td></u>
4348 </td>
4349 </tr>
4350 </table>
4351
4352 !! end
4353
4354 # Known to produce bad XML for now
4355 !!test
4356 Fuzz testing: Parser25 (bug 6055)
4357 !! options
4358 noxml
4359 !! input
4360 {{{
4361 |
4362 <LI CLASS=||
4363 >
4364 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4365 !! result
4366 <li class="&#124;&#124;">
4367 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4368
4369 !! end
4370
4371 !!test
4372 Fuzz testing: URL adjacent extension (with space, clean)
4373 !! options
4374 !! input
4375 http://example.com <nowiki>junk</nowiki>
4376 !! result
4377 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
4378 </p>
4379 !!end
4380
4381 !!test
4382 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4383 !! options
4384 !! input
4385 http://example.com<nowiki>junk</nowiki>
4386 !! result
4387 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
4388 </p>
4389 !!end
4390
4391 !!test
4392 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4393 !! options
4394 !! input
4395 http://example.com<pre>junk</pre>
4396 !! result
4397 <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4398
4399 !!end
4400
4401 !!test
4402 Fuzz testing: image with bogus manual thumbnail
4403 !!input
4404 [[Image:foobar.jpg|thumbnail= ]]
4405 !!result
4406 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="-1" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div></div></div></div>
4407
4408 !!end
4409
4410 !! test
4411 Parsing optional HTML elements (Bug 6171)
4412 !! options
4413 !! input
4414 <table>
4415 <tr>
4416 <td> Some tabular data</td>
4417 <td> More tabular data ...
4418 <td> And yet som tabular data</td>
4419 </tr>
4420 </table>
4421 !! result
4422 <table>
4423 <tr>
4424 <td> Some tabular data</td>
4425 <td> More tabular data ...
4426 </td><td> And yet som tabular data</td>
4427 </tr>
4428 </table>
4429
4430 !! end
4431
4432 !! test
4433 Correct handling of <td>, <tr> (Bug 6171)
4434 !! options
4435 !! input
4436 <table>
4437 <tr>
4438 <td> Some tabular data</td>
4439 <td> More tabular data ...</td>
4440 <td> And yet som tabular data</td>
4441 </tr>
4442 </table>
4443 !! result
4444 <table>
4445 <tr>
4446 <td> Some tabular data</td>
4447 <td> More tabular data ...</td>
4448 <td> And yet som tabular data</td>
4449 </tr>
4450 </table>
4451
4452 !! end
4453
4454
4455 !! test
4456 Parsing crashing regression (fr:JavaScript)
4457 !! input
4458 </body></x>
4459 !! result
4460 <p>&lt;/body&gt;&lt;/x&gt;
4461 </p>
4462 !! end
4463
4464 !! test
4465 Inline wiki vs wiki block nesting
4466 !! input
4467 '''Bold paragraph
4468
4469 New wiki paragraph
4470 !! result
4471 <p><b>Bold paragraph</b>
4472 </p><p>New wiki paragraph
4473 </p>
4474 !! end
4475
4476 !! test
4477 Inline HTML vs wiki block nesting
4478 !! input
4479 <b>Bold paragraph
4480
4481 New wiki paragraph
4482 !! result
4483 <p><b>Bold paragraph</b>
4484 </p><p>New wiki paragraph
4485 </p>
4486 !! end
4487
4488
4489 !!test
4490 Mixing markup for italics and bold
4491 !! options
4492 !! input
4493 '''bold''''''bold''bolditalics'''''
4494 !! result
4495 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4496 </p>
4497 !! end
4498
4499
4500 !! article
4501 Xyzzyx
4502 !! text
4503 Article for special page transclusion test
4504 !! endarticle
4505
4506 !! test
4507 Special page transclusion
4508 !! options
4509 !! input
4510 {{Special:Prefixindex/Xyzzyx}}
4511 !! result
4512 <p><br />
4513 </p>
4514 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4515
4516 !! end
4517
4518 !! test
4519 Special page transclusion twice (bug 5021)
4520 !! options
4521 !! input
4522 {{Special:Prefixindex/Xyzzyx}}
4523 {{Special:Prefixindex/Xyzzyx}}
4524 !! result
4525 <p><br />
4526 </p>
4527 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4528 <p><br />
4529 </p>
4530 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4531
4532 !! end
4533
4534 !! test
4535 Invalid header with following text
4536 !! input
4537 = x = y
4538 !! result
4539 <p>= x = y
4540 </p>
4541 !! end
4542
4543
4544 !! test
4545 Section extraction test (section 0)
4546 !! options
4547 section=0
4548 !! input
4549 start
4550 ==a==
4551 ===aa===
4552 ====aaa====
4553 ==b==
4554 ===ba===
4555 ===bb===
4556 ====bba====
4557 ===bc===
4558 ==c==
4559 ===ca===
4560 !! result
4561 start
4562 !! end
4563
4564 !! test
4565 Section extraction test (section 1)
4566 !! options
4567 section=1
4568 !! input
4569 start
4570 ==a==
4571 ===aa===
4572 ====aaa====
4573 ==b==
4574 ===ba===
4575 ===bb===
4576 ====bba====
4577 ===bc===
4578 ==c==
4579 ===ca===
4580 !! result
4581 ==a==
4582 ===aa===
4583 ====aaa====
4584 !! end
4585
4586 !! test
4587 Section extraction test (section 2)
4588 !! options
4589 section=2
4590 !! input
4591 start
4592 ==a==
4593 ===aa===
4594 ====aaa====
4595 ==b==
4596 ===ba===
4597 ===bb===
4598 ====bba====
4599 ===bc===
4600 ==c==
4601 ===ca===
4602 !! result
4603 ===aa===
4604 ====aaa====
4605 !! end
4606
4607 !! test
4608 Section extraction test (section 3)
4609 !! options
4610 section=3
4611 !! input
4612 start
4613 ==a==
4614 ===aa===
4615 ====aaa====
4616 ==b==
4617 ===ba===
4618 ===bb===
4619 ====bba====
4620 ===bc===
4621 ==c==
4622 ===ca===
4623 !! result
4624 ====aaa====
4625 !! end
4626
4627 !! test
4628 Section extraction test (section 4)
4629 !! options
4630 section=4
4631 !! input
4632 start
4633 ==a==
4634 ===aa===
4635 ====aaa====
4636 ==b==
4637 ===ba===
4638 ===bb===
4639 ====bba====
4640 ===bc===
4641 ==c==
4642 ===ca===
4643 !! result
4644 ==b==
4645 ===ba===
4646 ===bb===
4647 ====bba====
4648 ===bc===
4649 !! end
4650
4651 !! test
4652 Section extraction test (section 5)
4653 !! options
4654 section=5
4655 !! input
4656 start
4657 ==a==
4658 ===aa===
4659 ====aaa====
4660 ==b==
4661 ===ba===
4662 ===bb===
4663 ====bba====
4664 ===bc===
4665 ==c==
4666 ===ca===
4667 !! result
4668 ===ba===
4669 !! end
4670
4671 !! test
4672 Section extraction test (section 6)
4673 !! options
4674 section=6
4675 !! input
4676 start
4677 ==a==
4678 ===aa===
4679 ====aaa====
4680 ==b==
4681 ===ba===
4682 ===bb===
4683 ====bba====
4684 ===bc===
4685 ==c==
4686 ===ca===
4687 !! result
4688 ===bb===
4689 ====bba====
4690 !! end
4691
4692 !! test
4693 Section extraction test (section 7)
4694 !! options
4695 section=7
4696 !! input
4697 start
4698 ==a==
4699 ===aa===
4700 ====aaa====
4701 ==b==
4702 ===ba===
4703 ===bb===
4704 ====bba====
4705 ===bc===
4706 ==c==
4707 ===ca===
4708 !! result
4709 ====bba====
4710 !! end
4711
4712 !! test
4713 Section extraction test (section 8)
4714 !! options
4715 section=8
4716 !! input
4717 start
4718 ==a==
4719 ===aa===
4720 ====aaa====
4721 ==b==
4722 ===ba===
4723 ===bb===
4724 ====bba====
4725 ===bc===
4726 ==c==
4727 ===ca===
4728 !! result
4729 ===bc===
4730 !! end
4731
4732 !! test
4733 Section extraction test (section 9)
4734 !! options
4735 section=9
4736 !! input
4737 start
4738 ==a==
4739 ===aa===
4740 ====aaa====
4741 ==b==
4742 ===ba===
4743 ===bb===
4744 ====bba====
4745 ===bc===
4746 ==c==
4747 ===ca===
4748 !! result
4749 ==c==
4750 ===ca===
4751 !! end
4752
4753 !! test
4754 Section extraction test (section 10)
4755 !! options
4756 section=10
4757 !! input
4758 start
4759 ==a==
4760 ===aa===
4761 ====aaa====
4762 ==b==
4763 ===ba===
4764 ===bb===
4765 ====bba====
4766 ===bc===
4767 ==c==
4768 ===ca===
4769 !! result
4770 ===ca===
4771 !! end
4772
4773 !! test
4774 Section extraction test (nonexistent section 11)
4775 !! options
4776 section=11
4777 !! input
4778 start
4779 ==a==
4780 ===aa===
4781 ====aaa====
4782 ==b==
4783 ===ba===
4784 ===bb===
4785 ====bba====
4786 ===bc===
4787 ==c==
4788 ===ca===
4789 !! result
4790 !! end
4791
4792 !! test
4793 Section extraction test with bogus heading (section 1)
4794 !! options
4795 section=1
4796 !! input
4797 ==a==
4798 ==bogus== not a legal section
4799 ==b==
4800 !! result
4801 ==a==
4802 ==bogus== not a legal section
4803 !! end
4804
4805 !! test
4806 Section extraction test with bogus heading (section 2)
4807 !! options
4808 section=2
4809 !! input
4810 ==a==
4811 ==bogus== not a legal section
4812 ==b==
4813 !! result
4814 ==b==
4815 !! end
4816
4817 !! test
4818 Section extraction test with comment after heading (section 1)
4819 !! options
4820 section=1
4821 !! input
4822 ==a==
4823 ==legal== <!-- a legal section -->
4824 ==b==
4825 !! result
4826 ==a==
4827 !! end
4828
4829 !! test
4830 Section extraction test with comment after heading (section 2)
4831 !! options
4832 section=2
4833 !! input
4834 ==a==
4835 ==legal== <!-- a legal section -->
4836 ==b==
4837 !! result
4838 ==legal== <!-- a legal section -->
4839 !! end
4840
4841 !! test
4842 Section extraction test with bogus <nowiki> heading (section 1)
4843 !! options
4844 section=1
4845 !! input
4846 ==a==
4847 ==bogus== <nowiki>not a legal section</nowiki>
4848 ==b==
4849 !! result
4850 ==a==
4851 ==bogus== <nowiki>not a legal section</nowiki>
4852 !! end
4853
4854 !! test
4855 Section extraction test with bogus <nowiki> heading (section 2)
4856 !! options
4857 section=2
4858 !! input
4859 ==a==
4860 ==bogus== <nowiki>not a legal section</nowiki>
4861 ==b==
4862 !! result
4863 ==b==
4864 !! end
4865
4866
4867 !! test
4868 Section extraction prefixed by comment (section 1) (bug 2587)
4869 !! options
4870 section=1
4871 !! input
4872 <!-- -->==sec1==
4873 ==sec2==
4874 !!result
4875 <!-- -->==sec1==
4876 !!end
4877
4878 !! test
4879 Section extraction prefixed by comment (section 2) (bug 2587)
4880 !! options
4881 section=2
4882 !! input
4883 <!-- -->==sec1==
4884 ==sec2==
4885 !!result
4886 ==sec2==
4887 !!end
4888
4889
4890 !! test
4891 Section extraction, mixed wiki and html (section 1) (bug 2607)
4892 !! options
4893 section=1
4894 !! input
4895 <h2>1</h2>
4896 one
4897 ==2==
4898 two
4899 ==3==
4900 three
4901 !! result
4902 <h2>1</h2>
4903 one
4904 !! end
4905
4906 !! test
4907 Section extraction, mixed wiki and html (section 2) (bug 2607)
4908 !! options
4909 section=2
4910 !! input
4911 <h2>1</h2>
4912 one
4913 ==2==
4914 two
4915 ==3==
4916 three
4917 !! result
4918 ==2==
4919 two
4920 !! end
4921
4922
4923 !! test
4924 Section extraction, heading surrounded by <noinclude> (bug 3342)
4925 !! options
4926 section=1
4927 !! input
4928 <noinclude>==a==</noinclude>
4929 text
4930 !! result
4931 <noinclude>==a==</noinclude>
4932 text
4933 !!end
4934
4935
4936 !! test
4937 Section extraction, HTML heading subsections (bug 5272)
4938 !! options
4939 section=1
4940 !! input
4941 <h2>a</h2>
4942 <h3>aa</h3>
4943 <h2>b</h2>
4944 !! result
4945 <h2>a</h2>
4946 <h3>aa</h3>
4947 !! end
4948
4949 !! test
4950 Section extraction, HTML headings should be ignored in extensions (bug 3476)
4951 !! options
4952 section=2
4953 !! input
4954 <h2>a</h2>
4955 <tag>
4956 <h2>not b</h2>
4957 </tag>
4958 <h2>b</h2>
4959 !! result
4960 <h2>b</h2>
4961 !! end
4962
4963 !! test
4964 Section replacement test (section 0)
4965 !! options
4966 replace=0,"xxx"
4967 !! input
4968 start
4969 ==a==
4970 ===aa===
4971 ====aaa====
4972 ==b==
4973 ===ba===
4974 ===bb===
4975 ====bba====
4976 ===bc===
4977 ==c==
4978 ===ca===
4979 !! result
4980 xxx
4981
4982 ==a==
4983 ===aa===
4984 ====aaa====
4985 ==b==
4986 ===ba===
4987 ===bb===
4988 ====bba====
4989 ===bc===
4990 ==c==
4991 ===ca===
4992 !! end
4993
4994 !! test
4995 Section replacement test (section 1)
4996 !! options
4997 replace=1,"xxx"
4998 !! input
4999 start
5000 ==a==
5001 ===aa===
5002 ====aaa====
5003 ==b==
5004 ===ba===
5005 ===bb===
5006 ====bba====
5007 ===bc===
5008 ==c==
5009 ===ca===
5010 !! result
5011 start
5012 xxx
5013
5014 ==b==
5015 ===ba===
5016 ===bb===
5017 ====bba====
5018 ===bc===
5019 ==c==
5020 ===ca===
5021 !! end
5022
5023 !! test
5024 Section replacement test (section 2)
5025 !! options
5026 replace=2,"xxx"
5027 !! input
5028 start
5029 ==a==
5030 ===aa===
5031 ====aaa====
5032 ==b==
5033 ===ba===
5034 ===bb===
5035 ====bba====
5036 ===bc===
5037 ==c==
5038 ===ca===
5039 !! result
5040 start
5041 ==a==
5042 xxx
5043
5044 ==b==
5045 ===ba===
5046 ===bb===
5047 ====bba====
5048 ===bc===
5049 ==c==
5050 ===ca===
5051 !! end
5052
5053 !! test
5054 Section replacement test (section 3)
5055 !! options
5056 replace=3,"xxx"
5057 !! input
5058 start
5059 ==a==
5060 ===aa===
5061 ====aaa====
5062 ==b==
5063 ===ba===
5064 ===bb===
5065 ====bba====
5066 ===bc===
5067 ==c==
5068 ===ca===
5069 !! result
5070 start
5071 ==a==
5072 ===aa===
5073 xxx
5074
5075 ==b==
5076 ===ba===
5077 ===bb===
5078 ====bba====
5079 ===bc===
5080 ==c==
5081 ===ca===
5082 !! end
5083
5084 !! test
5085 Section replacement test (section 4)
5086 !! options
5087 replace=4,"xxx"
5088 !! input
5089 start
5090 ==a==
5091 ===aa===
5092 ====aaa====
5093 ==b==
5094 ===ba===
5095 ===bb===
5096 ====bba====
5097 ===bc===
5098 ==c==
5099 ===ca===
5100 !! result
5101 start
5102 ==a==
5103 ===aa===
5104 ====aaa====
5105 xxx
5106
5107 ==c==
5108 ===ca===
5109 !! end
5110
5111 !! test
5112 Section replacement test (section 5)
5113 !! options
5114 replace=5,"xxx"
5115 !! input
5116 start
5117 ==a==
5118 ===aa===
5119 ====aaa====
5120 ==b==
5121 ===ba===
5122 ===bb===
5123 ====bba====
5124 ===bc===
5125 ==c==
5126 ===ca===
5127 !! result
5128 start
5129 ==a==
5130 ===aa===
5131 ====aaa====
5132 ==b==
5133 xxx
5134
5135 ===bb===
5136 ====bba====
5137 ===bc===
5138 ==c==
5139 ===ca===
5140 !! end
5141
5142 !! test
5143 Section replacement test (section 6)
5144 !! options
5145 replace=6,"xxx"
5146 !! input
5147 start
5148 ==a==
5149 ===aa===
5150 ====aaa====
5151 ==b==
5152 ===ba===
5153 ===bb===
5154 ====bba====
5155 ===bc===
5156 ==c==
5157 ===ca===
5158 !! result
5159 start
5160 ==a==
5161 ===aa===
5162 ====aaa====
5163 ==b==
5164 ===ba===
5165 xxx
5166
5167 ===bc===
5168 ==c==
5169 ===ca===
5170 !! end
5171
5172 !! test
5173 Section replacement test (section 7)
5174 !! options
5175 replace=7,"xxx"
5176 !! input
5177 start
5178 ==a==
5179 ===aa===
5180 ====aaa====
5181 ==b==
5182 ===ba===
5183 ===bb===
5184 ====bba====
5185 ===bc===
5186 ==c==
5187 ===ca===
5188 !! result
5189 start
5190 ==a==
5191 ===aa===
5192 ====aaa====
5193 ==b==
5194 ===ba===
5195 ===bb===
5196 xxx
5197
5198 ===bc===
5199 ==c==
5200 ===ca===
5201 !! end
5202
5203 !! test
5204 Section replacement test (section 8)
5205 !! options
5206 replace=8,"xxx"
5207 !! input
5208 start
5209 ==a==
5210 ===aa===
5211 ====aaa====
5212 ==b==
5213 ===ba===
5214 ===bb===
5215 ====bba====
5216 ===bc===
5217 ==c==
5218 ===ca===
5219 !! result
5220 start
5221 ==a==
5222 ===aa===
5223 ====aaa====
5224 ==b==
5225 ===ba===
5226 ===bb===
5227 ====bba====
5228 xxx
5229
5230 ==c==
5231 ===ca===
5232 !!end
5233
5234 !! test
5235 Section replacement test (section 9)
5236 !! options
5237 replace=9,"xxx"
5238 !! input
5239 start
5240 ==a==
5241 ===aa===
5242 ====aaa====
5243 ==b==
5244 ===ba===
5245 ===bb===
5246 ====bba====
5247 ===bc===
5248 ==c==
5249 ===ca===
5250 !! result
5251 start
5252 ==a==
5253 ===aa===
5254 ====aaa====
5255 ==b==
5256 ===ba===
5257 ===bb===
5258 ====bba====
5259 ===bc===
5260 xxx
5261 !! end
5262
5263 !! test
5264 Section replacement test (section 10)
5265 !! options
5266 replace=10,"xxx"
5267 !! input
5268 start
5269 ==a==
5270 ===aa===
5271 ====aaa====
5272 ==b==
5273 ===ba===
5274 ===bb===
5275 ====bba====
5276 ===bc===
5277 ==c==
5278 ===ca===
5279 !! result
5280 start
5281 ==a==
5282 ===aa===
5283 ====aaa====
5284 ==b==
5285 ===ba===
5286 ===bb===
5287 ====bba====
5288 ===bc===
5289 ==c==
5290 xxx
5291 !! end
5292
5293
5294 !! test
5295 Section extraction, HTML headings not at line boundaries (section 0)
5296 !! options
5297 section=0
5298 !! input
5299 <h2>Evil</h2><i>blah blah blah</i>
5300
5301 evil blah
5302
5303 <h2>Nice</h2>
5304
5305 nice blah
5306
5307 <i>extra evil</i><h2>Extra nasty</h2>
5308
5309 extra nasty
5310 !! result
5311 !! end
5312
5313 !! test
5314 Section extraction, HTML headings not at line boundaries (section 1)
5315 !! options
5316 section=1
5317 !! input
5318 <h2>Evil</h2><i>blah blah blah</i>
5319
5320 evil blah
5321
5322 <h2>Nice</h2>
5323
5324 nice blah
5325
5326 <i>extra evil</i><h2>Extra nasty</h2>
5327
5328 extra nasty
5329 !! result
5330 <h2>Evil</h2><i>blah blah blah</i>
5331
5332 evil blah
5333 !! end
5334
5335 !! test
5336 Section extraction, HTML headings not at line boundaries (section 2)
5337 !! options
5338 section=2
5339 !! input
5340 <h2>Evil</h2><i>blah blah blah</i>
5341
5342 evil blah
5343
5344 <h2>Nice</h2>
5345
5346 nice blah
5347
5348 <i>extra evil</i><h2>Extra nasty</h2>
5349
5350 extra nasty
5351 !! result
5352 <h2>Nice</h2>
5353
5354 nice blah
5355
5356 <i>extra evil</i>
5357 !! end
5358
5359 !! test
5360 Section extraction, HTML headings not at line boundaries (section 3)
5361 !! options
5362 section=3
5363 !! input
5364 <h2>Evil</h2><i>blah blah blah</i>
5365
5366 evil blah
5367
5368 <h2>Nice</h2>
5369
5370 nice blah
5371
5372 <i>extra evil</i><h2>Extra nasty</h2>
5373
5374 extra nasty
5375 !! result
5376 <h2>Extra nasty</h2>
5377
5378 extra nasty
5379 !! end
5380
5381 #
5382 #
5383 #
5384
5385 TODO:
5386 more images
5387 more tables
5388 math
5389 character entities
5390 and much more