| 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 |
!! article |
| 10 |
Template:1x |
| 11 |
!! text |
| 12 |
{{{1}}} |
| 13 |
!! endarticle |
| 14 |
|
| 15 |
!! test |
| 16 |
No block tags |
| 17 |
!! wikitext |
| 18 |
a |
| 19 |
|
| 20 |
b |
| 21 |
!! html |
| 22 |
<p>a |
| 23 |
</p><p>b |
| 24 |
</p> |
| 25 |
!! end |
| 26 |
|
| 27 |
!! test |
| 28 |
Block tag on one line (<div>) |
| 29 |
!! wikitext |
| 30 |
a <div>foo</div> |
| 31 |
|
| 32 |
b |
| 33 |
!! html |
| 34 |
<p>a </p><div>foo</div> |
| 35 |
<p>b |
| 36 |
</p> |
| 37 |
!! end |
| 38 |
|
| 39 |
!! test |
| 40 |
No p-wrappable content |
| 41 |
!! options |
| 42 |
parsoid=wt2html,html2html |
| 43 |
!! wikitext |
| 44 |
<span><div>x</div></span> |
| 45 |
<span><s><div>x</div></s></span> |
| 46 |
<small><em></em></small><span><s><div>x</div></s></span> |
| 47 |
!! html |
| 48 |
<span><div>x</div></span> |
| 49 |
<span><s><div>x</div></s></span> |
| 50 |
<p><small><em></em></small></p><span><s><div>x</div></s></span> |
| 51 |
!! end |
| 52 |
|
| 53 |
# T177612: Parsoid-only test |
| 54 |
!! test |
| 55 |
Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code |
| 56 |
!! wikitext |
| 57 |
{{1x|<span><div>x</div></span>}} |
| 58 |
x |
| 59 |
!! html/parsoid |
| 60 |
<span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<span><div>x</div></span>"}},"i":0}}]}'><div>x</div></span> |
| 61 |
<p>x</p> |
| 62 |
!! end |
| 63 |
|
| 64 |
!! test |
| 65 |
Block tag on one line (<blockquote>) |
| 66 |
!! wikitext |
| 67 |
a <blockquote>foo</blockquote> |
| 68 |
|
| 69 |
b |
| 70 |
!! html |
| 71 |
<p>a </p><blockquote><p>foo</p></blockquote> |
| 72 |
<p>b |
| 73 |
</p> |
| 74 |
!! end |
| 75 |
|
| 76 |
!! test |
| 77 |
Block tag on both lines (<div>) |
| 78 |
!! wikitext |
| 79 |
a <div>foo</div> |
| 80 |
|
| 81 |
b <div>foo</div> |
| 82 |
!! html |
| 83 |
<p>a </p><div>foo</div><p> |
| 84 |
b </p><div>foo</div> |
| 85 |
!! end |
| 86 |
|
| 87 |
!! test |
| 88 |
Block tag on both lines (<blockquote>) |
| 89 |
!! wikitext |
| 90 |
a <blockquote>foo</blockquote> |
| 91 |
|
| 92 |
b <blockquote>foo</blockquote> |
| 93 |
!! html |
| 94 |
<p>a </p><blockquote><p>foo</p></blockquote><p> |
| 95 |
b </p><blockquote><p>foo</p></blockquote> |
| 96 |
!! end |
| 97 |
|
| 98 |
!! test |
| 99 |
Multiple lines without block tags |
| 100 |
!! wikitext |
| 101 |
<div>foo</div> a |
| 102 |
b |
| 103 |
c |
| 104 |
d<!--foo--> e |
| 105 |
x <div>foo</div> z |
| 106 |
!! html/php |
| 107 |
<div>foo</div><p> a |
| 108 |
</p><p>b |
| 109 |
c |
| 110 |
d e |
| 111 |
</p><p> |
| 112 |
x </p><div>foo</div><p> z</p> |
| 113 |
!! html/parsoid |
| 114 |
<div data-parsoid='{"stx":"html"}'>foo</div><p> a</p> |
| 115 |
<p>b |
| 116 |
c |
| 117 |
d<!--foo--> e</p> |
| 118 |
<p>x </p><div data-parsoid='{"stx":"html"}'>foo</div><p> z</p> |
| 119 |
!! end |
| 120 |
|
| 121 |
!! test |
| 122 |
Empty lines between lines with block tags |
| 123 |
!! wikitext |
| 124 |
<div></div> |
| 125 |
|
| 126 |
|
| 127 |
<div></div>a |
| 128 |
|
| 129 |
b |
| 130 |
<div>a</div>b |
| 131 |
|
| 132 |
<div>b</div>d |
| 133 |
|
| 134 |
|
| 135 |
<div>e</div> |
| 136 |
!! html/php |
| 137 |
<div></div> |
| 138 |
<p><br /> |
| 139 |
</p> |
| 140 |
<div></div><p>a |
| 141 |
</p><p>b |
| 142 |
</p> |
| 143 |
<div>a</div><p>b |
| 144 |
</p><div>b</div><p>d |
| 145 |
</p><p><br /> |
| 146 |
</p> |
| 147 |
<div>e</div> |
| 148 |
!! html/parsoid |
| 149 |
<div data-parsoid='{"stx":"html"}'></div> |
| 150 |
|
| 151 |
<p><br /></p> |
| 152 |
<div data-parsoid='{"stx":"html"}'></div><p>a</p> |
| 153 |
|
| 154 |
<p>b</p> |
| 155 |
<div data-parsoid='{"stx":"html"}'>a</div><p>b</p> |
| 156 |
|
| 157 |
<div data-parsoid='{"stx":"html"}'>b</div><p>d</p> |
| 158 |
|
| 159 |
<p><br /></p> |
| 160 |
<div data-parsoid='{"stx":"html"}'>e</div> |
| 161 |
!! end |
| 162 |
|
| 163 |
!! test |
| 164 |
Unclosed HTML p-tags should be handled properly |
| 165 |
!! wikitext |
| 166 |
<div><p>foo</div> |
| 167 |
a |
| 168 |
|
| 169 |
b |
| 170 |
!! html/php |
| 171 |
<div><p>foo</p></div> |
| 172 |
<p>a |
| 173 |
</p><p>b |
| 174 |
</p> |
| 175 |
!! html/parsoid |
| 176 |
<div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div> |
| 177 |
<p>a</p> |
| 178 |
<p>b</p> |
| 179 |
!! end |
| 180 |
|
| 181 |
## SSS FIXME: I can come up with other scenarios where this doesn't work because |
| 182 |
## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore |
| 183 |
## them for now. |
| 184 |
!! test |
| 185 |
1. P-wrapping should leave sol-transparent tags outside p-tags where possible |
| 186 |
!! options |
| 187 |
parsoid=wt2html |
| 188 |
!! wikitext |
| 189 |
a [[Category:A1]] [[Category:A2]] |
| 190 |
[[Category:A3]] |
| 191 |
[[Category:A4]] |
| 192 |
!! html/parsoid |
| 193 |
<p>a</p> |
| 194 |
<link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/> |
| 195 |
!! end |
| 196 |
|
| 197 |
!! test |
| 198 |
2. P-wrapping should leave sol-transparent tags outside p-tags where possible |
| 199 |
!! options |
| 200 |
parsoid=wt2html |
| 201 |
!! wikitext |
| 202 |
[[Category:A1]]a |
| 203 |
!! html/parsoid |
| 204 |
<link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p> |
| 205 |
!! end |
| 206 |
|
| 207 |
!! test |
| 208 |
No paragraph necessary for SOL transparent template |
| 209 |
!! wikitext |
| 210 |
<span><div>foo</div></span> |
| 211 |
[[Category:Foo]] |
| 212 |
|
| 213 |
<span><div>foo</div></span> |
| 214 |
{{1x|[[Category:Foo]]}} |
| 215 |
!! html/php |
| 216 |
<span><div>foo</div></span> |
| 217 |
<span><div>foo</div></span> |
| 218 |
!! html/parsoid |
| 219 |
<span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span> |
| 220 |
<link rel="mw:PageProp/Category" href="./Category:Foo"/> |
| 221 |
|
| 222 |
<span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span> |
| 223 |
<link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/> |
| 224 |
!! end |
| 225 |
|
| 226 |
!! test |
| 227 |
Avoid expanding multiline sol transparent template ranges unnecessarily |
| 228 |
!! wikitext |
| 229 |
hi |
| 230 |
|
| 231 |
|
| 232 |
{{1x|<br/> |
| 233 |
}} |
| 234 |
|
| 235 |
[[Category:Ho]] |
| 236 |
!! html/php |
| 237 |
<p>hi |
| 238 |
</p><p><br /> |
| 239 |
<br /> |
| 240 |
</p> |
| 241 |
!! html/parsoid |
| 242 |
<p>hi</p> |
| 243 |
|
| 244 |
<p><br /> |
| 245 |
<br about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<br/>\n"}},"i":0}}]}'/><span about="#mwt1"> |
| 246 |
</span></p> |
| 247 |
|
| 248 |
<link rel="mw:PageProp/Category" href="./Category:Ho" /> |
| 249 |
!! end |
| 250 |
|
| 251 |
!! test |
| 252 |
Paragraph wrapping following unclosed table |
| 253 |
!! options |
| 254 |
parsoid=wt2html,html2html |
| 255 |
!! wikitext |
| 256 |
{| |
| 257 |
|- |
| 258 |
|
| 259 |
{| |
| 260 |
| x |
| 261 |
|} |
| 262 |
|
| 263 |
a |
| 264 |
|
| 265 |
b |
| 266 |
|
| 267 |
c |
| 268 |
!! html/php |
| 269 |
<table> |
| 270 |
|
| 271 |
|
| 272 |
</table><table> |
| 273 |
<tbody><tr> |
| 274 |
<td>x |
| 275 |
</td></tr></tbody></table> |
| 276 |
<p>a |
| 277 |
</p><p>b |
| 278 |
</p><p>c |
| 279 |
</p> |
| 280 |
!! html/parsoid |
| 281 |
<table data-parsoid='{"autoInsertedEnd":true}'> |
| 282 |
<tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr> |
| 283 |
|
| 284 |
</tbody></table><table> |
| 285 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr> |
| 286 |
</tbody></table> |
| 287 |
|
| 288 |
<p>a</p> |
| 289 |
|
| 290 |
<p>b</p> |
| 291 |
|
| 292 |
<p>c</p> |
| 293 |
!! end |
| 294 |
|
| 295 |
!! test |
| 296 |
Paragraph wrapping suppressed in html p |
| 297 |
!! options |
| 298 |
parsoid=wt2html,html2html |
| 299 |
!! wikitext |
| 300 |
<p> |
| 301 |
|
| 302 |
|
| 303 |
hi |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
</p> |
| 308 |
!! html/php |
| 309 |
<p> |
| 310 |
|
| 311 |
|
| 312 |
hi |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
</p> |
| 317 |
!! html/parsoid |
| 318 |
<p data-parsoid='{"stx":"html"}'> |
| 319 |
|
| 320 |
|
| 321 |
hi |
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
</p> |
| 326 |
!! end |
| 327 |
|
| 328 |
!! test |
| 329 |
Dangling table row doesn't prevent p-wrapping |
| 330 |
!! options |
| 331 |
parsoid=wt2html,html2html |
| 332 |
!! wikitext |
| 333 |
{| |
| 334 |
| hi |
| 335 |
|- |
| 336 |
|} ho |
| 337 |
!! html/parsoid |
| 338 |
<table> |
| 339 |
<tbody><tr><td>hi</td></tr> |
| 340 |
<tr class="mw-empty-elt"></tr> |
| 341 |
</tbody></table><p> ho</p> |
| 342 |
!! end |
| 343 |
|
| 344 |
!! test |
| 345 |
P-wrapping non-breaking spaces |
| 346 |
!! wikitext |
| 347 |
|
| 348 |
!! html/php |
| 349 |
<p>  |
| 350 |
</p> |
| 351 |
!! html/parsoid |
| 352 |
<p> </p> |
| 353 |
!! end |
| 354 |
|
| 355 |
!! test |
| 356 |
Paragraph wrapping suppressed in table captions |
| 357 |
!! wikitext |
| 358 |
{| |
| 359 |
|+hi |
| 360 |
|ho |
| 361 |
|} |
| 362 |
|
| 363 |
{| |
| 364 |
|hi |
| 365 |
|+ho |
| 366 |
|} |
| 367 |
|
| 368 |
it's off to work we go |
| 369 |
!! html/php |
| 370 |
<table> |
| 371 |
<caption>hi |
| 372 |
</caption> |
| 373 |
<tbody><tr> |
| 374 |
<td>ho |
| 375 |
</td></tr></tbody></table> |
| 376 |
<table> |
| 377 |
<tbody><tr> |
| 378 |
<td>hi |
| 379 |
</td> |
| 380 |
</tr></tbody><caption>ho |
| 381 |
</caption></table> |
| 382 |
<p>it's off to work we go |
| 383 |
</p> |
| 384 |
!! html/parsoid |
| 385 |
<table> |
| 386 |
<caption>hi</caption> |
| 387 |
<tbody><tr><td>ho</td></tr> |
| 388 |
</tbody></table> |
| 389 |
|
| 390 |
<table> |
| 391 |
<tbody><tr><td>hi</td></tr> |
| 392 |
</tbody><caption>ho</caption> |
| 393 |
</table> |
| 394 |
|
| 395 |
<p>it's off to work we go</p> |
| 396 |
!! end |