Debian Codegraph @

tests/parser/quotes.txt

raw
1 # The parsoid-compatible option below is only relevant when we are running
2 # parser tests in integrated mode with Parsoid. This option is ignored
3 # when this test file is run with Parsoid in standalone mode.
4 !! options
5 parsoid-compatible=wt2html,wt2wt
6 version=2
7 !! end
8
9 # This is the standard article assumed to exist.
10 !! article
11 Main Page
12 !! text
13 blah blah
14 !! endarticle
15
16 !! article
17 Lunar Prospector
18 !! text
19 was flying around the moon
20 !! end
21
22 !! article
23 Accademia della Crusca
24 !! text
25 foo
26 !! end
27
28 !! test
29 Quotes
30 !! wikitext
31 Normal text. '''Bold text.''' Normal text. ''Italic text.''
32
33 Normal text. '''''Bold italic text.''''' Normal text.
34 !! html
35 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
36 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
37 </p>
38 !! end
39
40 !! test
41 Quotes wrapping HTML table
42 !! wikitext
43 '''<table><tr><td>hi</td></tr></table>'''
44 !! html/php
45 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
46 !! html/parsoid
47 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
48 !! end
49
50 # Parsoid inserts an empty bold tag pair at the end of the line.
51 # The wikitext contains just the first half of the bold
52 # quote pair.
53 !! test
54 Unclosed and unmatched quotes
55 !! wikitext
56 '''''Bold italic text '''with bold deactivated''' in between.'''''
57
58 '''''Bold italic text ''with italic deactivated'' in between.'''''
59
60 '''Bold text..
61
62 ..spanning two paragraphs (should not work).'''
63
64 '''Bold tag left open
65
66 ''Italic tag left open
67
68 Normal text.
69
70 <!-- Unmatching number of opening, closing tags: -->
71 '''This year''''s election ''should'' beat '''last year''''s.
72
73 ''Tom'''s car is bigger than ''Susan'''s.
74
75 Plain ''italic'''s plain
76 !! html/php
77 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
78 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
79 </p><p><b>Bold text..</b>
80 </p><p>..spanning two paragraphs (should not work).<b></b>
81 </p><p><b>Bold tag left open</b>
82 </p><p><i>Italic tag left open</i>
83 </p><p>Normal text.
84 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
85 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
86 </p><p>Plain <i>italic'</i>s plain
87 </p>
88 !! html/parsoid
89 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
90 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
91 </p><p><b>Bold text..</b>
92 </p><p>..spanning two paragraphs (should not work).<b></b>
93 </p><p><b>Bold tag left open</b>
94 </p><p><i>Italic tag left open</i>
95 </p><p>Normal text.
96 </p>
97 <!-- Unmatching number of opening, closing tags: -->
98 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
99 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
100 </p><p>Plain <i>italic'</i>s plain
101 </p>
102 !! end
103 !! test
104 Italics and bold
105 !! wikitext
106 *plain
107 *plain''italic''plain
108 *plain''italic''plain''italic''plain
109 *plain'''bold'''plain
110 *plain'''bold'''plain'''bold'''plain
111 *plain''italic''plain'''bold'''plain
112 *plain'''bold'''plain''italic''plain
113 *plain''italic'''bold-italic'''italic''plain
114 *plain'''bold''bold-italic''bold'''plain
115 *plain'''''bold-italic'''italic''plain
116 *plain'''''bold-italic''bold'''plain
117 *plain''italic'''bold-italic'''''plain
118 *plain'''bold''bold-italic'''''plain
119 *plain l'''italic''plain
120 *plain l''''bold''' plain
121 !! html
122 <ul><li>plain</li>
123 <li>plain<i>italic</i>plain</li>
124 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
125 <li>plain<b>bold</b>plain</li>
126 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
127 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
128 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
129 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
130 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
131 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
132 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
133 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
134 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
135 <li>plain l'<i>italic</i>plain</li>
136 <li>plain l'<b>bold</b> plain</li></ul>
137 !! end
138
139 # this example taken from the [[simple:Moon]] article (T49326)
140 !! test
141 Italics and possessives (1)
142 !! wikitext
143 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
144 !! html/php
145 <p>obtained by <i><a href="/wiki/Lunar_Prospector" title="Lunar Prospector">Lunar Prospector</a>'</i>s gamma-ray spectrometer
146 </p>
147 !! html/parsoid
148 <p>obtained by <i><a rel="mw:WikiLink" href="./Lunar_Prospector" title="Lunar Prospector" data-parsoid='{"stx":"simple","a":{"href":"./Lunar_Prospector"},"sa":{"href":"Lunar Prospector"}}'>Lunar Prospector</a>'</i>s gamma-ray spectrometer</p>
149 !! end
150
151 # this example taken from [[en:Flaming Pie]] (T51926)
152 !! test
153 Italics and possessives (2)
154 !! wikitext
155 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
156 !! html
157 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
158 </p>
159 !! end
160
161 # this example taken from [[en:Dictionary]] (T51926)
162 !! test
163 Italics and possessives (3)
164 !! wikitext
165 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
166 !! html/php
167 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/wiki/Accademia_della_Crusca" title="Accademia della Crusca">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
168 </p>
169 !! html/parsoid
170 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a rel="mw:WikiLink" href="./Accademia_della_Crusca" title="Accademia della Crusca" data-parsoid='{"stx":"simple","a":{"href":"./Accademia_della_Crusca"},"sa":{"href":"Accademia della Crusca"}}'>Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.</p>
171 !! end
172
173 ###
174 ### 2-quote opening sequence tests
175 ###
176
177 !! test
178 Italics and bold: 2-quote opening sequence: (2,2)
179 !! wikitext
180 ''foo''
181 !! html
182 <p><i>foo</i>
183 </p>
184 !! end
185
186 !! test
187 Italics and bold: 2-quote opening sequence: (2,3)
188 !! wikitext
189 ''foo'''
190 !! html/*
191 <p><i>foo'</i>
192 </p>
193 !! end
194
195 !! test
196 Italics and bold: 2-quote opening sequence: (2,4)
197 !! options
198 parsoid=wt2html
199 !! wikitext
200 ''foo''''
201 !! html/*
202 <p><i>foo''</i>
203 </p>
204 !! end
205
206 # same html as previous, but wikitext adjusted to match parsoid html2wt
207 !! test
208 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
209 !! wikitext
210 ''foo<nowiki>''</nowiki>''
211 !! html
212 <p><i>foo''</i>
213 </p>
214 !! end
215
216 !! test
217 Italics and bold: 2-quote opening sequence: (2,5)
218 !! options
219 parsoid=wt2html
220 !! wikitext
221 ''foo'''''
222 !! html
223 <p><i>foo</i><b></b>
224 </p>
225 !! end
226
227 # same html as previous, but wikitext adjusted to match parsoid html2wt
228 !! test
229 Italics and bold: 2-quote opening sequence: (2,5-3)
230 !! options
231 parsoid=html2wt
232 !! html/parsoid
233 <p><i>foo</i><b></b>
234 </p>
235 !! wikitext
236 ''foo''
237 !! end
238
239 ###
240 ### 3-quote opening sequence tests
241 ###
242
243 !! test
244 Italics and bold: 3-quote opening sequence: (3,2)
245 !! wikitext
246 '''foo''
247 !! html
248 <p>'<i>foo</i>
249 </p>
250 !! end
251
252 !! test
253 Italics and bold: 3-quote opening sequence: (3,3)
254 !! wikitext
255 '''foo'''
256 !! html
257 <p><b>foo</b>
258 </p>
259 !! end
260
261 !! test
262 Italics and bold: 3-quote opening sequence: (3,4)
263 !! wikitext
264 '''foo''''
265 !! html
266 <p><b>foo'</b>
267 </p>
268 !! end
269
270 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
271 !! test
272 Italics and bold: 3-quote opening sequence: (3,5)
273 !! options
274 parsoid=wt2html
275 !! wikitext
276 '''foo'''''
277 !! html
278 <p><b>foo</b><i></i>
279 </p>
280 !! end
281
282 # same html as previous, but wikitext adjusted to match parsoid html2wt
283 !! test
284 Italics and bold: 3-quote opening sequence: (3,5-2)
285 !! options
286 parsoid=html2wt
287 !! html/parsoid
288 <p><b>foo</b><i></i>
289 </p>
290 !! wikitext
291 '''foo'''
292 !! end
293
294 ###
295 ### 4-quote opening sequence tests
296 ###
297
298 !! test
299 Italics and bold: 4-quote opening sequence: (4,2)
300 !! options
301 parsoid=wt2html
302 !! wikitext
303 ''''foo''
304 !! html/*
305 <p>''<i>foo</i>
306 </p>
307 !!end
308
309 # same html as previous, but wikitext adjusted to match parsoid html2wt
310 !! test
311 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
312 !! wikitext
313 <nowiki>''</nowiki>''foo''
314 !! html
315 <p>''<i>foo</i>
316 </p>
317 !! end
318
319 !! test
320 Italics and bold: 4-quote opening sequence: (4,3)
321 !! wikitext
322 ''''foo'''
323 !! html/*
324 <p>'<b>foo</b>
325 </p>
326 !!end
327
328 !! test
329 Italics and bold: 4-quote opening sequence: (4,4)
330 !! options
331 parsoid=wt2html
332 !! wikitext
333 ''''foo''''
334 !! html/*
335 <p>'<b>foo'</b>
336 </p>
337 !!end
338
339 # same html as previous, but wikitext adjusted to match parsoid html2wt
340 !! test
341 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
342 !! wikitext
343 '<nowiki/>'''foo''''
344 !! html
345 <p>'<b>foo'</b>
346 </p>
347 !! end
348
349 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
350 !! test
351 Italics and bold: 4-quote opening sequence: (4,5)
352 !! options
353 parsoid=wt2html
354 !! wikitext
355 ''''foo'''''
356 !! html
357 <p>'<b>foo</b><i></i>
358 </p>
359 !!end
360
361 # same html as previous, but wikitext adjusted to match parsoid html2wt
362 !! test
363 Italics and bold: 4-quote opening sequence: (4,5-2)
364 !! options
365 parsoid=html2wt
366 !! html/parsoid
367 <p>'<b>foo</b><i></i>
368 </p>
369 !! wikitext
370 ''''foo'''
371 !! end
372
373 ###
374 ### 5-quote opening sequence tests
375 ###
376
377 !! test
378 Italics and bold: 5-quote opening sequence: (5,2)
379 !! options
380 parsoid=wt2html
381 !! wikitext
382 '''''foo''
383 !! html/*
384 <p><b><i>foo</i></b>
385 </p>
386 !! end
387
388 # same html as previous, but wikitext adjusted to match parsoid html2wt
389 !! test
390 Italics and bold: 5-quote opening sequence: (5,2+3)
391 !! wikitext
392 '''''foo'''''
393 !! html/*
394 <p><i><b>foo</b></i>
395 </p>
396 !! end
397
398 !! test
399 Italics and bold: 5-quote opening sequence: (5,3)
400 !! options
401 parsoid=wt2html
402 !! wikitext
403 '''''foo'''
404 !! html/*
405 <p><i><b>foo</b></i>
406 </p>
407 !! end
408
409 # same html as previous, but wikitext adjusted to match parsoid html2wt
410 !! test
411 Italics and bold: 5-quote opening sequence: (5,3+2)
412 !! wikitext
413 '''''foo'''''
414 !! html
415 <p><i><b>foo</b></i>
416 </p>
417 !! end
418
419 !! test
420 Italics and bold: 5-quote opening sequence: (5,4)
421 !! options
422 parsoid=wt2html
423 !! wikitext
424 '''''foo''''
425 !! html/*
426 <p><i><b>foo'</b></i>
427 </p>
428 !! end
429
430 !! test
431 Italics and bold: 5-quote opening sequence: (5,5)
432 !! wikitext
433 '''''foo'''''
434 !! html
435 <p><i><b>foo</b></i>
436 </p>
437 !! end
438
439 !! test
440 Italics and bold: 5-quote opening sequence: (5,6)
441 !! wikitext
442 '''''foo''''''
443 !! html/*
444 <p><i><b>foo'</b></i>
445 </p>
446 !! end
447
448 ###
449 ### multiple quote sequences in a line
450 ###
451
452 !! test
453 Italics and bold: multiple quote sequences: (2,4,2)
454 !! options
455 parsoid=wt2html
456 !! wikitext
457 ''foo''''bar''
458 !! html/php
459 <p><i>foo'<b>bar</b></i><b></b>
460 </p>
461 !! html/parsoid
462 <p><i>foo'<b>bar</b></i>
463 </p>
464 !! end
465
466 # same html as previous, but wikitext adjusted to match parsoid html2wt
467 !! test
468 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
469 !! wikitext
470 ''foo'<nowiki/>'''bar'''''
471 !! html
472 <p><i>foo'<b>bar</b></i>
473 </p>
474 !! end
475
476 !! test
477 Italics and bold: multiple quote sequences: (2,4,3)
478 !! options
479 parsoid=wt2html
480 !! wikitext
481 ''foo''''bar'''
482 !! html/*
483 <p><i>foo'<b>bar</b></i>
484 </p>
485 !! end
486
487 # same html as previous, but wikitext adjusted to match parsoid html2wt
488 !! test
489 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
490 !! wikitext
491 ''foo'<nowiki/>'''bar'''''
492 !! html
493 <p><i>foo'<b>bar</b></i>
494 </p>
495 !! end
496
497 !! test
498 Italics and bold: multiple quote sequences: (2,4,4)
499 !! options
500 parsoid=wt2html
501 !! wikitext
502 ''foo''''bar''''
503 !! html/*
504 <p><i>foo'<b>bar'</b></i>
505 </p>
506 !! end
507
508 # same html as previous, but wikitext adjusted to match parsoid html2wt
509 !! test
510 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
511 !! wikitext
512 ''foo'<nowiki/>'''bar'<nowiki/>'''''
513 !! html
514 <p><i>foo'<b>bar'</b></i>
515 </p>
516 !! end
517
518 !! test
519 Italics and bold: multiple quote sequences: (3,4,2)
520 !! options
521 parsoid=wt2html
522 !! wikitext
523 '''foo''''bar''
524 !! html
525 <p><b>foo'</b>bar<i></i>
526 </p>
527 !! end
528
529 # same html as previous, but wikitext adjusted to match parsoid html2wt
530 !! test
531 Italics and bold: multiple quote sequences: (3,4,2-2)
532 !! options
533 parsoid=html2wt
534 !! html/parsoid
535 <p><b>foo'</b>bar<i></i>
536 </p>
537 !! wikitext
538 '''foo''''bar
539 !! end
540
541 !! test
542 Italics and bold: multiple quote sequences: (3,4,3)
543 !! options
544 parsoid=wt2html
545 !! wikitext
546 '''foo''''bar'''
547 !! html
548 <p><b>foo'</b>bar<b></b>
549 </p>
550 !! end
551
552 # same html as previous, but wikitext adjusted to match parsoid html2wt
553 !! test
554 Italics and bold: multiple quote sequences: (3,4,3-3)
555 !! options
556 parsoid=html2wt
557 !! html/parsoid
558 <p><b>foo'</b>bar<b></b>
559 </p>
560 !! wikitext
561 '''foo''''bar
562 !! end
563
564 ###
565 ### other quote tests
566 ###
567
568 !! test
569 Italics and bold: other quote tests: (2,3,5)
570 !! wikitext
571 ''this is about '''foo's family'''''
572 !! html
573 <p><i>this is about <b>foo's family</b></i>
574 </p>
575 !! end
576
577 !! test
578 Italics and bold: other quote tests: (2,(3,3),2)
579 !! wikitext
580 ''this is about '''foo's''' family''
581 !! html
582 <p><i>this is about <b>foo's</b> family</i>
583 </p>
584 !! end
585
586 !! test
587 Italics and bold: other quote tests: (3,2,3,2)
588 !! options
589 parsoid=wt2html
590 !! wikitext
591 '''this is about ''foo'''s family''
592 !! html/*
593 <p><b>this is about <i>foo</i></b><i>s family</i>
594 </p>
595 !!end
596
597 # same html as previous, but wikitext adjusted to match parsoid html2wt
598 !! test
599 Italics and bold: other quote tests: (3,2,3+2+2,2)
600 !! wikitext
601 '''this is about ''foo'''''<nowiki/>''s family''
602 !! html
603 <p><b>this is about <i>foo</i></b><i>s family</i>
604 </p>
605 !! end
606
607 !! test
608 Italics and bold: other quote tests: (3,2,3,3)
609 !! wikitext
610 '''this is about ''foo'''s family'''
611 !! html/*
612 <p>'<i>this is about </i>foo<b>s family</b>
613 </p>
614 !!end
615
616 !! test
617 Italics and bold: other quote tests: (3,(2,2),3)
618 !! wikitext
619 '''this is about ''foo's'' family'''
620 !! html
621 <p><b>this is about <i>foo's</i> family</b>
622 </p>
623 !!end
624
625 !! test
626 Italicized possessive
627 !! wikitext
628 The ''[[Main Page]]'''s talk page.
629 !! html/php
630 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
631 </p>
632 !! html/parsoid
633 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
634 !! end
635
636 !! test
637 Quote balancing context should be restricted to td/th cells on the same wikitext line
638 !! options
639 parsoid=wt2html,wt2wt
640 !! wikitext
641 {|
642 !''a!!''b
643 |''a||''b
644 |}
645 !! html
646 <table>
647 <tbody><tr>
648 <th><i>a</i></th>
649 <th><i>b</i>
650 </th>
651 <td><i>a</i></td>
652 <td><i>b</i>
653 </td></tr></tbody></table>
654 !! end
655
656 !! test
657 Bold conversion test
658 !! wikitext
659 a b'''c ''d e'''f'' g h'''i ''j
660 !! options
661 parsoid=wt2html
662 !! html
663 <p>a b'<i>c </i>d e<b>f<i> g h</i></b><i>i </i>j
664 </p>
665 !! end