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