Add blurb at top; enable template as link source test now that it
[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 # (default) generate HTML output
9 # pst apply pre-save transform
10 # msg apply message transform
11 #
12 # Tests can be disabled with the '!!disabled' flag.
13 #
14 # For testing purposes, temporary articles can created:
15 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
16 # where '/' denotes a newline.
17
18 ###
19 ### Basic tests
20 ###
21 !! test
22 Blank input
23 !! input
24 !! result
25 !! end
26
27 !! test
28 Simple paragraph
29 !! input
30 This is a simple paragraph.
31 !! result
32 <p>This is a simple paragraph.
33 </p>
34 !! end
35
36 !! test
37 Simple list
38 !! input
39 * Item 1
40 * Item 2
41 !! result
42 <ul><li> Item 1
43 </li><li> Item 2
44 </li></ul>
45
46 !! end
47
48 !! test
49 Italics and bold
50 !! input
51 * plain
52 * plain''italic''plain
53 * plain''italic''plain''italic''plain
54 * plain'''bold'''plain
55 * plain'''bold'''plain'''bold'''plain
56 * plain''italic''plain'''bold'''plain
57 * plain'''bold'''plain''italic''plain
58 * plain''italic'''bold-italic'''italic''plain
59 * plain'''bold''bold-italic''bold'''plain
60 * plain'''''bold-italic'''italic''plain
61 * plain'''''bold-italic''bold'''plain
62 * plain''italic'''bold-italic'''''plain
63 * plain'''bold''bold-italic'''''plain
64 * plain l'''italic''plain
65 !! result
66 <ul><li> plain
67 </li><li> plain<i>italic</i>plain
68 </li><li> plain<i>italic</i>plain<i>italic</i>plain
69 </li><li> plain<b>bold</b>plain
70 </li><li> plain<b>bold</b>plain<b>bold</b>plain
71 </li><li> plain<i>italic</i>plain<b>bold</b>plain
72 </li><li> plain<b>bold</b>plain<i>italic</i>plain
73 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
74 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
75 </li><li> plain<i><b>bold-italic</b>italic</i>plain
76 </li><li> plain<b><i>bold-italic</i>bold</b>plain
77 </li><li> plain<i>italic<b>bold-italic</b></i>plain
78 </li><li> plain<b>bold<i>bold-italic</i></b>plain
79 </li><li> plain l'<i>italic</i>plain
80 </li></ul>
81
82 !! end
83
84 ###
85 ### <nowiki> test cases
86 ###
87
88 !! test
89 <nowiki> unordered list
90 !! input
91 <nowiki>* This is not an unordered list item.</nowiki>
92 !! result
93 <p>* This is not an unordered list item.
94 </p>
95 !! end
96
97 !! test
98 <nowiki> spacing
99 !! input
100 <nowiki>Lorem ipsum dolor
101
102 sed abit.
103 sed nullum.
104
105 :and a colon
106 </nowiki>
107 !! result
108 <p>Lorem ipsum dolor
109
110 sed abit.
111 sed nullum.
112
113 :and a colon
114
115 </p>
116 !! end
117
118 !! test
119 nowiki 3
120 !! input
121 :There is not nowiki.
122 :There is <nowiki>nowiki</nowiki>.
123
124 #There is not nowiki.
125 #There is <nowiki>nowiki</nowiki>.
126
127 *There is not nowiki.
128 *There is <nowiki>nowiki</nowiki>.
129 !! result
130 <dl><dd>There is not nowiki.
131 </dd><dd>There is nowiki.
132 </dd></dl>
133 <ol><li>There is not nowiki.
134 </li><li>There is nowiki.
135 </li></ol>
136 <ul><li>There is not nowiki.
137 </li><li>There is nowiki.
138 </li></ul>
139
140 !! end
141
142 ###
143 ### comment test cases
144 ###
145 !! test
146 comment test 1
147 !! input
148 <!-- comment 1 --> asdf
149 <!-- comment 2 -->
150 !! result
151 <pre>asdf
152 </pre>
153
154 !! end
155
156 !! test
157 comment test 2
158 !! input
159 asdf
160 <!-- comment 1 -->
161 jkl
162 !! result
163 <p>asdf
164 jkl
165 </p>
166 !! end
167
168 !! test
169 comment test 3
170 !! input
171 asdf
172 <!-- comment 1 -->
173 <!-- comment 2 -->
174 jkl
175 !! result
176 <p>asdf
177 jkl
178 </p>
179 !! end
180
181 !! test
182 comment test 4
183 !! input
184 asdf<!-- comment 1 -->jkl
185 !! result
186 <p>asdfjkl
187 </p>
188 !! end
189
190 ###
191 ### External links
192 ###
193 !! test
194 External links: non-bracketed
195 !! input
196 Non-bracketed: http://example.com
197 !! result
198 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
199 </p>
200 !! end
201
202 !! test
203 External links: numbered
204 !! input
205 Numbered: [http://example.com]
206 !! result
207 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
208 </p>
209 !!end
210
211 !! test
212 External links: specified text
213 !! input
214 Specified text: [http://example.com link]
215 !! result
216 <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>
217 </p>
218 !!end
219
220 !! test
221 External links: trail
222 !! input
223 Trail (not sure if this is meant to work): [http://example.com link]s
224 !! result
225 <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>
226 </p>
227 !! end
228
229 !! test
230 External links: dollar sign in URL
231 !! input
232 http://example.com/1$2345
233 !! result
234 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
235 </p>
236 !! end
237
238 !! test
239 External links: dollar sign in URL (named)
240 !! input
241 [http://example.com/1$2345]
242 !! result
243 <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>
244 </p>
245 !!end
246
247 !! test
248 External image
249 !! input
250 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
251 !! result
252 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
253 </p>
254 !! end
255
256 !! test
257 External image from https
258 !! input
259 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
260 !! result
261 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
262 </p>
263 !! end
264
265 !! test
266 Link to non-http image, no img tag
267 !! input
268 Link to non-http image, no img tag: ftp://example.com/test.jpg
269 !! result
270 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
271 </p>
272 !! end
273
274 !! test
275 External links: terminating separator
276 !! input
277 Terminating separator: http://example.com/thing,
278 !! result
279 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
280 </p>
281 !! end
282
283 !! test
284 External links: intervening separator
285 !! input
286 Intervening separator: http://example.com/1,2,3
287 !! result
288 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
289 </p>
290 !! end
291
292 !! test
293 External links: old bug with URL in query
294 !! input
295 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
296 !! result
297 <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>
298 </p>
299 !! end
300
301 !! test
302 External links: old URL-in-URL bug, mixed protocols
303 !! input
304 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
305 !! result
306 <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>
307 </p>
308 !!end
309
310 !! test
311 External links: URL in text
312 !! input
313 URL in text: [http://example.com http://example.com]
314 !! result
315 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
316 </p>
317 !! end
318
319 !! test
320 External links: Clickable images
321 !! input
322 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
323 !! result
324 <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>
325 </p>
326 !!end
327
328 !! test
329 External links: raw ampersand
330 !! input
331 Old &amp; use: http://x&y
332 !! result
333 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
334 </p>
335 !! end
336
337 !! test
338 External links: www.jpeg.org (bug 554)
339 !! input
340 http://www.jpeg.org
341 !!result
342 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
343 </p>
344 !! end
345
346 ###
347 ### Quotes
348 ###
349
350 !! test
351 Quotes
352 !! input
353 Normal text. '''Bold text.''' Normal text. ''Italic text.''
354
355 Normal text. '''''Bold italic text.''''' Normal text.
356 !!result
357 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
358 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
359 </p>
360 !! end
361
362
363 !! test
364 Unclosed and unmatched quotes
365 !! input
366 '''''Bold italic text '''with bold deactivated''' in between.'''''
367
368 '''''Bold italic text ''with italic deactivated'' in between.'''''
369
370 '''Bold text..
371
372 ..spanning two paragraphs (should not work).'''
373
374 '''Bold tag left open
375
376 ''Italic tag left open
377
378 Normal text.
379
380 <!-- Unmatching number of opening, closing tags: -->
381 '''This year''''s election ''should'' beat '''last year''''s.
382
383 ''Tom'''s car is bigger than ''Susan'''s.
384 !! result
385 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
386 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
387 </p><p><b>Bold text..</b>
388 </p><p>..spanning two paragraphs (should not work).<b></b>
389 </p><p><b>Bold tag left open</b>
390 </p><p><i>Italic tag left open</i>
391 </p><p>Normal text.
392 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
393 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
394 </p>
395 !! end
396
397 ###
398 ### Tables
399 ###
400 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
401 ###
402 !! test
403 Simple table
404 !! input
405 {|
406 | 1 || 2
407 |-
408 | 3 || 4
409 |}
410 !! result
411 <table >
412 <tr >
413 <td> 1 </td><td> 2
414 </td></tr>
415 <tr >
416 <td> 3 </td><td> 4
417 </td></tr></table>
418
419 !! end
420
421 !! test
422 Multiplication table
423 !! input
424 {| border="1" cellpadding="2"
425 |+Multiplication table
426 |-
427 ! &times; !! 1 !! 2 !! 3
428 |-
429 ! 1
430 | 1 || 2 || 3
431 |-
432 ! 2
433 | 2 || 4 || 6
434 |-
435 ! 3
436 | 3 || 6 || 9
437 |-
438 ! 4
439 | 4 || 8 || 12
440 |-
441 ! 5
442 | 5 || 10 || 15
443 |}
444 !! result
445 <table border="1" cellpadding="2">
446 <caption>Multiplication table
447 </caption>
448 <tr >
449 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
450 </th></tr>
451 <tr >
452 <th> 1
453 </th><td> 1 </td><td> 2 </td><td> 3
454 </td></tr>
455 <tr >
456 <th> 2
457 </th><td> 2 </td><td> 4 </td><td> 6
458 </td></tr>
459 <tr >
460 <th> 3
461 </th><td> 3 </td><td> 6 </td><td> 9
462 </td></tr>
463 <tr >
464 <th> 4
465 </th><td> 4 </td><td> 8 </td><td> 12
466 </td></tr>
467 <tr >
468 <th> 5
469 </th><td> 5 </td><td> 10 </td><td> 15
470 </td></tr></table>
471
472 !! end
473
474 !! test
475 Table rowspan
476 !! input
477 {| align=right border=1
478 | Cell 1, row 1
479 |rowspan=2| Cell 2, row 1 (and 2)
480 | Cell 3, row 1
481 |-
482 | Cell 1, row 2
483 | Cell 3, row 2
484 |}
485 !! result
486 <table align=right border=1>
487 <tr >
488 <td> Cell 1, row 1
489 </td><td rowspan=2> Cell 2, row 1 (and 2)
490 </td><td> Cell 3, row 1
491 </td></tr>
492 <tr >
493 <td> Cell 1, row 2
494 </td><td> Cell 3, row 2
495 </td></tr></table>
496
497 !! end
498
499 !! test
500 Nested table
501 !! input
502 {| border=1
503 | &alpha;
504 |
505 {| bgcolor=#ABCDEF border=2
506 |nested
507 |-
508 |table
509 |}
510 |the original table again
511 |}
512 !! result
513 <table border=1>
514 <tr >
515 <td> &alpha;
516 </td><td>
517 <table bgcolor=#ABCDEF border=2>
518 <tr >
519 <td>nested
520 </td></tr>
521 <tr >
522 <td>table
523 </td></tr></table>
524 </td><td>the original table again
525 </td></tr></table>
526
527 !! end
528
529 ###
530 ### Internal links
531 ###
532 !! article
533 Main Page
534 !! text
535 blah blah
536 !! endarticle
537
538 !! test
539 Plain link, capitalized
540 !! input
541 [[Main Page]]
542 !! result
543 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
544 </p>
545 !! end
546
547 !! test
548 Plain link, uncapitalized
549 !! input
550 [[main Page]]
551 !! result
552 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
553 </p>
554 !! end
555
556 !! test
557 Piped link
558 !! input
559 [[Main Page|The Main Page]]
560 !! result
561 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
562 </p>
563 !! end
564
565 !! test
566 Broken link
567 !! input
568 [[Zigzagzogzagzig]]
569 !! result
570 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
571 </p>
572 !! end
573
574 !! test
575 Link with prefix
576 !! input
577 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
578 !! result
579 <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>
580 </p>
581 !! end
582
583 !! test
584 Link with suffix
585 !! input
586 [[Main Page]]xxx, [[Main Page]]XXX
587 !! result
588 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
589 </p>
590 !! end
591
592 !! test
593 Link with 3 brackets
594 !! input
595 [[[main page]]]
596 !! result
597 <p>[[[main page]]]
598 </p>
599 !! end
600
601 !! test
602 Piped link with 3 brackets
603 !! input
604 [[[main page|the main page]]]
605 !! result
606 <p>[[[main page|the main page]]]
607 </p>
608 !! end
609
610 !! test
611 Link to namespaces
612 !! input
613 [[Talk:Parser testing]], [[Meta:Disclaimers]]
614 !! result
615 <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>
616 </p>
617 !! end
618
619 !! test
620 Piped link to namespace
621 !! input
622 [[Meta:Disclaimers|The disclaimers]]
623 !! result
624 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
625 </p>
626 !! end
627
628 !! article
629 Category:MediaWiki User's Guide
630 !! text
631 blah
632 !! endarticle
633
634 !! test
635 Link to category
636 !! input
637 [[:Category:MediaWiki User's Guide]]
638 !! result
639 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
640 </p>
641 !! end
642
643 !! test
644 Link to image page
645 !! input
646 [[:Image:Ncwikicol.png]]
647 !! result
648 <p><a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
649 </p>
650 !! end
651
652 !! test
653 Plain link to URL
654 !! input
655 [[http://www.example.org]]
656 !! result
657 <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>]
658 </p>
659 !! end
660
661 !! test
662 Piped link to URL
663 !! input
664 Piped link to URL: [[http://www.example.org|an example URL]]
665 !! result
666 <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>
667 </p>
668 !! end
669
670 !! test
671 BUG 2: [[page|http://url/]] should link to page, not http://url/
672 !! input
673 [[Main Page|http://url/]]
674 !! result
675 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
676 </p>
677 !! end
678
679
680 ###
681 ### Interwiki links
682 ###
683
684 !! test
685 Inline interwiki link
686 !! input
687 [[MeatBall:SoftSecurity]]
688 !! result
689 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
690 </p>
691 !! end
692
693 ###
694 ### Images
695 ###
696
697 !! test
698 [[
699
700
701 ##
702 ## XHTML tidiness
703 ###
704
705 !! test
706 <br> to <br />
707 !! input
708 1<br>2<br />3
709 !! result
710 <p>1<br />2<br />3
711 </p>
712 !! end
713
714 ###
715 ### Block-level elements
716 ###
717 !! test
718 Common list
719 !! input
720 *Common list
721 * item 2
722 *item 3
723 !! result
724 <ul><li>Common list
725 </li><li> item 2
726 </li><li>item 3
727 </li></ul>
728
729 !! end
730
731 !! test
732 Numbered list
733 !! input
734 #Numbered list
735 #item 2
736 # item 3
737 !! result
738 <ol><li>Numbered list
739 </li><li>item 2
740 </li><li> item 3
741 </li></ol>
742
743 !! end
744
745 !! test
746 Mixed list
747 !! input
748 *Mixed list
749 *# with numbers
750 ** and bullets
751 *# and numbers
752 *bullets again
753 **bullet level 2
754 ***bullet level 3
755 ***#Number on level 4
756 **bullet level 2
757 **#Number on level 3
758 **#Number on level 3
759 *#number level 2
760 *Level 1
761 !! result
762 <ul><li>Mixed list
763 <ol><li> with numbers
764 </li></ol>
765 <ul><li> and bullets
766 </li></ul>
767 <ol><li> and numbers
768 </li></ol>
769 </li><li>bullets again
770 <ul><li>bullet level 2
771 <ul><li>bullet level 3
772 <ol><li>Number on level 4
773 </li></ol>
774 </li></ul>
775 </li><li>bullet level 2
776 <ol><li>Number on level 3
777 </li><li>Number on level 3
778 </li></ol>
779 </li></ul>
780 <ol><li>number level 2
781 </li></ol>
782 </li><li>Level 1
783 </li></ul>
784
785 !! end
786
787 ###
788 ### Magic variables
789 ###
790 !! test
791 Magic variables
792 !! input
793 {{SITENAME}}
794 !! result
795 <p>MediaWiki
796 </p>
797 !! end
798
799 ###
800 ### Magic links
801 ###
802 !! test
803 Magic links: internal link to RFC
804 !! input
805 [[RFC 123]]
806 !! result
807 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
808 </p>
809 !! end
810
811 !! test
812 Magic links: ISBN
813 !! input
814 ISBN 0-306-40615-2
815 !! result
816 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
817 </p>
818 !! end
819
820 ###
821 ### Nonexistant template
822 ###
823 !! test
824 Nonexistant template
825 !! input
826 {{thistemplatedoesnotexist}}
827 !! result
828 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
829 </p>
830 !! end
831
832 ###
833 ### Templates
834 ####
835 !! article
836 Template:test
837 !! text
838 This is a test template
839 !! endarticle
840
841 !! test
842 Simple template
843 !! input
844 {{test}}
845 !! result
846 <p>This is a test template
847 </p>
848 !! end
849
850 !! test
851 Template with explicit namespace
852 !! input
853 {{Template:test}}
854 !! result
855 <p>This is a test template
856 </p>
857 !! end
858
859
860 !! article
861 Template:paramtest
862 !! text
863 This is a test template with parameter {{{param}}}
864 !! endarticle
865
866 !! test
867 Template parameter
868 !! input
869 {{paramtest|param=foo}}
870 !! result
871 <p>This is a test template with parameter foo
872 </p>
873 !! end
874
875 !! test
876 Magic variable as template parameter
877 !! input
878 {{paramtest|param={{SITENAME}}}}
879 !! result
880 <p>This is a test template with parameter MediaWiki
881 </p>
882 !! end
883
884 !! article
885 Template:linktest
886 !! text
887 [[{{{param}}}|link]]
888 !! endarticle
889
890 !! test
891 Template parameter as link source
892 !! input
893 {{linktest|param=Main Page}}
894 !! result
895 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
896 </p>
897 !! end
898
899
900 !! article
901 Template:Linktest2
902 !! text
903 Main Page
904 !! endarticle
905
906 !! test
907 Template as link source
908 !! input
909 [[{{linktest2}}]]
910 !! result
911 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
912 </p>
913 !! end
914
915 !! article
916 Template:loop1
917 !! text
918 {{loop2}}
919 !! endarticle
920
921 !! article
922 Template:loop2
923 !! text
924 {{loop1}}
925 !! endarticle
926
927 !! test
928 Template infinite loop
929 !! input
930 {{loop1}}
931 !! result
932 <p>{{loop2}}<!-- WARNING: template loop detected -->
933 </p>
934 !! end
935
936
937 ###
938 ### Pre-save transform tests
939 ###
940 !! test
941 pre-save transform: subst:
942 !! options
943 PST
944 !! input
945 {{subst:test}}
946 !! result
947 This is a test template
948 !! end
949
950 !! test
951 pre-save transform: normal template
952 !! options
953 PST
954 !! input
955 {{test}}
956 !! result
957 {{test}}
958 !! end
959
960 !! test
961 pre-save transform: nonexistant template
962 !! options
963 PST
964 !! input
965 {{thistemplatedoesnotexist}}
966 !! result
967 {{thistemplatedoesnotexist}}
968 !! end
969
970 !! test
971 pre-save transform: subst magic variables
972 !! options
973 PST
974 !! input
975 {{subst:SITENAME}}
976 !! result
977 MediaWiki
978 !! end
979
980 ###
981 ### Message transform tests
982 ###
983 !! test
984 message transform: magic variables
985 !! options
986 msg
987 !! input
988 {{SITENAME}}
989 !! result
990 MediaWiki
991 !! end
992
993 !! test
994 message transform: should not transform wiki markup
995 !! options
996 msg
997 !! input
998 ''test''
999 !! result
1000 ''test''
1001 !! end
1002
1003 TODO:
1004 more templates
1005 tables
1006 images
1007 subpages
1008 character entities
1009 and much more
1010