* (bug 6230) Regression fix: <nowiki> in [URL link text]
[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 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3673 ###
3674 !! test
3675 Parser hook: empty input
3676 !! input
3677 <tag></tag>
3678 !! result
3679 <pre>
3680 string(0) ""
3681 array(0) {
3682 }
3683 </pre>
3684
3685 !! end
3686
3687 !! test
3688 Parser hook: empty input using terminated empty elements
3689 !! input
3690 <tag/>
3691 !! result
3692 <pre>
3693 NULL
3694 array(0) {
3695 }
3696 </pre>
3697
3698 !! end
3699
3700 !! test
3701 Parser hook: empty input using terminated empty elements (space before)
3702 !! input
3703 <tag />
3704 !! result
3705 <pre>
3706 NULL
3707 array(0) {
3708 }
3709 </pre>
3710
3711 !! end
3712
3713 !! test
3714 Parser hook: basic input
3715 !! input
3716 <tag>input</tag>
3717 !! result
3718 <pre>
3719 string(5) "input"
3720 array(0) {
3721 }
3722 </pre>
3723
3724 !! end
3725
3726
3727 !! test
3728 Parser hook: case insensetive
3729 !! input
3730 <TAG>input</TAG>
3731 !! result
3732 <pre>
3733 string(5) "input"
3734 array(0) {
3735 }
3736 </pre>
3737
3738 !! end
3739
3740
3741 !! test
3742 Parser hook: case insensetive, redux
3743 !! input
3744 <TaG>input</TAg>
3745 !! result
3746 <pre>
3747 string(5) "input"
3748 array(0) {
3749 }
3750 </pre>
3751
3752 !! end
3753
3754 !! test
3755 Parser hook: nested tags
3756 !! options
3757 noxml
3758 !! input
3759 <tag><tag></tag></tag>
3760 !! result
3761 <pre>
3762 string(5) "<tag>"
3763 array(0) {
3764 }
3765 </pre>&lt;/tag&gt;
3766
3767 !! end
3768
3769 !! test
3770 Parser hook: basic arguments
3771 !! input
3772 <tag width=200 height = "100" depth = '50' square></tag>
3773 !! result
3774 <pre>
3775 string(0) ""
3776 array(4) {
3777 ["width"]=>
3778 string(3) "200"
3779 ["height"]=>
3780 string(3) "100"
3781 ["depth"]=>
3782 string(2) "50"
3783 ["square"]=>
3784 string(6) "square"
3785 }
3786 </pre>
3787
3788 !! end
3789
3790 !! test
3791 Parser hook: argument containing a forward slash (bug 5344)
3792 !! input
3793 <tag filename='/tmp/bla'></tag>
3794 !! result
3795 <pre>
3796 string(0) ""
3797 array(1) {
3798 ["filename"]=>
3799 string(8) "/tmp/bla"
3800 }
3801 </pre>
3802
3803 !! end
3804
3805 !! test
3806 Parser hook: empty input using terminated empty elements (bug 2374)
3807 !! input
3808 <tag foo=bar/>text
3809 !! result
3810 <pre>
3811 NULL
3812 array(1) {
3813 ["foo"]=>
3814 string(3) "bar"
3815 }
3816 </pre>text
3817
3818 !! end
3819
3820 # </tag> should be output literally since there is no matching tag that begins it
3821 !! test
3822 Parser hook: basic arguments using terminated empty elements (bug 2374)
3823 !! input
3824 <tag width=200 height = "100" depth = '50' square/>
3825 other stuff
3826 </tag>
3827 !! result
3828 <pre>
3829 NULL
3830 array(4) {
3831 ["width"]=>
3832 string(3) "200"
3833 ["height"]=>
3834 string(3) "100"
3835 ["depth"]=>
3836 string(2) "50"
3837 ["square"]=>
3838 string(6) "square"
3839 }
3840 </pre>
3841 <p>other stuff
3842 &lt;/tag&gt;
3843 </p>
3844 !! end
3845
3846 ###
3847 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3848 ###
3849
3850 !! test
3851 Parser hook: static parser hook not inside a comment
3852 !! input
3853 <statictag>hello, world</statictag>
3854 <statictag action=flush/>
3855 !! result
3856 <p>hello, world
3857 </p>
3858 !! end
3859
3860
3861 !! test
3862 Parser hook: static parser hook inside a comment
3863 !! input
3864 <!-- <statictag>hello, world</statictag> -->
3865 <statictag action=flush/>
3866 !! result
3867 <p><br />
3868 </p>
3869 !! end
3870
3871 # Nested template calls; this case was broken by Parser.php rev 1.506,
3872 # since reverted.
3873
3874 !! article
3875 Template:One-parameter
3876 !! text
3877 (My parameter is: {{{1}}})
3878 !! endarticle
3879
3880 !! article
3881 Template:Map-one-parameter
3882 !! text
3883 {{{{{1}}}|{{{2}}}}}
3884 !! endarticle
3885
3886 !! test
3887 Nested template calls
3888 !! input
3889 {{Map-one-parameter|One-parameter|param}}
3890 !! result
3891 <p>(My parameter is: param)
3892 </p>
3893 !! end
3894
3895
3896 ###
3897 ### Sanitizer
3898 ###
3899 !! test
3900 Sanitizer: Closing of open tags
3901 !! input
3902 <s></s><table></table>
3903 !! result
3904 <s></s><table></table>
3905
3906 !! end
3907
3908 !! test
3909 Sanitizer: Closing of open but not closed tags
3910 !! input
3911 <s>foo
3912 !! result
3913 <p><s>foo</s>
3914 </p>
3915 !! end
3916
3917 !! test
3918 Sanitizer: Closing of closed but not open tags
3919 !! input
3920 </s>
3921 !! result
3922 <p>&lt;/s&gt;
3923 </p>
3924 !! end
3925
3926 !! test
3927 Sanitizer: Closing of closed but not open table tags
3928 !! input
3929 Table not started</td></tr></table>
3930 !! result
3931 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
3932 </p>
3933 !! end
3934
3935 !! test
3936 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
3937 !! input
3938 <span id="æ: v">byte</span>[[#æ: v|backlink]]
3939 !! result
3940 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
3941 </p>
3942 !! end
3943
3944 !! test
3945 Sanitizer: Validating the contents of the id attribute (bug 4515)
3946 !! options
3947 disabled
3948 !! input
3949 <br id=9 />
3950 !! result
3951 Something, but defenetly not <br id="9" />...
3952 !! end
3953
3954 !! test
3955 Language converter: output gets cut off unexpectedly (bug 5757)
3956 !! options
3957 language=zh
3958 !! input
3959 this bit is safe: }-
3960
3961 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
3962
3963 then we get cut off here: }-
3964
3965 all additional text is vanished
3966 !! result
3967 <p>this bit is safe: }-
3968 </p><p>but if we add a conversion instance: xxx
3969 </p><p>then we get cut off here: }-
3970 </p><p>all additional text is vanished
3971 </p>
3972 !! end
3973
3974 !! test
3975 Self closed html pairs (bug 5487)
3976 !! options
3977 !! input
3978 <center><font id="bug" />Centered text</center>
3979 <div><font id="bug2" />In div text</div>
3980 !! result
3981 <center>&lt;font id="bug" /&gt;Centered text</center>
3982 <div>&lt;font id="bug2" /&gt;In div text</div>
3983
3984 !! end
3985
3986 #
3987 #
3988 #
3989
3990 !! test
3991 HTML bullet list, closed tags (bug 5497)
3992 !! input
3993 <ul>
3994 <li>One</li>
3995 <li>Two</li>
3996 </ul>
3997 !! result
3998 <ul>
3999 <li>One</li>
4000 <li>Two</li>
4001 </ul>
4002
4003 !! end
4004
4005 !! test
4006 HTML bullet list, unclosed tags (bug 5497)
4007 !! input
4008 <ul>
4009 <li>One
4010 <li>Two
4011 </ul>
4012 !! result
4013 <ul>
4014 <li>One
4015 </li><li>Two
4016 </li></ul>
4017
4018 !! end
4019
4020 !! test
4021 HTML ordered list, closed tags (bug 5497)
4022 !! input
4023 <ol>
4024 <li>One</li>
4025 <li>Two</li>
4026 </ol>
4027 !! result
4028 <ol>
4029 <li>One</li>
4030 <li>Two</li>
4031 </ol>
4032
4033 !! end
4034
4035 !! test
4036 HTML ordered list, unclosed tags (bug 5497)
4037 !! input
4038 <ol>
4039 <li>One
4040 <li>Two
4041 </ol>
4042 !! result
4043 <ol>
4044 <li>One
4045 </li><li>Two
4046 </li></ol>
4047
4048 !! end
4049
4050 !! test
4051 HTML nested bullet list, closed tags (bug 5497)
4052 !! input
4053 <ul>
4054 <li>One</li>
4055 <li>Two:
4056 <ul>
4057 <li>Sub-one</li>
4058 <li>Sub-two</li>
4059 </ul>
4060 </li>
4061 </ul>
4062 !! result
4063 <ul>
4064 <li>One</li>
4065 <li>Two:
4066 <ul>
4067 <li>Sub-one</li>
4068 <li>Sub-two</li>
4069 </ul>
4070 </li>
4071 </ul>
4072
4073 !! end
4074
4075 !! test
4076 HTML nested bullet list, open tags (bug 5497)
4077 !! input
4078 <ul>
4079 <li>One
4080 <li>Two:
4081 <ul>
4082 <li>Sub-one
4083 <li>Sub-two
4084 </ul>
4085 </ul>
4086 !! result
4087 <ul>
4088 <li>One
4089 </li><li>Two:
4090 <ul>
4091 <li>Sub-one
4092 </li><li>Sub-two
4093 </li></ul>
4094 </li></ul>
4095
4096 !! end
4097
4098 !! test
4099 HTML nested ordered list, closed tags (bug 5497)
4100 !! input
4101 <ol>
4102 <li>One</li>
4103 <li>Two:
4104 <ol>
4105 <li>Sub-one</li>
4106 <li>Sub-two</li>
4107 </ol>
4108 </li>
4109 </ol>
4110 !! result
4111 <ol>
4112 <li>One</li>
4113 <li>Two:
4114 <ol>
4115 <li>Sub-one</li>
4116 <li>Sub-two</li>
4117 </ol>
4118 </li>
4119 </ol>
4120
4121 !! end
4122
4123 !! test
4124 HTML nested ordered list, open tags (bug 5497)
4125 !! input
4126 <ol>
4127 <li>One
4128 <li>Two:
4129 <ol>
4130 <li>Sub-one
4131 <li>Sub-two
4132 </ol>
4133 </ol>
4134 !! result
4135 <ol>
4136 <li>One
4137 </li><li>Two:
4138 <ol>
4139 <li>Sub-one
4140 </li><li>Sub-two
4141 </li></ol>
4142 </li></ol>
4143
4144 !! end
4145
4146 !! test
4147 HTML ordered list item with parameters oddity
4148 !! input
4149 <ol><li id="fragment">One</li></ol>
4150 !! result
4151 <ol><li id="fragment">One</li></ol>
4152
4153 !! end
4154
4155 !!test
4156 bug 5918: autonumbering
4157 !! input
4158 [http://first/] [http://second] [ftp://ftp]
4159
4160 ftp://inlineftp
4161
4162 [mailto:enclosed@mail.tld With target]
4163
4164 [mailto:enclosed@mail.tld]
4165
4166 mailto:inline@mail.tld
4167 !! result
4168 <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>
4169 </p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4170 </p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4171 </p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4172 </p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4173 </p>
4174 !! end
4175
4176
4177 #
4178 # Security and HTML correctness
4179 # From Nick Jenkins' fuzz testing
4180 #
4181
4182 !! test
4183 Fuzz testing: Parser13
4184 !! input
4185 {|
4186 | http://a|
4187 !! result
4188 <table>
4189 <tr>
4190 <td>
4191 </td>
4192 </tr>
4193 </table>
4194
4195 !! end
4196
4197 !! test
4198 Fuzz testing: Parser14
4199 !! input
4200 == onmouseover= ==
4201 http://__TOC__
4202 !! result
4203 <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>
4204 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4205 <ul>
4206 <li class='toclevel-1'><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4207 </ul>
4208 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4209
4210 !! end
4211
4212 !! test
4213 Fuzz testing: Parser14-table
4214 !! input
4215 ==a==
4216 {| STYLE=__TOC__
4217 !! result
4218 <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>
4219 <table style="&#95;_TOC&#95;_">
4220 <tr><td></td></tr>
4221 </table>
4222
4223 !! end
4224
4225 # Known to produce bogus xml (extra </td>)
4226 !! test
4227 Fuzz testing: Parser16
4228 !! options
4229 noxml
4230 !! input
4231 {|
4232 !https://||||||
4233 !! result
4234 <table>
4235 <tr>
4236 <th>https://</th><th></th><th></th><th>
4237 </td>
4238 </tr>
4239 </table>
4240
4241 !! end
4242
4243 !! test
4244 Fuzz testing: Parser21
4245 !! input
4246 {|
4247 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4248 |
4249 !! result
4250 <table>
4251 <tr>
4252 <th> <a href="irc://{{ftp://a" class='external free' title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4253 </th><td>
4254 </td>
4255 </tr>
4256 </table>
4257
4258 !! end
4259
4260 !! test
4261 Fuzz testing: Parser22
4262 !! input
4263 http://===r:::https://b
4264
4265 {|
4266 !!result
4267 <p><a href="http://===r:::https://b" class='external free' title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4268 </p>
4269 <table>
4270 <tr><td></td></tr>
4271 </table>
4272
4273 !! end
4274
4275 # Known to produce bad XML for now
4276 !! test
4277 Fuzz testing: Parser24
4278 !! options
4279 noxml
4280 !! input
4281 {|
4282 {{{|
4283 <u CLASS=
4284 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4285 <br style="onmouseover='alert(document.cookie);' " />
4286
4287 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4288 |
4289 !! result
4290 <table>
4291
4292 <u class="&#124;">} &gt;
4293 <br style="onmouseover='alert(document.cookie);' " />
4294
4295 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4296 <tr>
4297 <td></u>
4298 </td>
4299 </tr>
4300 </table>
4301
4302 !! end
4303
4304 # Known to produce bad XML for now
4305 !!test
4306 Fuzz testing: Parser25 (bug 6055)
4307 !! options
4308 noxml
4309 !! input
4310 {{{
4311 |
4312 <LI CLASS=||
4313 >
4314 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4315 !! result
4316 <li class="&#124;&#124;">
4317 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4318
4319 !! end
4320
4321 !!test
4322 Fuzz testing: URL adjacent extension (with space, clean)
4323 !! options
4324 !! input
4325 http://example.com <nowiki>junk</nowiki>
4326 !! result
4327 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
4328 </p>
4329 !!end
4330
4331 !!test
4332 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4333 !! options
4334 !! input
4335 http://example.com<nowiki>junk</nowiki>
4336 !! result
4337 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
4338 </p>
4339 !!end
4340
4341 !!test
4342 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4343 !! options
4344 !! input
4345 http://example.com<pre>junk</pre>
4346 !! result
4347 <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4348
4349 !!end
4350
4351 !!test
4352 Fuzz testing: image with bogus manual thumbnail
4353 !!input
4354 [[Image:foobar.jpg|thumbnail= ]]
4355 !!result
4356 <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>
4357
4358 !!end
4359
4360 !! test
4361 Parsing optional HTML elements (Bug 6171)
4362 !! options
4363 !! input
4364 <table>
4365 <tr>
4366 <td> Some tabular data</td>
4367 <td> More tabular data ...
4368 <td> And yet som tabular data</td>
4369 </tr>
4370 </table>
4371 !! result
4372 <table>
4373 <tr>
4374 <td> Some tabular data</td>
4375 <td> More tabular data ...
4376 </td><td> And yet som tabular data</td>
4377 </tr>
4378 </table>
4379
4380 !! end
4381
4382 !! test
4383 Correct handling of <td>, <tr> (Bug 6171)
4384 !! options
4385 !! input
4386 <table>
4387 <tr>
4388 <td> Some tabular data</td>
4389 <td> More tabular data ...</td>
4390 <td> And yet som tabular data</td>
4391 </tr>
4392 </table>
4393 !! result
4394 <table>
4395 <tr>
4396 <td> Some tabular data</td>
4397 <td> More tabular data ...</td>
4398 <td> And yet som tabular data</td>
4399 </tr>
4400 </table>
4401
4402 !! end
4403
4404
4405 !! test
4406 Parsing crashing regression (fr:JavaScript)
4407 !! input
4408 </body></x>
4409 !! result
4410 <p>&lt;/body&gt;&lt;/x&gt;
4411 </p>
4412 !! end
4413
4414 !! test
4415 Inline wiki vs wiki block nesting
4416 !! input
4417 '''Bold paragraph
4418
4419 New wiki paragraph
4420 !! result
4421 <p><b>Bold paragraph</b>
4422 </p><p>New wiki paragraph
4423 </p>
4424 !! end
4425
4426 !! test
4427 Inline HTML vs wiki block nesting
4428 !! input
4429 <b>Bold paragraph
4430
4431 New wiki paragraph
4432 !! result
4433 <p><b>Bold paragraph</b>
4434 </p><p>New wiki paragraph
4435 </p>
4436 !! end
4437
4438
4439 !!test
4440 Mixing markup for italics and bold
4441 !! options
4442 !! input
4443 '''bold''''''bold''bolditalics'''''
4444 !! result
4445 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4446 </p>
4447 !! end
4448
4449
4450 !! article
4451 Xyzzyx
4452 !! text
4453 Article for special page transclusion test
4454 !! endarticle
4455
4456 !! test
4457 Special page transclusion
4458 !! options
4459 !! input
4460 {{Special:Prefixindex/Xyzzyx}}
4461 !! result
4462 <p><br />
4463 </p>
4464 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4465
4466 !! end
4467
4468 !! test
4469 Special page transclusion twice (bug 5021)
4470 !! options
4471 !! input
4472 {{Special:Prefixindex/Xyzzyx}}
4473 {{Special:Prefixindex/Xyzzyx}}
4474 !! result
4475 <p><br />
4476 </p>
4477 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4478 <p><br />
4479 </p>
4480 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4481
4482 !! end
4483
4484 !! test
4485 Invalid header with following text
4486 !! input
4487 = x = y
4488 !! result
4489 <p>= x = y
4490 </p>
4491 !! end
4492
4493
4494 !! test
4495 Section extraction test (section 0)
4496 !! options
4497 section=0
4498 !! input
4499 start
4500 ==a==
4501 ===aa===
4502 ====aaa====
4503 ==b==
4504 ===ba===
4505 ===bb===
4506 ====bba====
4507 ===bc===
4508 ==c==
4509 ===ca===
4510 !! result
4511 start
4512 !! end
4513
4514 !! test
4515 Section extraction test (section 1)
4516 !! options
4517 section=1
4518 !! input
4519 start
4520 ==a==
4521 ===aa===
4522 ====aaa====
4523 ==b==
4524 ===ba===
4525 ===bb===
4526 ====bba====
4527 ===bc===
4528 ==c==
4529 ===ca===
4530 !! result
4531 ==a==
4532 ===aa===
4533 ====aaa====
4534 !! end
4535
4536 !! test
4537 Section extraction test (section 2)
4538 !! options
4539 section=2
4540 !! input
4541 start
4542 ==a==
4543 ===aa===
4544 ====aaa====
4545 ==b==
4546 ===ba===
4547 ===bb===
4548 ====bba====
4549 ===bc===
4550 ==c==
4551 ===ca===
4552 !! result
4553 ===aa===
4554 ====aaa====
4555 !! end
4556
4557 !! test
4558 Section extraction test (section 3)
4559 !! options
4560 section=3
4561 !! input
4562 start
4563 ==a==
4564 ===aa===
4565 ====aaa====
4566 ==b==
4567 ===ba===
4568 ===bb===
4569 ====bba====
4570 ===bc===
4571 ==c==
4572 ===ca===
4573 !! result
4574 ====aaa====
4575 !! end
4576
4577 !! test
4578 Section extraction test (section 4)
4579 !! options
4580 section=4
4581 !! input
4582 start
4583 ==a==
4584 ===aa===
4585 ====aaa====
4586 ==b==
4587 ===ba===
4588 ===bb===
4589 ====bba====
4590 ===bc===
4591 ==c==
4592 ===ca===
4593 !! result
4594 ==b==
4595 ===ba===
4596 ===bb===
4597 ====bba====
4598 ===bc===
4599 !! end
4600
4601 !! test
4602 Section extraction test (section 5)
4603 !! options
4604 section=5
4605 !! input
4606 start
4607 ==a==
4608 ===aa===
4609 ====aaa====
4610 ==b==
4611 ===ba===
4612 ===bb===
4613 ====bba====
4614 ===bc===
4615 ==c==
4616 ===ca===
4617 !! result
4618 ===ba===
4619 !! end
4620
4621 !! test
4622 Section extraction test (section 6)
4623 !! options
4624 section=6
4625 !! input
4626 start
4627 ==a==
4628 ===aa===
4629 ====aaa====
4630 ==b==
4631 ===ba===
4632 ===bb===
4633 ====bba====
4634 ===bc===
4635 ==c==
4636 ===ca===
4637 !! result
4638 ===bb===
4639 ====bba====
4640 !! end
4641
4642 !! test
4643 Section extraction test (section 7)
4644 !! options
4645 section=7
4646 !! input
4647 start
4648 ==a==
4649 ===aa===
4650 ====aaa====
4651 ==b==
4652 ===ba===
4653 ===bb===
4654 ====bba====
4655 ===bc===
4656 ==c==
4657 ===ca===
4658 !! result
4659 ====bba====
4660 !! end
4661
4662 !! test
4663 Section extraction test (section 8)
4664 !! options
4665 section=8
4666 !! input
4667 start
4668 ==a==
4669 ===aa===
4670 ====aaa====
4671 ==b==
4672 ===ba===
4673 ===bb===
4674 ====bba====
4675 ===bc===
4676 ==c==
4677 ===ca===
4678 !! result
4679 ===bc===
4680 !! end
4681
4682 !! test
4683 Section extraction test (section 9)
4684 !! options
4685 section=9
4686 !! input
4687 start
4688 ==a==
4689 ===aa===
4690 ====aaa====
4691 ==b==
4692 ===ba===
4693 ===bb===
4694 ====bba====
4695 ===bc===
4696 ==c==
4697 ===ca===
4698 !! result
4699 ==c==
4700 ===ca===
4701 !! end
4702
4703 !! test
4704 Section extraction test (section 10)
4705 !! options
4706 section=10
4707 !! input
4708 start
4709 ==a==
4710 ===aa===
4711 ====aaa====
4712 ==b==
4713 ===ba===
4714 ===bb===
4715 ====bba====
4716 ===bc===
4717 ==c==
4718 ===ca===
4719 !! result
4720 ===ca===
4721 !! end
4722
4723 !! test
4724 Section extraction test (nonexistent section 11)
4725 !! options
4726 section=11
4727 !! input
4728 start
4729 ==a==
4730 ===aa===
4731 ====aaa====
4732 ==b==
4733 ===ba===
4734 ===bb===
4735 ====bba====
4736 ===bc===
4737 ==c==
4738 ===ca===
4739 !! result
4740 !! end
4741
4742 !! test
4743 Section extraction test with bogus heading (section 1)
4744 !! options
4745 section=1
4746 !! input
4747 ==a==
4748 ==bogus== not a legal section
4749 ==b==
4750 !! result
4751 ==a==
4752 ==bogus== not a legal section
4753 !! end
4754
4755 !! test
4756 Section extraction test with bogus heading (section 2)
4757 !! options
4758 section=2
4759 !! input
4760 ==a==
4761 ==bogus== not a legal section
4762 ==b==
4763 !! result
4764 ==b==
4765 !! end
4766
4767 !! test
4768 Section extraction test with comment after heading (section 1)
4769 !! options
4770 section=1
4771 !! input
4772 ==a==
4773 ==legal== <!-- a legal section -->
4774 ==b==
4775 !! result
4776 ==a==
4777 !! end
4778
4779 !! test
4780 Section extraction test with comment after heading (section 2)
4781 !! options
4782 section=2
4783 !! input
4784 ==a==
4785 ==legal== <!-- a legal section -->
4786 ==b==
4787 !! result
4788 ==legal== <!-- a legal section -->
4789 !! end
4790
4791 !! test
4792 Section extraction test with bogus <nowiki> heading (section 1)
4793 !! options
4794 section=1
4795 !! input
4796 ==a==
4797 ==bogus== <nowiki>not a legal section</nowiki>
4798 ==b==
4799 !! result
4800 ==a==
4801 ==bogus== <nowiki>not a legal section</nowiki>
4802 !! end
4803
4804 !! test
4805 Section extraction test with bogus <nowiki> heading (section 2)
4806 !! options
4807 section=2
4808 !! input
4809 ==a==
4810 ==bogus== <nowiki>not a legal section</nowiki>
4811 ==b==
4812 !! result
4813 ==b==
4814 !! end
4815
4816
4817 !! test
4818 Section extraction prefixed by comment (section 1) (bug 2587)
4819 !! options
4820 section=1
4821 !! input
4822 <!-- -->==sec1==
4823 ==sec2==
4824 !!result
4825 <!-- -->==sec1==
4826 !!end
4827
4828 !! test
4829 Section extraction prefixed by comment (section 2) (bug 2587)
4830 !! options
4831 section=2
4832 !! input
4833 <!-- -->==sec1==
4834 ==sec2==
4835 !!result
4836 ==sec2==
4837 !!end
4838
4839
4840 !! test
4841 Section extraction, mixed wiki and html (section 1) (bug 2607)
4842 !! options
4843 section=1
4844 !! input
4845 <h2>1</h2>
4846 one
4847 ==2==
4848 two
4849 ==3==
4850 three
4851 !! result
4852 <h2>1</h2>
4853 one
4854 !! end
4855
4856 !! test
4857 Section extraction, mixed wiki and html (section 2) (bug 2607)
4858 !! options
4859 section=2
4860 !! input
4861 <h2>1</h2>
4862 one
4863 ==2==
4864 two
4865 ==3==
4866 three
4867 !! result
4868 ==2==
4869 two
4870 !! end
4871
4872
4873 !! test
4874 Section extraction, heading surrounded by <noinclude> (bug 3342)
4875 !! options
4876 section=1
4877 !! input
4878 <noinclude>==a==</noinclude>
4879 text
4880 !! result
4881 <noinclude>==a==</noinclude>
4882 text
4883 !!end
4884
4885
4886 !! test
4887 Section extraction, HTML heading subsections (bug 5272)
4888 !! options
4889 section=1
4890 !! input
4891 <h2>a</h2>
4892 <h3>aa</h3>
4893 <h2>b</h2>
4894 !! result
4895 <h2>a</h2>
4896 <h3>aa</h3>
4897 !! end
4898
4899 !! test
4900 Section extraction, HTML headings should be ignored in extensions (bug 3476)
4901 !! options
4902 section=2
4903 !! input
4904 <h2>a</h2>
4905 <tag>
4906 <h2>not b</h2>
4907 </tag>
4908 <h2>b</h2>
4909 !! result
4910 <h2>b</h2>
4911 !! end
4912
4913 !! test
4914 Section replacement test (section 0)
4915 !! options
4916 replace=0,"xxx"
4917 !! input
4918 start
4919 ==a==
4920 ===aa===
4921 ====aaa====
4922 ==b==
4923 ===ba===
4924 ===bb===
4925 ====bba====
4926 ===bc===
4927 ==c==
4928 ===ca===
4929 !! result
4930 xxx
4931
4932 ==a==
4933 ===aa===
4934 ====aaa====
4935 ==b==
4936 ===ba===
4937 ===bb===
4938 ====bba====
4939 ===bc===
4940 ==c==
4941 ===ca===
4942 !! end
4943
4944 !! test
4945 Section replacement test (section 1)
4946 !! options
4947 replace=1,"xxx"
4948 !! input
4949 start
4950 ==a==
4951 ===aa===
4952 ====aaa====
4953 ==b==
4954 ===ba===
4955 ===bb===
4956 ====bba====
4957 ===bc===
4958 ==c==
4959 ===ca===
4960 !! result
4961 start
4962 xxx
4963
4964 ==b==
4965 ===ba===
4966 ===bb===
4967 ====bba====
4968 ===bc===
4969 ==c==
4970 ===ca===
4971 !! end
4972
4973 !! test
4974 Section replacement test (section 2)
4975 !! options
4976 replace=2,"xxx"
4977 !! input
4978 start
4979 ==a==
4980 ===aa===
4981 ====aaa====
4982 ==b==
4983 ===ba===
4984 ===bb===
4985 ====bba====
4986 ===bc===
4987 ==c==
4988 ===ca===
4989 !! result
4990 start
4991 ==a==
4992 xxx
4993
4994 ==b==
4995 ===ba===
4996 ===bb===
4997 ====bba====
4998 ===bc===
4999 ==c==
5000 ===ca===
5001 !! end
5002
5003 !! test
5004 Section replacement test (section 3)
5005 !! options
5006 replace=3,"xxx"
5007 !! input
5008 start
5009 ==a==
5010 ===aa===
5011 ====aaa====
5012 ==b==
5013 ===ba===
5014 ===bb===
5015 ====bba====
5016 ===bc===
5017 ==c==
5018 ===ca===
5019 !! result
5020 start
5021 ==a==
5022 ===aa===
5023 xxx
5024
5025 ==b==
5026 ===ba===
5027 ===bb===
5028 ====bba====
5029 ===bc===
5030 ==c==
5031 ===ca===
5032 !! end
5033
5034 !! test
5035 Section replacement test (section 4)
5036 !! options
5037 replace=4,"xxx"
5038 !! input
5039 start
5040 ==a==
5041 ===aa===
5042 ====aaa====
5043 ==b==
5044 ===ba===
5045 ===bb===
5046 ====bba====
5047 ===bc===
5048 ==c==
5049 ===ca===
5050 !! result
5051 start
5052 ==a==
5053 ===aa===
5054 ====aaa====
5055 xxx
5056
5057 ==c==
5058 ===ca===
5059 !! end
5060
5061 !! test
5062 Section replacement test (section 5)
5063 !! options
5064 replace=5,"xxx"
5065 !! input
5066 start
5067 ==a==
5068 ===aa===
5069 ====aaa====
5070 ==b==
5071 ===ba===
5072 ===bb===
5073 ====bba====
5074 ===bc===
5075 ==c==
5076 ===ca===
5077 !! result
5078 start
5079 ==a==
5080 ===aa===
5081 ====aaa====
5082 ==b==
5083 xxx
5084
5085 ===bb===
5086 ====bba====
5087 ===bc===
5088 ==c==
5089 ===ca===
5090 !! end
5091
5092 !! test
5093 Section replacement test (section 6)
5094 !! options
5095 replace=6,"xxx"
5096 !! input
5097 start
5098 ==a==
5099 ===aa===
5100 ====aaa====
5101 ==b==
5102 ===ba===
5103 ===bb===
5104 ====bba====
5105 ===bc===
5106 ==c==
5107 ===ca===
5108 !! result
5109 start
5110 ==a==
5111 ===aa===
5112 ====aaa====
5113 ==b==
5114 ===ba===
5115 xxx
5116
5117 ===bc===
5118 ==c==
5119 ===ca===
5120 !! end
5121
5122 !! test
5123 Section replacement test (section 7)
5124 !! options
5125 replace=7,"xxx"
5126 !! input
5127 start
5128 ==a==
5129 ===aa===
5130 ====aaa====
5131 ==b==
5132 ===ba===
5133 ===bb===
5134 ====bba====
5135 ===bc===
5136 ==c==
5137 ===ca===
5138 !! result
5139 start
5140 ==a==
5141 ===aa===
5142 ====aaa====
5143 ==b==
5144 ===ba===
5145 ===bb===
5146 xxx
5147
5148 ===bc===
5149 ==c==
5150 ===ca===
5151 !! end
5152
5153 !! test
5154 Section replacement test (section 8)
5155 !! options
5156 replace=8,"xxx"
5157 !! input
5158 start
5159 ==a==
5160 ===aa===
5161 ====aaa====
5162 ==b==
5163 ===ba===
5164 ===bb===
5165 ====bba====
5166 ===bc===
5167 ==c==
5168 ===ca===
5169 !! result
5170 start
5171 ==a==
5172 ===aa===
5173 ====aaa====
5174 ==b==
5175 ===ba===
5176 ===bb===
5177 ====bba====
5178 xxx
5179
5180 ==c==
5181 ===ca===
5182 !!end
5183
5184 !! test
5185 Section replacement test (section 9)
5186 !! options
5187 replace=9,"xxx"
5188 !! input
5189 start
5190 ==a==
5191 ===aa===
5192 ====aaa====
5193 ==b==
5194 ===ba===
5195 ===bb===
5196 ====bba====
5197 ===bc===
5198 ==c==
5199 ===ca===
5200 !! result
5201 start
5202 ==a==
5203 ===aa===
5204 ====aaa====
5205 ==b==
5206 ===ba===
5207 ===bb===
5208 ====bba====
5209 ===bc===
5210 xxx
5211 !! end
5212
5213 !! test
5214 Section replacement test (section 10)
5215 !! options
5216 replace=10,"xxx"
5217 !! input
5218 start
5219 ==a==
5220 ===aa===
5221 ====aaa====
5222 ==b==
5223 ===ba===
5224 ===bb===
5225 ====bba====
5226 ===bc===
5227 ==c==
5228 ===ca===
5229 !! result
5230 start
5231 ==a==
5232 ===aa===
5233 ====aaa====
5234 ==b==
5235 ===ba===
5236 ===bb===
5237 ====bba====
5238 ===bc===
5239 ==c==
5240 xxx
5241 !! end
5242
5243
5244 !! test
5245 Section extraction, HTML headings not at line boundaries (section 0)
5246 !! options
5247 section=0
5248 !! input
5249 <h2>Evil</h2><i>blah blah blah</i>
5250
5251 evil blah
5252
5253 <h2>Nice</h2>
5254
5255 nice blah
5256
5257 <i>extra evil</i><h2>Extra nasty</h2>
5258
5259 extra nasty
5260 !! result
5261 !! end
5262
5263 !! test
5264 Section extraction, HTML headings not at line boundaries (section 1)
5265 !! options
5266 section=1
5267 !! input
5268 <h2>Evil</h2><i>blah blah blah</i>
5269
5270 evil blah
5271
5272 <h2>Nice</h2>
5273
5274 nice blah
5275
5276 <i>extra evil</i><h2>Extra nasty</h2>
5277
5278 extra nasty
5279 !! result
5280 <h2>Evil</h2><i>blah blah blah</i>
5281
5282 evil blah
5283 !! end
5284
5285 !! test
5286 Section extraction, HTML headings not at line boundaries (section 2)
5287 !! options
5288 section=2
5289 !! input
5290 <h2>Evil</h2><i>blah blah blah</i>
5291
5292 evil blah
5293
5294 <h2>Nice</h2>
5295
5296 nice blah
5297
5298 <i>extra evil</i><h2>Extra nasty</h2>
5299
5300 extra nasty
5301 !! result
5302 <h2>Nice</h2>
5303
5304 nice blah
5305
5306 <i>extra evil</i>
5307 !! end
5308
5309 !! test
5310 Section extraction, HTML headings not at line boundaries (section 3)
5311 !! options
5312 section=3
5313 !! input
5314 <h2>Evil</h2><i>blah blah blah</i>
5315
5316 evil blah
5317
5318 <h2>Nice</h2>
5319
5320 nice blah
5321
5322 <i>extra evil</i><h2>Extra nasty</h2>
5323
5324 extra nasty
5325 !! result
5326 <h2>Extra nasty</h2>
5327
5328 extra nasty
5329 !! end
5330
5331 #
5332 #
5333 #
5334
5335 TODO:
5336 more images
5337 more tables
5338 math
5339 character entities
5340 and much more