make some more tests work
[lhc/web/wiklou.git] / maintenance / parserTests.txt
1 # MediaWiki Parser test cases
2 # see also http://meta.wikimedia.org/wiki/Parser_testing
3
4 !! test
5 Blank input
6 !! input
7 !! result
8 !! end
9
10 !! test
11 Simple paragraph
12 !! input
13 This is a simple paragraph.
14 !! result
15 <p>This is a simple paragraph.
16 </p>
17 !! end
18
19 !! test
20 Simple list
21 !! input
22 * Item 1
23 * Item 2
24 !! result
25 <ul><li> Item 1
26 </li><li> Item 2
27 </li></ul>
28 !! end
29
30 !! test
31 Italics and bold
32 !! input
33 * plain
34 * plain''italic''plain
35 * plain''italic''plain''italic''plain
36 * plain'''bold'''plain
37 * plain'''bold'''plain'''bold'''plain
38 * plain''italic''plain'''bold'''plain
39 * plain'''bold'''plain''italic''plain
40 * plain''italic'''bold-italic'''italic''plain
41 * plain'''bold''bold-italic''bold'''plain
42 * plain'''''bold-italic'''italic''plain
43 * plain'''''bold-italic''bold'''plain
44 * plain''italic'''bold-italic'''''plain
45 * plain'''bold''bold-italic'''''plain
46 * plain l'''italic''plain
47 !! result
48 <ul><li> plain
49 </li><li> plain<i>italic</i>plain
50 </li><li> plain<i>italic</i>plain<i>italic</i>plain
51 </li><li> plain<b>bold</b>plain
52 </li><li> plain<b>bold</b>plain<b>bold</b>plain
53 </li><li> plain<i>italic</i>plain<b>bold</b>plain
54 </li><li> plain<b>bold</b>plain<i>italic</i>plain
55 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
56 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
57 </li><li> plain<i><b>bold-italic</b>italic</i>plain
58 </li><li> plain<b><i>bold-italic</i>bold</b>plain
59 </li><li> plain<i>italic<b>bold-italic</b></i>plain
60 </li><li> plain<b>bold<i>bold-italic</i></b>plain
61 </li><li> plain l'<i>italic</i>plain
62 </li></ul>
63 !! end
64
65 ###
66 ### <nowiki> test cases
67 ###
68
69 !! test
70 <nowiki> unordered list
71 !! input
72 <nowiki>* This is not an unordered list item.</nowiki>
73 !! result
74 <p>* This is not an unordered list item.
75 </p>
76 !! end
77
78 !! test
79 <nowiki> spacing
80 !! input
81 <nowiki>Lorem ipsum dolor
82
83 sed abit.
84 sed nullum.
85
86 :and a colon
87 </nowiki>
88 !! result
89 <p>Lorem ipsum dolor
90
91 sed abit.
92 sed nullum.
93
94 :and a colon
95
96 </p>
97 !! end
98
99 !! test
100 nowiki 3
101 !! input
102 :There is not nowiki.
103 :There is <nowiki>nowiki</nowiki>.
104
105 #There is not nowiki.
106 #There is <nowiki>nowiki</nowiki>.
107
108 *There is not nowiki.
109 *There is <nowiki>nowiki</nowiki>.
110 !! result
111 <dl><dd>There is not nowiki.
112 </dd><dd>There is nowiki.
113 </dd></dl>
114 <ol><li>There is not nowiki.
115 </li><li>There is nowiki.
116 </li></ol>
117 <ul><li>There is not nowiki.
118 </li><li>There is nowiki.
119 </li></ul>
120 !! end
121
122 ###
123 ### comment test cases
124 ###
125 !! test
126 comment test 1
127 !! input
128 <!-- comment 1 --> asdf
129 <!-- comment 2 -->
130 !! result
131 <pre>asdf
132 </pre>
133 !! end
134
135 !! test
136 comment test 2
137 !! input
138 asdf
139 <!-- comment 1 -->
140 jkl
141 !! result
142 <p>asdf
143 jkl
144 </p>
145 !! end
146
147 !! test
148 comment test 3
149 !! input
150 asdf
151 <!-- comment 1 -->
152 <!-- comment 2 -->
153 jkl
154 !! result
155 <p>asdf
156 jkl
157 </p>
158 !! end
159
160 !! test
161 comment test 4
162 !! input
163 asdf<!-- comment 1 -->jkl
164 !! result
165 <p>asdfjkl
166 </p>
167 !! end
168
169 ###
170 ### External links
171 ###
172 !! test
173 External links 1-4
174 !! input
175 Non-bracketed: http://example.com
176
177 Numbered: [http://example.com]
178
179 Specified text: [http://example.com link]
180
181 Trail (not sure if this is meant to work): [http://example.com link]s
182 !! result
183 <p>Non-bracketed: <a href="http://example.com" class='external' title="http://example.com">http://example.com</a>
184 </p><p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
185 </p><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>
186 </p><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>
187 </p>
188 !! end
189
190 # todo: enable these
191 !! test
192 !! disabled
193 External links
194 !! input
195 Unrecognised characters (for no good reason): http://example.com/1$2345 [http://example.com/1$2345]
196 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
197 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
198 Link to non-http image, no img tag: ftp://example.com/test.jpg
199 Terminating separator: http://example.com/thing,
200 Intervening separator: http://example.com/1,2,3
201 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
202 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
203 URL in text: [http://example.com http://example.com]
204 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
205 Old &amp; use: http://x&y
206 Escaping without &amp;: http://x&y
207 !! result
208 <p>Unrecognised characters (for no good reason): <a href="http://example.com/1" class='external'>http://example.com/1</a>$2345
209 [http://example.com/1$2345]</p>
210 <p>External image: <img src="http://example.com/test.jpg" alt="test.jpg" /></p>
211 <p>External image from https: <img src="https://example.com/test.jpg" alt="test.jpg" /></p>
212 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a></p>
213 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,</p>
214 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a></p>
215 <p>Old bug with URL in query: [http://example.com/thing?url=<a href="http://example.com" class='external'>http://example.com</a>
216 link]</p>
217 <p>And again with mixed protocols: [ftp://example.com?url=<a href="http://example.com" class='external'>http://example.com</a>
218 link]</p>
219 <p>URL in text: <a href='http://example.com' class='external'></a><a href="http://example.com" class=
220 'external'>http://example.com</a> <span class='urlexpansion'>(<i>http://example.com</i>)</span></p>
221 <p>ja-style clickable images: <a href='http://example.com' class='external'><img src=
222 "http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a> <span class=
223 'urlexpansion'>(<i>http://example.com</i>)</span></p>
224 <p>Old &amp; use: <a href="http://x&y" class='external'>http://x&y</a></p>
225 <p>Escaping without &amp;: <a href="http://x&y" class='external'>http://x&y</a></p>
226 !! end
227
228 ###
229 ### Quotes
230 ###
231
232 !! test
233 Quotes
234 !! input
235 Normal text. '''Bold text.''' Normal text. ''Italic text.''
236
237 Normal text. '''''Bold italic text.''''' Normal text.
238 !!result
239 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
240 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
241 </p>
242 !! end
243
244
245 !! test
246 Unclosed and unmatched quotes
247 !! input
248 '''''Bold italic text '''with bold deactivated''' in between.'''''
249
250 '''''Bold italic text ''with italic deactivated'' in between.'''''
251
252 '''Bold text..
253
254 ..spanning two paragraphs (should not work).'''
255
256 '''Bold tag left open
257
258 ''Italic tag left open
259
260 Normal text.
261
262 <!-- Unmatching number of opening, closing tags: -->
263 '''This year''''s election ''should'' beat '''last year''''s.
264
265 ''Tom'''s car is bigger than ''Susan'''s.
266 !! result
267 <p><i><b>Bold italic text</b> with bold deactivated <b>in between.</b></i>
268 </p><p><b><i>Bold italic text</i> with italic deactivated <i>in between.</i></b><p>
269 </p><p><b>Bold text..</b>
270 </p><p>..spanning two paragraphs (should not work).
271 </p><p><b>Bold tag left open</b>
272 </p><p><i>Italic tag left open</i>
273 </p><p>Normal text.
274 </p><p><b>This year</b>'s election <i>should</i> beat <b>last year</b>'s.
275 </p><p><i>Tom<b>s car is bigger than</b></i> <b>Susan</b>s.
276 </p>
277 !! end
278
279 ###
280 ### Internal links
281 ###
282 !! test
283 Internal links
284 !! input
285 Plain link, capitalized: [[Main Page]]
286
287 Plain link, uncapitalized: [[main Page]]
288 !! result
289 <p>Plain link, capitalized: <a href="__SCRIPT__/Main_Page" title="Main Page">Main Page</a>
290 </p><p>Plain link, uncapitalized: <a href="__SCRIPT__/Main_Page" title="Main Page">main Page</a>
291 </p>
292 !! end
293
294 !! test
295 Internal links 2
296 !! disabled
297 !!input
298
299 Piped link: [[Main Page|The Main Page]]
300
301 Broken link: [[Zigzagzogzagzig]]
302
303 Link with prefix: XXX[[main Page]], XXX[[Main Page]]
304
305 Link with suffix: [[Main Page]]XXX
306
307 Link with 3 brackets: [[[main page]]]
308
309 Piped link with 3 brackets: [[[main page|the main page]]]
310
311 Link to namespaces: [[Talk:Parser testing]], [[Meta:Disclaimers]]
312
313 Piped link to namespace: [[Meta:Disclaimers|The disclaimers]]
314
315 Link to category: [[:Category:MediaWiki User's Guide]]
316
317 Link to image page: [[:Image:Ncwikicol.png]]
318
319 Plain link to URL: [[http://www.example.org]]
320
321 Piped link to URL: [[http://www.example.org|an example URL]]
322 !! result
323 </p><p>Piped link: <a href="/wiki/Main_Page">The Main Page</a></p>
324 <p>Broken link: <a href="/w/wiki.phtml?title=Zigzagzogzagzig&action=edit" class="new">Zigzagzogzagzig</a></p>
325 <p>Link with prefix: xxx<a href="/wiki/Main_Page">main Page</a>, xxx<a href="/wiki/Main_Page">Main Page</a>, Xxx<a href=
326 "/wiki/Main_Page">main Page</a> XXX<a href="/wiki/Main_Page">main Page</a>, XXX<a href="/wiki/Main_Page">Main Page</a></p>
327 <p>Link with suffix: <a href="/wiki/Main_Page">Main Pagexxx</a>, <a href="/wiki/Main_Page">Main Page</a>XXX</p>
328 <p>Link with 3 brackets: [[[main page]]]</p>
329 <p>Piped link with 3 brackets: [[[main page|the main page]]]</p>
330 <p>Link to namespaces: <a href="/w/wiki.phtml?title=Talk:Parser_testing&action=edit" class="new">Talk:Parser testing</a>,
331 <a href="/w/wiki.phtml?title=Meta:Disclaimers&action=edit" class="new">Meta:Disclaimers</a></p>
332 <p>Piped link to namespace: <a href="/w/wiki.phtml?title=Meta:Disclaimers&action=edit" class="new">The disclaimers</a></p>
333 <p>Link to category: <a href="/wiki/Category:MediaWiki_User%27s_Guide">Category:MediaWiki User's Guide</a></p>
334 <p>Link to image page: <a href="/wiki/Image:Ncwikicol.png">Image:Ncwikicol.png</a></p>
335 <p>Plain link to URL: [<a href='http://www.example.org' class='external'>[1]</a> <span class=
336 'urlexpansion'>(<i>http://www.example.org</i>)</span>]</p>
337 <p>Piped link to URL: <a href="/w/wiki.phtml?title=Http://www.example.org&action=edit" class="new">an example URL</a></p>
338 !! end