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