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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
14 # Plus any combination of these:
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 # disabled do not run test
23 # For testing purposes, temporary articles can created:
24 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
25 # where '/' denotes a newline.
27 # This is the standard article assumed to exist.
47 This is a simple paragraph.
49 <p>This is a simple paragraph.
69 * plain''italic''plain
70 * plain''italic''plain''italic''plain
71 * plain'''bold'''plain
72 * plain'''bold'''plain'''bold'''plain
73 * plain''italic''plain'''bold'''plain
74 * plain'''bold'''plain''italic''plain
75 * plain''italic'''bold-italic'''italic''plain
76 * plain'''bold''bold-italic''bold'''plain
77 * plain'''''bold-italic'''italic''plain
78 * plain'''''bold-italic''bold'''plain
79 * plain''italic'''bold-italic'''''plain
80 * plain'''bold''bold-italic'''''plain
81 * plain l'''italic''plain
84 </li><li> plain<i>italic</i>plain
85 </li><li> plain<i>italic</i>plain<i>italic</i>plain
86 </li><li> plain<b>bold</b>plain
87 </li><li> plain<b>bold</b>plain<b>bold</b>plain
88 </li><li> plain<i>italic</i>plain<b>bold</b>plain
89 </li><li> plain<b>bold</b>plain<i>italic</i>plain
90 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
91 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
92 </li><li> plain<i><b>bold-italic</b>italic</i>plain
93 </li><li> plain<b><i>bold-italic</i>bold</b>plain
94 </li><li> plain<i>italic<b>bold-italic</b></i>plain
95 </li><li> plain<b>bold<i>bold-italic</i></b>plain
96 </li><li> plain l'<i>italic</i>plain
102 ### <nowiki> test cases
106 <nowiki> unordered list
108 <nowiki>* This is not an unordered list item.</nowiki>
110 <p>* This is not an unordered list item.
117 <nowiki>Lorem ipsum dolor
138 :There is not nowiki.
139 :There is <nowiki>nowiki</nowiki>.
141 #There is not nowiki.
142 #There is <nowiki>nowiki</nowiki>.
144 *There is not nowiki.
145 *There is <nowiki>nowiki</nowiki>.
147 <dl><dd>There is not nowiki.
148 </dd><dd>There is nowiki.
150 <ol><li>There is not nowiki.
151 </li><li>There is nowiki.
153 <ul><li>There is not nowiki.
154 </li><li>There is nowiki.
165 <!-- comment 1 --> asdf
201 asdf<!-- comment 1 -->jkl
211 <!-- foo --> b <!-- bar -->
225 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
231 Comment semantics and delimiters
233 <!-- --><!----><!-----><!------>
239 Comment semantics and delimiters, redux
241 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
242 -- foo -- funky huh? ... -->
248 Comment semantics and delimiters: directors cut
250 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
251 everything starting with < followed by !-- until the first -- and > we see,
252 that wouldn't be valid XML however, since in XML -- has to terminate a comment
260 Comment semantics: nesting
262 <!--<!-- no, we're not going to do anything fancy here -->-->
270 ### Preformatted text
279 And a [[Main Page|link]]
285 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
297 <dl><dt> name </dt><dd> Definition
307 <dl><dd> Indented text
313 Definition list with no space
317 <dl><dt>name</dt><dd>Definition
323 Definition list with URL link
325 ; http://example.com/ : definition
327 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a> </dt><dd> definition
333 Definition list with bracketed URL link
335 ;[http://www.google.com/ Google]:Number one search engine
337 <dl><dt><a href="http://www.google.com/" class='external text' title="http://www.google.com/" rel="nofollow">Google</a></dt><dd>Number one search engine
343 Definition list with wikilink containing colon
345 ; [[Help:FAQ]]: The least-read page on Wikipedia
347 <dl><dt> <a href="/index.php?title=Help:FAQ&action=edit" class="new" title="Help:FAQ">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
352 # At Brion's and JeLuF's insistence... :)
354 Definition list with wikilink containing colon
356 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
358 <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!
364 Malformed definition list with colon
366 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
368 <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
374 Definition lists: colon in external link text
376 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
378 <dl><dt> <a href="http://www.wikipedia2.org/" class='external text' title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia : The Next Generation</a></dt><dd> OK, I made that up
388 External links: non-bracketed
390 Non-bracketed: http://example.com
392 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
397 External links: numbered
399 Numbered: [http://example.com]
400 Numbered: [http://example.net]
401 Numbered: [http://example.org]
403 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
404 Numbered: <a href="http://example.net" class='external autonumber' title="http://example.net" rel="nofollow">[2]</a>
405 Numbered: <a href="http://example.org" class='external autonumber' title="http://example.org" rel="nofollow">[3]</a>
410 External links: specified text
412 Specified text: [http://example.com link]
414 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
419 External links: trail
421 Linktrails should not work for external links: [http://example.com link]s
423 <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
428 External links: dollar sign in URL
430 http://example.com/1$2345
432 <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>
437 External links: dollar sign in URL (named)
439 [http://example.com/1$2345]
441 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
446 External links: open square bracket forbidden in URL (bug 4377)
448 http://example.com/1[2345
450 <p><a href="http://example.com/1" class='external free' title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
455 External links: open square bracket forbidden in URL (named) (bug 4377)
457 [http://example.com/1[2345]
459 <p><a href="http://example.com/1" class='external text' title="http://example.com/1" rel="nofollow">[2345</a>
466 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
468 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
473 External image from https
475 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
477 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
482 Link to non-http image, no img tag
484 Link to non-http image, no img tag: ftp://example.com/test.jpg
486 <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>
491 External links: terminating separator
493 Terminating separator: http://example.com/thing,
495 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
500 External links: intervening separator
502 Intervening separator: http://example.com/1,2,3
504 <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>
509 External links: old bug with URL in query
511 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
513 <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>
518 External links: old URL-in-URL bug, mixed protocols
520 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
522 <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>
527 External links: URL in text
529 URL in text: [http://example.com http://example.com]
531 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
536 External links: Clickable images
538 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
540 <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>
545 External links: raw ampersand
547 Old & use: http://x&y
549 <p>Old & use: <a href="http://x&y" class='external free' title="http://x&y" rel="nofollow">http://x&y</a>
554 External links: encoded ampersand
556 Old & use: http://x&y
558 <p>Old & use: <a href="http://x&y" class='external free' title="http://x&y" rel="nofollow">http://x&y</a>
563 External links: [raw ampersand]
565 Old & use: [http://x&y]
567 <p>Old & use: <a href="http://x&y" class='external autonumber' title="http://x&y" rel="nofollow">[1]</a>
572 External links: [encoded ampersand]
574 Old & use: [http://x&y]
576 <p>Old & use: <a href="http://x&y" class='external autonumber' title="http://x&y" rel="nofollow">[1]</a>
581 External links: www.jpeg.org (bug 554)
585 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
590 External links: URL within URL (original bug 2)
592 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
594 <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>
599 BUG 361: URL inside bracketed URL
601 [http://www.example.com/foo http://www.example.com/bar]
603 <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>
608 BUG 361: URL within URL, not bracketed
610 http://www.example.com/foo?=http://www.example.com/bar
612 <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>
617 BUG 289: ">"-token in URL-tail
619 http://www.example.com/<hello>
621 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a><hello>
626 BUG 289: literal ">"-token in URL-tail
628 http://www.example.com/<b>html</b>
630 <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>
635 BUG 289: ">"-token in bracketed URL
637 [http://www.example.com/<hello> stuff]
639 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><hello> stuff</a>
644 BUG 289: literal ">"-token in bracketed URL
646 [http://www.example.com/<b>html</b> stuff]
648 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
653 BUG 289: literal double quote at end of URL
655 http://www.example.com/"hello"
657 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
662 BUG 289: literal double quote in bracketed URL
664 [http://www.example.com/"hello" stuff]
666 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
671 External links: invalid character
673 [http://www.example.com