Update tests for 289:
[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 # title=[[XXX]] run test using article title XXX
20 # disabled do not run test
21 #
22 # For testing purposes, temporary articles can created:
23 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
24 # where '/' denotes a newline.
25
26 # This is the standard article assumed to exist.
27 !! article
28 Main Page
29 !! text
30 blah blah
31 !! endarticle
32
33 ###
34 ### Basic tests
35 ###
36 !! test
37 Blank input
38 !! input
39 !! result
40 !! end
41
42
43 !! test
44 Simple paragraph
45 !! input
46 This is a simple paragraph.
47 !! result
48 <p>This is a simple paragraph.
49 </p>
50 !! end
51
52 !! test
53 Simple list
54 !! input
55 * Item 1
56 * Item 2
57 !! result
58 <ul><li> Item 1
59 </li><li> Item 2
60 </li></ul>
61
62 !! end
63
64 !! test
65 Italics and bold
66 !! input
67 * plain
68 * plain''italic''plain
69 * plain''italic''plain''italic''plain
70 * plain'''bold'''plain
71 * plain'''bold'''plain'''bold'''plain
72 * plain''italic''plain'''bold'''plain
73 * plain'''bold'''plain''italic''plain
74 * plain''italic'''bold-italic'''italic''plain
75 * plain'''bold''bold-italic''bold'''plain
76 * plain'''''bold-italic'''italic''plain
77 * plain'''''bold-italic''bold'''plain
78 * plain''italic'''bold-italic'''''plain
79 * plain'''bold''bold-italic'''''plain
80 * plain l'''italic''plain
81 !! result
82 <ul><li> plain
83 </li><li> plain<i>italic</i>plain
84 </li><li> plain<i>italic</i>plain<i>italic</i>plain
85 </li><li> plain<b>bold</b>plain
86 </li><li> plain<b>bold</b>plain<b>bold</b>plain
87 </li><li> plain<i>italic</i>plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<i>italic</i>plain
89 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
90 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
91 </li><li> plain<i><b>bold-italic</b>italic</i>plain
92 </li><li> plain<b><i>bold-italic</i>bold</b>plain
93 </li><li> plain<i>italic<b>bold-italic</b></i>plain
94 </li><li> plain<b>bold<i>bold-italic</i></b>plain
95 </li><li> plain l'<i>italic</i>plain
96 </li></ul>
97
98 !! end
99
100 ###
101 ### <nowiki> test cases
102 ###
103
104 !! test
105 <nowiki> unordered list
106 !! input
107 <nowiki>* This is not an unordered list item.</nowiki>
108 !! result
109 <p>* This is not an unordered list item.
110 </p>
111 !! end
112
113 !! test
114 <nowiki> spacing
115 !! input
116 <nowiki>Lorem ipsum dolor
117
118 sed abit.
119 sed nullum.
120
121 :and a colon
122 </nowiki>
123 !! result
124 <p>Lorem ipsum dolor
125
126 sed abit.
127 sed nullum.
128
129 :and a colon
130
131 </p>
132 !! end
133
134 !! test
135 nowiki 3
136 !! input
137 :There is not nowiki.
138 :There is <nowiki>nowiki</nowiki>.
139
140 #There is not nowiki.
141 #There is <nowiki>nowiki</nowiki>.
142
143 *There is not nowiki.
144 *There is <nowiki>nowiki</nowiki>.
145 !! result
146 <dl><dd>There is not nowiki.
147 </dd><dd>There is nowiki.
148 </dd></dl>
149 <ol><li>There is not nowiki.
150 </li><li>There is nowiki.
151 </li></ol>
152 <ul><li>There is not nowiki.
153 </li><li>There is nowiki.
154 </li></ul>
155
156 !! end
157
158 ###
159 ### comment test cases
160 ###
161 !! test
162 Comment test 1
163 !! input
164 <!-- comment 1 --> asdf
165 <!-- comment 2 -->
166 !! result
167 <pre>asdf
168 </pre>
169
170 !! end
171
172 !! test
173 Comment test 2
174 !! input
175 asdf
176 <!-- comment 1 -->
177 jkl
178 !! result
179 <p>asdf
180 jkl
181 </p>
182 !! end
183
184 !! test
185 Comment test 3
186 !! input
187 asdf
188 <!-- comment 1 -->
189 <!-- comment 2 -->
190 jkl
191 !! result
192 <p>asdf
193 jkl
194 </p>
195 !! end
196
197 !! test
198 Comment test 4
199 !! input
200 asdf<!-- comment 1 -->jkl
201 !! result
202 <p>asdfjkl
203 </p>
204 !! end
205
206 !! test
207 Comment spacing
208 !! input
209 a
210 <!-- foo --> b <!-- bar -->
211 c
212 !! result
213 <p>a
214 </p>
215 <pre> b
216 </pre>
217 <p>c
218 </p>
219 !! end
220
221 ###
222 ### Preformatted text
223 ###
224 !! test
225 Preformatted text
226 !! input
227 This is some
228 Preformatted text
229 With ''italic''
230 And '''bold'''
231 And a [[Main Page|link]]
232 !! result
233 <pre>This is some
234 Preformatted text
235 With <i>italic</i>
236 And <b>bold</b>
237 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
238 </pre>
239 !! end
240
241 ###
242 ### Definition list
243 ###
244 !! test
245 Simple definition
246 !! input
247 ; name : Definition
248 !! result
249 <dl><dt> name&nbsp;</dt><dd> Definition
250 </dd></dl>
251
252 !! end
253
254 !! test
255 Simple definition
256 !! input
257 : Indented text
258 !! result
259 <dl><dd> Indented text
260 </dd></dl>
261
262 !! end
263
264 !! test
265 Definition list with no space
266 !! input
267 ;name:Definition
268 !! result
269 <dl><dt>name</dt><dd>Definition
270 </dd></dl>
271
272 !!end
273
274 !! test
275 Definition list with URL link
276 !! input
277 ; http://example.com/ : definition
278 !! result
279 <dl><dt> <a href="http://example.com/" class='external'>http://example.com/</a>&nbsp;</dt><dd> definition
280 </dd></dl>
281
282 !! end
283
284 !! test
285 Definition list with bracketed URL link
286 !! input
287 ;[http://www.google.com/ Google]:Number one search engine
288 !! result
289 <dl><dt><a href="http://www.google.com/" class='external' title="http://www.google.com/">Google</a><span class='urlexpansion'> (<i>http://www.google.com/</i>)</span></dt><dd>Number one search engine
290 </dd></dl>
291
292 !! end
293
294 !! test
295 Definition list with wikilink containing colon
296 !! input
297 ; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
298 !! result
299 <dl><dt> <a href="http://en.wikipedia.org/wiki/FAQ" class='extiw'>Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
300 </dd></dl>
301
302 !! end
303
304 # At Brion's and JeLuF's insistence... :)
305 !! test
306 Definition list with wikilink containing colon
307 !! input
308 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
309 !! result
310 <dl><dt> <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
311 </dd></dl>
312
313 !! end
314
315 !! test
316 Malformed definition list with colon
317 !! input
318 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
319 !! result
320 <dl><dt> <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
321 </dt></dl>
322
323 !! end
324
325 !! test
326 Definition lists: colon in external link text
327 !! input
328 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
329 !! result
330 <dl><dt> <a href="http://www.wikipedia2.org/" class='external' title="http://www.wikipedia2.org/">Wikipedia&nbsp;: The Next Generation</a><span class='urlexpansion'> (<i>http://www.wikipedia2.org/</i>)</span></dt><dd> OK, I made that up
331 </dd></dl>
332
333 !! end
334
335
336 ###
337 ### External links
338 ###
339 !! test
340 External links: non-bracketed
341 !! input
342 Non-bracketed: http://example.com
343 !! result
344 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
345 </p>
346 !! end
347
348 !! test
349 External links: numbered
350 !! input
351 Numbered: [http://example.com]
352 !! result
353 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
354 </p>
355 !!end
356
357 !! test
358 External links: specified text
359 !! input
360 Specified text: [http://example.com link]
361 !! result
362 <p>Specified text: <a href="http://example.com" class='external' title="http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
363 </p>
364 !!end
365
366 !! test
367 External links: trail
368 !! input
369 Trail (not sure if this is meant to work): [http://example.com link]s
370 !! result
371 <p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external' title="http://example.com">link</a>s<span class='urlexpansion'> (<i>http://example.com</i>)</span>
372 </p>
373 !! end
374
375 !! test
376 External links: dollar sign in URL
377 !! input
378 http://example.com/1$2345
379 !! result
380 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
381 </p>
382 !! end
383
384 !! test
385 External links: dollar sign in URL (named)
386 !! input
387 [http://example.com/1$2345]
388 !! result
389 <p><a href="http://example.com/1$2345" class='external' title="http://example.com/1$2345">[1]</a><span class='urlexpansion'> (<i>http://example.com/1$2345</i>)</span>
390 </p>
391 !!end
392
393 !! test
394 External image
395 !! input
396 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
397 !! result
398 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
399 </p>
400 !! end
401
402 !! test
403 External image from https
404 !! input
405 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
406 !! result
407 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
408 </p>
409 !! end
410
411 !! test
412 Link to non-http image, no img tag
413 !! input
414 Link to non-http image, no img tag: ftp://example.com/test.jpg
415 !! result
416 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
417 </p>
418 !! end
419
420 !! test
421 External links: terminating separator
422 !! input
423 Terminating separator: http://example.com/thing,
424 !! result
425 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
426 </p>
427 !! end
428
429 !! test
430 External links: intervening separator
431 !! input
432 Intervening separator: http://example.com/1,2,3
433 !! result
434 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
435 </p>
436 !! end
437
438 !! test
439 External links: old bug with URL in query
440 !! input
441 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
442 !! result
443 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external' title="http://example.com/thing?url=http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com/thing?url=http://example.com</i>)</span>
444 </p>
445 !! end
446
447 !! test
448 External links: old URL-in-URL bug, mixed protocols
449 !! input
450 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
451 !! result
452 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external' title="ftp://example.com?url=http://example.com">link</a><span class='urlexpansion'> (<i>ftp://example.com?url=http://example.com</i>)</span>
453 </p>
454 !!end
455
456 !! test
457 External links: URL in text
458 !! input
459 URL in text: [http://example.com http://example.com]
460 !! result
461 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
462 </p>
463 !! end
464
465 !! test
466 External links: Clickable images
467 !! input
468 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
469 !! result
470 <p>ja-style clickable images: <a href="http://example.com" class='external' title="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
471 </p>
472 !!end
473
474 !! test
475 External links: raw ampersand
476 !! input
477 Old &amp; use: http://x&y
478 !! result
479 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
480 </p>
481 !! end
482
483 !! test
484 External links: www.jpeg.org (bug 554)
485 !! input
486 http://www.jpeg.org
487 !!result
488 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
489 </p>
490 !! end
491
492 !! test
493 External links: URL within URL (original bug 2)
494 !! input
495 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
496 !! result
497 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class='external' title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a><span class='urlexpansion'> (<i>http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp</i>)</span>
498 </p>
499 !! end
500
501 !! test
502 BUG 361: URL inside bracketed URL
503 !! input
504 [http://www.example.com/foo http://www.example.com/bar]
505 !! result
506 <p><a href="http://www.example.com/foo" class='external' title="http://www.example.com/foo">http://www.example.com/bar</a><span class='urlexpansion'> (<i>http://www.example.com/foo</i>)</span>
507 </p>
508 !! end
509
510 !! test
511 BUG 289: ">"-token in URL-tail
512 !! input
513 http://www.example.com/<hello>
514 !! result
515 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a>&lt;hello&gt;
516 </p>
517 !!end
518
519 !! test
520 BUG 289: literal ">"-token in URL-tail
521 !! input
522 http://www.example.com/<b>html</b>
523 !! result
524 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a><b >html</b >
525 </p>
526 !!end
527
528 !! test
529 BUG 289: ">"-token in bracketed URL
530 !! input
531 [http://www.example.com/<hello> stuff]
532 !! result
533 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/">&lt;hello&gt; stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
534 </p>
535 !!end
536
537 !! test
538 BUG 289: literal ">"-token in bracketed URL
539 !! input
540 [http://www.example.com/<b>html</b> stuff]
541 !! result
542 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/"><b >html</b > stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
543 </p>
544 !!end
545
546 !! test
547 BUG 289: literal double quote at end of URL
548 !! input
549 http://www.example.com/"hello"
550 !! result
551 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a>"hello"
552 </p>
553 !!end
554
555 !! test
556 BUG 289: literal double quote in bracketed URL
557 !! input
558 [http://www.example.com/"hello" stuff]
559 !! result
560 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/">"hello" stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
561 </p>
562 !!end
563
564 ###
565 ### Quotes
566 ###
567
568 !! test
569 Quotes
570 !! input
571 Normal text. '''Bold text.''' Normal text. ''Italic text.''
572
573 Normal text. '''''Bold italic text.''''' Normal text.
574 !!result
575 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
576 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
577 </p>
578 !! end
579
580
581 !! test
582 Unclosed and unmatched quotes
583 !! input
584 '''''Bold italic text '''with bold deactivated''' in between.'''''
585
586 '''''Bold italic text ''with italic deactivated'' in between.'''''
587
588 '''Bold text..
589
590 ..spanning two paragraphs (should not work).'''
591
592 '''Bold tag left open
593
594 ''Italic tag left open
595
596 Normal text.
597
598 <!-- Unmatching number of opening, closing tags: -->
599 '''This year''''s election ''should'' beat '''last year''''s.
600
601 ''Tom'''s car is bigger than ''Susan'''s.
602 !! result
603 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
604 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
605 </p><p><b>Bold text..</b>
606 </p><p>..spanning two paragraphs (should not work).<b></b>
607 </p><p><b>Bold tag left open</b>
608 </p><p><i>Italic tag left open</i>
609 </p><p>Normal text.
610 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
611 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
612 </p>
613 !! end
614
615 ###
616 ### Tables
617 ###
618 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
619 ###
620 !! test
621 Simple table
622 !! input
623 {|
624 | 1 || 2
625 |-
626 | 3 || 4
627 |}
628 !! result
629 <table >
630 <tr >
631 <td> 1 </td><td> 2
632 </td></tr>
633 <tr >
634 <td> 3 </td><td> 4
635 </td></tr></table>
636
637 !! end
638
639 !! test
640 Multiplication table
641 !! input
642 {| border="1" cellpadding="2"
643 |+Multiplication table
644 |-
645 ! &times; !! 1 !! 2 !! 3
646 |-
647 ! 1
648 | 1 || 2 || 3
649 |-
650 ! 2
651 | 2 || 4 || 6
652 |-
653 ! 3
654 | 3 || 6 || 9
655 |-
656 ! 4
657 | 4 || 8 || 12
658 |-
659 ! 5
660 | 5 || 10 || 15
661 |}
662 !! result
663 <table border="1" cellpadding="2">
664 <caption>Multiplication table
665 </caption>
666 <tr >
667 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
668 </th></tr>
669 <tr >
670 <th> 1
671 </th><td> 1 </td><td> 2 </td><td> 3
672 </td></tr>
673 <tr >
674 <th> 2
675 </th><td> 2 </td><td> 4 </td><td> 6
676 </td></tr>
677 <tr >
678 <th> 3
679 </th><td> 3 </td><td> 6 </td><td> 9
680 </td></tr>
681 <tr >
682 <th> 4
683 </th><td> 4 </td><td> 8 </td><td> 12
684 </td></tr>
685 <tr >
686 <th> 5
687 </th><td> 5 </td><td> 10 </td><td> 15
688 </td></tr></table>
689
690 !! end
691
692 !! test
693 Table rowspan
694 !! input
695 {| align=right border=1
696 | Cell 1, row 1
697 |rowspan=2| Cell 2, row 1 (and 2)
698 | Cell 3, row 1
699 |-
700 | Cell 1, row 2
701 | Cell 3, row 2
702 |}
703 !! result
704 <table align=right border=1>
705 <tr >
706 <td> Cell 1, row 1
707 </td><td rowspan=2> Cell 2, row 1 (and 2)
708 </td><td> Cell 3, row 1
709 </td></tr>
710 <tr >
711 <td> Cell 1, row 2
712 </td><td> Cell 3, row 2
713 </td></tr></table>
714
715 !! end
716
717 !! test
718 Nested table
719 !! input
720 {| border=1
721 | &alpha;
722 |
723 {| bgcolor=#ABCDEF border=2
724 |nested
725 |-
726 |table
727 |}
728 |the original table again
729 |}
730 !! result
731 <table border=1>
732 <tr >
733 <td> &alpha;
734 </td><td>
735 <table bgcolor=#ABCDEF border=2>
736 <tr >
737 <td>nested
738 </td></tr>
739 <tr >
740 <td>table
741 </td></tr></table>
742 </td><td>the original table again
743 </td></tr></table>
744
745 !! end
746
747 ###
748 ### Internal links
749 ###
750 !! test
751 Plain link, capitalized
752 !! input
753 [[Main Page]]
754 !! result
755 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
756 </p>
757 !! end
758
759 !! test
760 Plain link, uncapitalized
761 !! input
762 [[main Page]]
763 !! result
764 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
765 </p>
766 !! end
767
768 !! test
769 Piped link
770 !! input
771 [[Main Page|The Main Page]]
772 !! result
773 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
774 </p>
775 !! end
776
777 !! test
778 Broken link
779 !! input
780 [[Zigzagzogzagzig]]
781 !! result
782 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
783 </p>
784 !! end
785
786 !! test
787 Link with prefix
788 !! input
789 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
790 !! result
791 <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>
792 </p>
793 !! end
794
795 !! test
796 Link with suffix
797 !! input
798 [[Main Page]]xxx, [[Main Page]]XXX
799 !! result
800 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
801 </p>
802 !! end
803
804 !! test
805 Link with 3 brackets
806 !! input
807 [[[main page]]]
808 !! result
809 <p>[[[main page]]]
810 </p>
811 !! end
812
813 !! test
814 Piped link with 3 brackets
815 !! input
816 [[[main page|the main page]]]
817 !! result
818 <p>[[[main page|the main page]]]
819 </p>
820 !! end
821
822 !! test
823 Link to namespaces
824 !! input
825 [[Talk:Parser testing]], [[Meta:Disclaimers]]
826 !! result
827 <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>
828 </p>
829 !! end
830
831 !! test
832 Piped link to namespace
833 !! input
834 [[Meta:Disclaimers|The disclaimers]]
835 !! result
836 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
837 </p>
838 !! end
839
840 !! test
841 Link containing }
842 !! input
843 [[Usually caused by a typo (oops}]]
844 !! result
845 <p>[[Usually caused by a typo (oops}]]
846 </p>
847 !! end
848
849
850 !! test
851 Plain link to URL
852 !! input
853 [[http://www.example.org]]
854 !! result
855 <p>[<a href="http://www.example.org" class='external' title="http://www.example.org">[1]</a><span class='urlexpansion'> (<i>http://www.example.org</i>)</span>]
856 </p>
857 !! end
858
859 # I'm fairly sure the expected result here is wrong.
860 # We want these to be URL links, not pseudo-pages with URLs for titles....
861 # However the current output is also pretty screwy.
862 #
863 # ----
864 # I'm changing it to match the current output--it arguably makes more
865 # sense in the light of the test above. Old expected result was:
866 #<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>
867 #</p>
868 # But I think this test is bordering on "garbage in, garbage out" anyway.
869 # -- wtm
870 !! test
871 Piped link to URL
872 !! input
873 Piped link to URL: [[http://www.example.org|an example URL]]
874 !! result
875 <p>Piped link to URL: [<a href="http://www.example.org|an" class='external' title="http://www.example.org|an">example URL</a><span class='urlexpansion'> (<i>http://www.example.org|an</i>)</span>]
876 </p>
877 !! end
878
879 !! test
880 BUG 2: [[page|http://url/]] should link to page, not http://url/
881 !! input
882 [[Main Page|http://url/]]
883 !! result
884 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
885 </p>
886 !! end
887
888
889 ###
890 ### Interwiki links
891 ###
892
893 !! test
894 Inline interwiki link
895 !! input
896 [[MeatBall:SoftSecurity]]
897 !! result
898 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
899 </p>
900 !! end
901
902 ##
903 ## XHTML tidiness
904 ###
905
906 !! test
907 <br> to <br />
908 !! input
909 1<br>2<br />3
910 !! result
911 <p>1<br />2<br />3
912 </p>
913 !! end
914
915 ###
916 ### Block-level elements
917 ###
918 !! test
919 Common list
920 !! input
921 *Common list
922 * item 2
923 *item 3
924 !! result
925 <ul><li>Common list
926 </li><li> item 2
927 </li><li>item 3
928 </li></ul>
929
930 !! end
931
932 !! test
933 Numbered list
934 !! input
935 #Numbered list
936 #item 2
937 # item 3
938 !! result
939 <ol><li>Numbered list
940 </li><li>item 2
941 </li><li> item 3
942 </li></ol>
943
944 !! end
945
946 !! test
947 Mixed list
948 !! input
949 *Mixed list
950 *# with numbers
951 ** and bullets
952 *# and numbers
953 *bullets again
954 **bullet level 2
955 ***bullet level 3
956 ***#Number on level 4
957 **bullet level 2
958 **#Number on level 3
959 **#Number on level 3
960 *#number level 2
961 *Level 1
962 !! result
963 <ul><li>Mixed list
964 <ol><li> with numbers
965 </li></ol>
966 <ul><li> and bullets
967 </li></ul>
968 <ol><li> and numbers
969 </li></ol>
970 </li><li>bullets again
971 <ul><li>bullet level 2
972 <ul><li>bullet level 3
973 <ol><li>Number on level 4
974 </li></ol>
975 </li></ul>
976 </li><li>bullet level 2
977 <ol><li>Number on level 3
978 </li><li>Number on level 3
979 </li></ol>
980 </li></ul>
981 <ol><li>number level 2
982 </li></ol>
983 </li><li>Level 1
984 </li></ul>
985
986 !! end
987
988 ###
989 ### Magic variables
990 ###
991 !! test
992 Magic variables
993 !! input
994 {{SITENAME}}
995 !! result
996 <p>MediaWiki
997 </p>
998 !! end
999
1000 ###
1001 ### Magic links
1002 ###
1003 !! test
1004 Magic links: internal link to RFC
1005 !! input
1006 [[RFC 123]]
1007 !! result
1008 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1009 </p>
1010 !! end
1011
1012 !! test
1013 Magic links: RFC
1014 !! input
1015 RFC 822
1016 !! result
1017 <p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
1018 </p>
1019 !! end
1020
1021 !! test
1022 Magic links: ISBN
1023 !! input
1024 ISBN 0-306-40615-2
1025 !! result
1026 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1027 </p>
1028 !! end
1029
1030 ###
1031 ### Templates
1032 ####
1033
1034 !! test
1035 Nonexistant template
1036 !! input
1037 {{thistemplatedoesnotexist}}
1038 !! result
1039 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1040 </p>
1041 !! end
1042
1043 !! article
1044 Template:test
1045 !! text
1046 This is a test template
1047 !! endarticle
1048
1049 !! test
1050 Simple template
1051 !! input
1052 {{test}}
1053 !! result
1054 <p>This is a test template
1055 </p>
1056 !! end
1057
1058 !! test
1059 Template with explicit namespace
1060 !! input
1061 {{Template:test}}
1062 !! result
1063 <p>This is a test template
1064 </p>
1065 !! end
1066
1067
1068 !! article
1069 Template:paramtest
1070 !! text
1071 This is a test template with parameter {{{param}}}
1072 !! endarticle
1073
1074 !! test
1075 Template parameter
1076 !! input
1077 {{paramtest|param=foo}}
1078 !! result
1079 <p>This is a test template with parameter foo
1080 </p>
1081 !! end
1082
1083 !! article
1084 Template:paramtestnum
1085 !! text
1086 [[{{{1}}}|{{{2}}}]]
1087 !! endarticle
1088
1089 !! test
1090 Template unnamed parameter
1091 !! input
1092 {{paramtestnum|Main Page|the main page}}
1093 !! result
1094 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1095 </p>
1096 !! end
1097
1098 !! test
1099 BUG 553: link with two variables in a piped link
1100 !! input
1101 {|
1102 |[[{{{1}}}|{{{2}}}]]
1103 |}
1104 !! result
1105 <table >
1106 <tr >
1107 <td>[[{{{1}}}|{{{2}}}]]
1108 </td></tr></table>
1109
1110 !! end
1111
1112 !! test
1113 Magic variable as template parameter
1114 !! input
1115 {{paramtest|param={{SITENAME}}}}
1116 !! result
1117 <p>This is a test template with parameter MediaWiki
1118 </p>
1119 !! end
1120
1121 !! article
1122 Template:linktest
1123 !! text
1124 [[{{{param}}}|link]]
1125 !! endarticle
1126
1127 !! test
1128 Template parameter as link source
1129 !! input
1130 {{linktest|param=Main Page}}
1131 !! result
1132 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
1133 </p>
1134 !! end
1135
1136
1137 !!article
1138 Template:paramtest2
1139 !! text
1140 including another template, {{paramtest|param={{{arg}}}}}
1141 !! endarticle
1142
1143 !! test
1144 Template passing argument to another template
1145 !! input
1146 {{paramtest2|arg='hmm'}}
1147 !! result
1148 <p>including another template, This is a test template with parameter 'hmm'
1149 </p>
1150 !! end
1151
1152 !! article
1153 Template:Linktest2
1154 !! text
1155 Main Page
1156 !! endarticle
1157
1158 !! test
1159 Template as link source
1160 !! input
1161 [[{{linktest2}}]]
1162 !! result
1163 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1164 </p>
1165 !! end
1166
1167
1168 !! article
1169 Template:loop1
1170 !! text
1171 {{loop2}}
1172 !! endarticle
1173
1174 !! article
1175 Template:loop2
1176 !! text
1177 {{loop1}}
1178 !! endarticle
1179
1180 !! test
1181 Template infinite loop
1182 !! input
1183 {{loop1}}
1184 !! result
1185 <p>{{loop2}}<!-- WARNING: template loop detected -->
1186 </p>
1187 !! end
1188
1189 !! test
1190 Template from main namespace
1191 !! input
1192 {{:Main Page}}
1193 !! result
1194 <p>blah blah
1195 </p>
1196 !! end
1197
1198 !! article
1199 Template:table
1200 !! text
1201 {|
1202 | 1 || 2
1203 |-
1204 | 3 || 4
1205 |}
1206 !! endarticle
1207
1208 !! test
1209 BUG 529: Template with table, not included at beginning of line
1210 !! input
1211 foo {{table}}
1212 !! result
1213 <p>foo
1214 </p>
1215 <table >
1216 <tr >
1217 <td> 1 </td><td> 2
1218 </td></tr>
1219 <tr >
1220 <td> 3 </td><td> 4
1221 </td></tr></table>
1222
1223 !! end
1224
1225 !! test
1226 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1227 !! input
1228 foo
1229 {{table}}
1230 !! result
1231 <p>foo
1232 </p>
1233 <table >
1234 <tr >
1235 <td> 1 </td><td> 2
1236 </td></tr>
1237 <tr >
1238 <td> 3 </td><td> 4
1239 </td></tr></table>
1240
1241 !! end
1242
1243 !! test
1244 BUG 41: Template parameters shown as broken links
1245 !! input
1246 {{{parameter}}}
1247 !! result
1248 <p>{{{parameter}}}
1249 </p>
1250 !! end
1251
1252
1253 !! article
1254 Template:MSGNW test
1255 !! text
1256 ''None'' of '''this''' should be
1257 * interepreted
1258 but rather passed unmodified
1259 {{test}}
1260 !! endarticle
1261
1262 # hmm, fix this or just deprecate msgnw and document its behavior?
1263 !! test
1264 msgnw keyword
1265 !! options
1266 disabled
1267 !! input
1268 {{msgnw:MSGNW test}}
1269 !! result
1270 <p>''None'' of '''this''' should be
1271 * interepreted
1272 but rather passed unmodified
1273 {{test}}
1274 </p>
1275 !! end
1276
1277 !! test
1278 int keyword
1279 !! input
1280 {{int:newmessages|lots of money}}
1281 !! result
1282 <p>You have lots of money.
1283 </p>
1284 !! end
1285
1286 ###
1287 ### Pre-save transform tests
1288 ###
1289 !! test
1290 pre-save transform: subst:
1291 !! options
1292 PST
1293 !! input
1294 {{subst:test}}
1295 !! result
1296 This is a test template
1297 !! end
1298
1299 !! test
1300 pre-save transform: normal template
1301 !! options
1302 PST
1303 !! input
1304 {{test}}
1305 !! result
1306 {{test}}
1307 !! end
1308
1309 !! test
1310 pre-save transform: nonexistant template
1311 !! options
1312 PST
1313 !! input
1314 {{thistemplatedoesnotexist}}
1315 !! result
1316 {{thistemplatedoesnotexist}}
1317 !! end
1318
1319
1320 !! test
1321 pre-save transform: subst magic variables
1322 !! options
1323 PST
1324 !! input
1325 {{subst:SITENAME}}
1326 !! result
1327 MediaWiki
1328 !! end
1329
1330 # This is bug 89, which I fixed. -- wtm
1331 !! test
1332 pre-save transform: subst: templates with parameters
1333 !! options
1334 pst
1335 !! input
1336 {{subst:paramtest|param="something else"}}
1337 !! result
1338 This is a test template with parameter "something else"
1339 !! end
1340
1341 ###
1342 ### Message transform tests
1343 ###
1344 !! test
1345 message transform: magic variables
1346 !! options
1347 msg
1348 !! input
1349 {{SITENAME}}
1350 !! result
1351 MediaWiki
1352 !! end
1353
1354 !! test
1355 message transform: should not transform wiki markup
1356 !! options
1357 msg
1358 !! input
1359 ''test''
1360 !! result
1361 ''test''
1362 !! end
1363
1364 ###
1365 ### Images
1366 ###
1367 !! test
1368 Simple image
1369 !! input
1370 [[Image: test]]
1371 !! result
1372 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/images/0/0c/Test" alt="Image: test" /></a>
1373 </p>
1374 !! end
1375
1376 !! test
1377 Right-aligned image
1378 !! input
1379 [[Image:test|right]]
1380 !! result
1381 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/images/0/0c/Test" alt="right" /></a></span></div>
1382
1383 !! end
1384
1385 !! test
1386 Image with caption
1387 !! input
1388 [[Image:test|right|Caption text]]
1389 !! result
1390 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="Caption text"><img src="/images/0/0c/Test" alt="Caption text" /></a></span></div>
1391
1392 !! end
1393
1394 !! test
1395 Image with frame and link
1396 !! input
1397 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1398 !! result
1399 <div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" /></a> <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
1400
1401 !! end
1402
1403 !! test
1404 Link to image page
1405 !! input
1406 [[:Image:test]]
1407 !! result
1408 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1409 </p>
1410 !! end
1411
1412 !! test
1413 Frameless image caption with a free URL
1414 !! input
1415 [[Image:foo|http://example.com]]
1416 !! result
1417 <p><a href="/wiki/Image:Foo" class="image" title="http://example.com"><img src="/images/1/13/Foo" alt="http://example.com" /></a>
1418 </p>
1419 !! end
1420
1421 !! test
1422 Thumbnail image caption with a free URL
1423 !! input
1424 [[Image:foo|thumb|http://example.com]]
1425 !! result
1426 <div class="thumb tright"><div style="width:182px;"><b>Missing image</b><br /><i>Foo</i> <div class="thumbcaption" ><a href="http://example.com" class='external'>http://example.com</a></div></div></div>
1427
1428 !! end
1429
1430 # Pending resolution to bug 368
1431 !! test
1432 BUG 648: Frameless image caption with a link
1433 !! input
1434 [[Image:foo|text with a [[link]] in it]]
1435 !! result
1436 <p><a href="/wiki/Image:Foo" class="image" title="text with a link in it"><img src="/images/1/13/Foo" alt="text with a link in it" /></a>
1437 </p>
1438 !! end
1439
1440 !! test
1441 Escape HTML special chars in image alt text
1442 !! input
1443 [[Image:example.jpg|& < > "]]
1444 !! result
1445 <p><a href="/wiki/Image:Example.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="/images/a/a9/Example.jpg" alt="&amp; &lt; &gt; &quot;" /></a>
1446 </p>
1447 !! end
1448
1449 !! test
1450 BUG 499: Alt text should have &#1234;, not &amp;1234;
1451 !! input
1452 [[Image:image.jpg|&#9792;]]
1453 !! result
1454 <p><a href="/wiki/Image:Image.jpg" class="image" title="&#9792;"><img src="/images/7/78/Image.jpg" alt="&#9792;" /></a>
1455 </p>
1456 !! end
1457
1458 !! test
1459 Broken image caption with link
1460 !! input
1461 [[Image:Rowan.jpeg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
1462 !! result
1463 <p>[[Image:Rowan.jpeg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
1464 </p>
1465 !! end
1466
1467 !! test
1468 Image caption containing another image
1469 !! input
1470 [[Image:Bar.jpeg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
1471 !! result
1472 <div class="thumb tright"><div style="width:182px;"><b>Missing image</b><br /><i>Bar.jpeg</i> <div class="thumbcaption" >This is a caption with another <a href="/wiki/Image:Icon.png" class="image" title="image"><img src="/images/9/96/Icon.png" alt="image" /></a> inside it!</div></div></div>
1473
1474 !! end
1475
1476 ###
1477 ### Subpages
1478 ###
1479 !! article
1480 Subpage test/subpage
1481 !! text
1482 foo
1483 !! endarticle
1484
1485 !! test
1486 Subpage link
1487 !! options
1488 subpage title=[[Subpage test]]
1489 !! input
1490 [[/subpage]]
1491 !! result
1492 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1493 </p>
1494 !! end
1495
1496 !! test
1497 Subpage noslash link
1498 !! options
1499 subpage title=[[Subpage test]]
1500 !!input
1501 [[/subpage/]]
1502 !! result
1503 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1504 </p>
1505 !! end
1506
1507 !! test
1508 Disabled subpages
1509 !! input
1510 [[/subpage]]
1511 !! result
1512 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
1513 </p>
1514 !! end
1515
1516 !! test
1517 BUG 561: {{/Subpage}}
1518 !! options
1519 subpage title=[[Page]]
1520 !! input
1521 {{/Subpage}}
1522 !! result
1523 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1524 </p>
1525 !! end
1526
1527 ###
1528 ### Categories
1529 ###
1530 !! article
1531 Category:MediaWiki User's Guide
1532 !! text
1533 blah
1534 !! endarticle
1535
1536 !! test
1537 Link to category
1538 !! input
1539 [[:Category:MediaWiki User's Guide]]
1540 !! result
1541 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1542 </p>
1543 !! end
1544
1545 !! test
1546 Simple category
1547 !! options
1548 cat
1549 !! input
1550 [[Category: MediaWiki User's Guide]]
1551 !! result
1552 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1553 !! end
1554
1555 ###
1556 ### Inter-language links
1557 ###
1558 !! test
1559 Inter-language links
1560 !! options
1561 ill
1562 !! input
1563 [[es:Alimento]]
1564 [[fr:Nourriture]]
1565 [[zh:&#39135;&#21697;]]
1566 !! result
1567 es:Alimento fr:Nourriture zh:食品
1568 !! end
1569
1570 ###
1571 ### Sections
1572 ###
1573 !! test
1574 Basic section headings
1575 !! input
1576 == Headline 1 ==
1577 Some text
1578
1579 ==Headline 2==
1580 More
1581 ===Smaller headline===
1582 Blah blah
1583 !! result
1584 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1585 <p>Some text
1586 </p>
1587 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
1588 <p>More
1589 </p>
1590 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
1591 <p>Blah blah
1592 </p>
1593 !! end
1594
1595 !! test
1596 Section headings with TOC
1597 !! input
1598 == Headline 1 ==
1599 === Subheadline 1 ===
1600 ===== Skipping a level =====
1601 ====== Skipping a level ======
1602
1603 == Headline 2 ==
1604 Some text
1605 ===Another headline===
1606 !! result
1607 <table border="0" id="toc"><tr id="toctitle"><td align="center">
1608 <b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td>
1609 <div class="tocline"><a href="#Headline_1">1 Headline 1</a><br /></div>
1610 <div class="tocindent">
1611 <p><a href="#Subheadline_1">1.1 Subheadline 1</a><br />
1612 </p>
1613 <div class="tocindent">
1614 <div class="tocindent">
1615 <p><a href="#Skipping_a_level">1.1.1 Skipping a level</a><br />
1616 </p>
1617 <div class="tocindent">
1618 <p><a href="#Skipping_a_level_2">1.1.1.1 Skipping a level</a><br />
1619 </p>
1620 </div>
1621 </div>
1622 </div>
1623 </div>
1624 <div class="tocline"><a href="#Headline_2">2 Headline 2</a><br /></div>
1625 <div class="tocindent">
1626 <p><a href="#Another_headline">2.1 Another headline</a><br />
1627 </p>
1628 </div>
1629 </td></tr></table>
1630 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1631 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
1632 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
1633 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Parser test script">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
1634 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
1635 <p>Some text
1636 </p>
1637 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Parser test script">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
1638
1639 !! end
1640
1641 !! test
1642 Resolving duplicate section names
1643 !! input
1644 == Foo bar ==
1645 ==Foo bar==
1646 !! result
1647 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
1648 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Foo_bar_2"></a><h2>Foo bar</h2>
1649
1650 !! end
1651
1652 !! article
1653 Template:sections
1654 !! text
1655 ===Section 1===
1656 ==Section 2==
1657 !! endarticle
1658
1659 !! test
1660 Template with sections, __NOTOC__
1661 !! options title=[[Parser test script]]
1662 !! input
1663 __NOTOC__
1664 ==Section 0==
1665 {{sections}}
1666 ==Section 4==
1667 !! result
1668 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
1669 <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>
1670 <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>
1671 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
1672
1673 !! end
1674
1675 !! test
1676 __NOEDITSECTION__ keyword
1677 !! input
1678 __NOEDITSECTION__
1679 ==Section 1==
1680 ==Section 2==
1681 !! result
1682 <a name="Section_1"></a><h2>Section 1</h2>
1683 <a name="Section_2"></a><h2>Section 2</h2>
1684
1685 !! end
1686
1687 TODO:
1688 more images
1689 more tables
1690 math
1691 character entities
1692 and much more
1693