| 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 |
version=2 |
| 6 |
parsoid-compatible=wt2html,wt2wt |
| 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 |
Template:1x |
| 18 |
!! text |
| 19 |
{{{1}}} |
| 20 |
!! endarticle |
| 21 |
|
| 22 |
!! article |
| 23 |
Template:tbl-start |
| 24 |
!! text |
| 25 |
{| |
| 26 |
!! endarticle |
| 27 |
|
| 28 |
!! article |
| 29 |
Template:tbl-end |
| 30 |
!! text |
| 31 |
|} |
| 32 |
!! endarticle |
| 33 |
|
| 34 |
!! article |
| 35 |
Template:table_attribs |
| 36 |
!! text |
| 37 |
<noinclude> |
| 38 |
|</noinclude>style="color:red;"|Foo |
| 39 |
!! endarticle |
| 40 |
|
| 41 |
!! article |
| 42 |
Template:table_attribs_2 |
| 43 |
!! text |
| 44 |
<noinclude> |
| 45 |
|</noinclude>data-sort-value="" style="color:red;"|Foo |
| 46 |
|Bar||Baz |
| 47 |
!! endarticle |
| 48 |
|
| 49 |
!! article |
| 50 |
Template:table_attribs_4 |
| 51 |
!! text |
| 52 |
| style="background-color:#DC241f;" width="10px" | |
| 53 |
!! endarticle |
| 54 |
|
| 55 |
!! article |
| 56 |
Template:table_attribs_5 |
| 57 |
!! text |
| 58 |
<noinclude> |
| 59 |
|</noinclude>style="color:red;"||Bar |
| 60 |
!! endarticle |
| 61 |
|
| 62 |
!! article |
| 63 |
Template:table_header_cells |
| 64 |
!! text |
| 65 |
{{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz |
| 66 |
!! endarticle |
| 67 |
|
| 68 |
!! article |
| 69 |
Template:table_cells |
| 70 |
!! text |
| 71 |
{{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz |
| 72 |
!! endarticle |
| 73 |
|
| 74 |
!! article |
| 75 |
Template:table_cell_content |
| 76 |
!! text |
| 77 |
{{{attr|}}}{{{cmt|}}}| foo |
| 78 |
!! endarticle |
| 79 |
|
| 80 |
## FIXME: Unused right now |
| 81 |
!! article |
| 82 |
Template:table_cell_content_with_leading_spc |
| 83 |
!! text |
| 84 |
| foo |
| 85 |
!! endarticle |
| 86 |
|
| 87 |
!! article |
| 88 |
Test |
| 89 |
!! text |
| 90 |
foo |
| 91 |
!! end |
| 92 |
|
| 93 |
### |
| 94 |
### Parsoid edge case regression tests |
| 95 |
### |
| 96 |
|
| 97 |
# This is unlikely to ever be used in any production wikipage |
| 98 |
# since it doesn't make any sense embedding tables in links. |
| 99 |
# FIXME: Note that the legacy parser and Parsoid differ on this! |
| 100 |
!! test |
| 101 |
Tables with multiple newlines after individual lines embedded in links |
| 102 |
!! options |
| 103 |
parsoid=wt2html,wt2wt |
| 104 |
!! wikitext |
| 105 |
[[Test| |
| 106 |
{| |
| 107 |
|
| 108 |
|test |
| 109 |
|}]] |
| 110 |
!! html/php |
| 111 |
<p><a href="/wiki/Test" title="Test"> |
| 112 |
</a></p><table> |
| 113 |
|
| 114 |
<tbody><tr> |
| 115 |
<td>test |
| 116 |
</td></tr></tbody></table> |
| 117 |
<p class="mw-empty-elt"></p> |
| 118 |
!! html/parsoid |
| 119 |
<p><a rel="mw:WikiLink" href="./Test" title="Test"> |
| 120 |
<table> |
| 121 |
|
| 122 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>test</td></tr> |
| 123 |
</tbody></table></a></p> |
| 124 |
!! end |
| 125 |
|
| 126 |
### |
| 127 |
### Table tests |
| 128 |
### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables |
| 129 |
### |
| 130 |
|
| 131 |
# This should not produce <table></table> as <table><tr><td></td></tr></table> |
| 132 |
# is the bare minimum required by the spec, see: |
| 133 |
# https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables |
| 134 |
# Parsoid team replies: empty table tags are legal in HTML5 |
| 135 |
!! test |
| 136 |
A table with no data. |
| 137 |
!! options |
| 138 |
parsoid=wt2html |
| 139 |
!! wikitext |
| 140 |
{||} |
| 141 |
!! html/php |
| 142 |
!! html/parsoid |
| 143 |
<table></table> |
| 144 |
!! end |
| 145 |
|
| 146 |
!! test |
| 147 |
A table with no data (take 2) |
| 148 |
!! wikitext |
| 149 |
{| |
| 150 |
|} |
| 151 |
!! html/php |
| 152 |
<table> |
| 153 |
<tbody><tr><td></td></tr></tbody></table> |
| 154 |
!! html/parsoid |
| 155 |
<table></table> |
| 156 |
!! end |
| 157 |
|
| 158 |
!! test |
| 159 |
A table with no data generated by a <table> markup |
| 160 |
!! wikitext |
| 161 |
<table></table> |
| 162 |
!! html/php |
| 163 |
<table></table> |
| 164 |
!! html/parsoid |
| 165 |
<table data-parsoid='{"stx":"html"}'></table> |
| 166 |
!! end |
| 167 |
|
| 168 |
# PHP has one more row in the output than Parsoid does: T208619 |
| 169 |
!! test |
| 170 |
Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced |
| 171 |
!! options |
| 172 |
parsoid=wt2html |
| 173 |
!! wikitext |
| 174 |
{| |
| 175 |
<td> |
| 176 |
<td> |
| 177 |
</td> |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|} |
| 182 |
!! html/php |
| 183 |
<table> |
| 184 |
<tbody><tr><td> |
| 185 |
</td><td> |
| 186 |
</td> |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
</tr><tr><td></td></tr></tbody></table> |
| 191 |
!! html/parsoid |
| 192 |
<table> |
| 193 |
|
| 194 |
<tbody> |
| 195 |
<tr> |
| 196 |
<td></td> |
| 197 |
|
| 198 |
<td> |
| 199 |
</td></tr> |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
</tbody></table> |
| 204 |
!! end |
| 205 |
|
| 206 |
!! test |
| 207 |
A table with stray table end tags on start tag line (wt2html) |
| 208 |
!! options |
| 209 |
parsoid=wt2html |
| 210 |
!! wikitext |
| 211 |
{|style="color: red;"|} |
| 212 |
|
| 213 |
{|style="color: red;" |} |
| 214 |
|foo |
| 215 |
|} |
| 216 |
|
| 217 |
{|style="color: red;"|} id="foo" |
| 218 |
|foo |
| 219 |
|} |
| 220 |
|
| 221 |
{|style="color: red;" |} id="foo" |
| 222 |
|foo |
| 223 |
|} |
| 224 |
!! html/php |
| 225 |
<table style="color: red;"> |
| 226 |
|
| 227 |
</table><table style="color: red;"> |
| 228 |
<tbody><tr> |
| 229 |
<td>foo |
| 230 |
</td></tr></tbody></table> |
| 231 |
<table style="color: red;" id="foo"> |
| 232 |
<tbody><tr> |
| 233 |
<td>foo |
| 234 |
</td></tr></tbody></table> |
| 235 |
<table style="color: red;" id="foo"> |
| 236 |
<tbody><tr> |
| 237 |
<td>foo |
| 238 |
</td></tr></tbody></table> |
| 239 |
!! html/parsoid |
| 240 |
<table style="color: red;"></table> |
| 241 |
|
| 242 |
<table style="color: red;"> |
| 243 |
<tbody><tr> |
| 244 |
<td>foo</td> |
| 245 |
</tr></tbody> |
| 246 |
</table> |
| 247 |
|
| 248 |
<table style="color: red;" id="foo"> |
| 249 |
<tbody><tr> |
| 250 |
<td>foo</td> |
| 251 |
</tr></tbody> |
| 252 |
</table> |
| 253 |
|
| 254 |
<table style="color: red;" id="foo"> |
| 255 |
<tbody><tr> |
| 256 |
<td>foo</td> |
| 257 |
</tr></tbody> |
| 258 |
</table> |
| 259 |
!! end |
| 260 |
|
| 261 |
# A table with nothing but a caption is invalid XHTML, we might want to render |
| 262 |
# this as <p>caption</p> |
| 263 |
# Parsoid team replies: table with only a caption is legal in HTML5 |
| 264 |
!! test |
| 265 |
A table with nothing but a caption |
| 266 |
!! wikitext |
| 267 |
{| |
| 268 |
|+caption |
| 269 |
|} |
| 270 |
!! html/php |
| 271 |
<table> |
| 272 |
<caption>caption |
| 273 |
</caption><tbody><tr><td></td></tr></tbody></table> |
| 274 |
!! html/parsoid |
| 275 |
<table><caption>caption</caption></table> |
| 276 |
!! end |
| 277 |
|
| 278 |
!! test |
| 279 |
A table with caption with default-spaced attributes and a table row |
| 280 |
!! wikitext |
| 281 |
{| |
| 282 |
|+ style="color: red;" |caption1 |
| 283 |
|- |
| 284 |
|foo |
| 285 |
|} |
| 286 |
!! html |
| 287 |
<table> |
| 288 |
<caption style="color: red;">caption1 |
| 289 |
</caption> |
| 290 |
<tbody><tr> |
| 291 |
<td>foo |
| 292 |
</td></tr></tbody></table> |
| 293 |
!! end |
| 294 |
|
| 295 |
!! test |
| 296 |
A table with captions with non-default spaced attributes and a table row |
| 297 |
!! wikitext |
| 298 |
{| |
| 299 |
|+style="color: red;"|caption2 |
| 300 |
|+ style="color: red;"|caption3 |
| 301 |
|- |
| 302 |
|foo |
| 303 |
|} |
| 304 |
!! html |
| 305 |
<table> |
| 306 |
<caption style="color: red;">caption2 |
| 307 |
</caption> |
| 308 |
<caption style="color: red;">caption3 |
| 309 |
</caption> |
| 310 |
<tbody><tr> |
| 311 |
<td>foo |
| 312 |
</td></tr></tbody></table> |
| 313 |
!! end |
| 314 |
|
| 315 |
!! test |
| 316 |
Table td-cell syntax variations |
| 317 |
!! wikitext |
| 318 |
{| |
| 319 |
|foo bar foo|baz |
| 320 |
|foo bar foo||baz |
| 321 |
|style='color:red;'|baz |
| 322 |
|style='color:red;'||baz |
| 323 |
|} |
| 324 |
!! html |
| 325 |
<table> |
| 326 |
<tbody><tr> |
| 327 |
<td>baz |
| 328 |
</td> |
| 329 |
<td>foo bar foo</td> |
| 330 |
<td>baz |
| 331 |
</td> |
| 332 |
<td style="color:red;">baz |
| 333 |
</td> |
| 334 |
<td>style='color:red;'</td> |
| 335 |
<td>baz |
| 336 |
</td></tr></tbody></table> |
| 337 |
!! end |
| 338 |
|
| 339 |
!! test |
| 340 |
Simple table |
| 341 |
!! wikitext |
| 342 |
{| |
| 343 |
|1||2 |
| 344 |
|- |
| 345 |
|3||4 |
| 346 |
|} |
| 347 |
!! html |
| 348 |
<table> |
| 349 |
<tbody><tr> |
| 350 |
<td>1</td> |
| 351 |
<td>2 |
| 352 |
</td></tr> |
| 353 |
<tr> |
| 354 |
<td>3</td> |
| 355 |
<td>4 |
| 356 |
</td></tr></tbody></table> |
| 357 |
!! end |
| 358 |
|
| 359 |
!! test |
| 360 |
Simple table but with multiple dashes for row wikitext |
| 361 |
!! wikitext |
| 362 |
{| |
| 363 |
|foo |
| 364 |
|----- |
| 365 |
|bar |
| 366 |
|} |
| 367 |
!! html |
| 368 |
<table> |
| 369 |
<tbody><tr> |
| 370 |
<td>foo |
| 371 |
</td></tr> |
| 372 |
<tr> |
| 373 |
<td>bar |
| 374 |
</td></tr></tbody></table> |
| 375 |
!! end |
| 376 |
|
| 377 |
!! test |
| 378 |
Multiplication table |
| 379 |
!! wikitext |
| 380 |
{| border="1" cellpadding="2" |
| 381 |
|+Multiplication table |
| 382 |
|- |
| 383 |
!×!!1!!2!!3 |
| 384 |
|- |
| 385 |
!1 |
| 386 |
|1||2||3 |
| 387 |
|- |
| 388 |
!2 |
| 389 |
|2||4||6 |
| 390 |
|- |
| 391 |
!3 |
| 392 |
|3||6||9 |
| 393 |
|- |
| 394 |
!4 |
| 395 |
|4||8||12 |
| 396 |
|- |
| 397 |
!5 |
| 398 |
|5||10||15 |
| 399 |
|} |
| 400 |
!! html |
| 401 |
<table border="1" cellpadding="2"> |
| 402 |
<caption>Multiplication table |
| 403 |
</caption> |
| 404 |
<tbody><tr> |
| 405 |
<th>×</th> |
| 406 |
<th>1</th> |
| 407 |
<th>2</th> |
| 408 |
<th>3 |
| 409 |
</th></tr> |
| 410 |
<tr> |
| 411 |
<th>1 |
| 412 |
</th> |
| 413 |
<td>1</td> |
| 414 |
<td>2</td> |
| 415 |
<td>3 |
| 416 |
</td></tr> |
| 417 |
<tr> |
| 418 |
<th>2 |
| 419 |
</th> |
| 420 |
<td>2</td> |
| 421 |
<td>4</td> |
| 422 |
<td>6 |
| 423 |
</td></tr> |
| 424 |
<tr> |
| 425 |
<th>3 |
| 426 |
</th> |
| 427 |
<td>3</td> |
| 428 |
<td>6</td> |
| 429 |
<td>9 |
| 430 |
</td></tr> |
| 431 |
<tr> |
| 432 |
<th>4 |
| 433 |
</th> |
| 434 |
<td>4</td> |
| 435 |
<td>8</td> |
| 436 |
<td>12 |
| 437 |
</td></tr> |
| 438 |
<tr> |
| 439 |
<th>5 |
| 440 |
</th> |
| 441 |
<td>5</td> |
| 442 |
<td>10</td> |
| 443 |
<td>15 |
| 444 |
</td></tr></tbody></table> |
| 445 |
!! end |
| 446 |
|
| 447 |
!! test |
| 448 |
Accept "||" in table headings |
| 449 |
!! wikitext |
| 450 |
{| |
| 451 |
!h1||h2 |
| 452 |
|} |
| 453 |
!! html |
| 454 |
<table> |
| 455 |
<tbody><tr> |
| 456 |
<th>h1</th> |
| 457 |
<th>h2 |
| 458 |
</th></tr></tbody></table> |
| 459 |
!! end |
| 460 |
|
| 461 |
!! test |
| 462 |
Accept "!!" in table data |
| 463 |
!! wikitext |
| 464 |
{| |
| 465 |
|Foo!!|| |
| 466 |
|} |
| 467 |
!! html |
| 468 |
<table> |
| 469 |
<tbody><tr> |
| 470 |
<td>Foo!!</td> |
| 471 |
<td> |
| 472 |
</td></tr></tbody></table> |
| 473 |
!! html/parsoid |
| 474 |
<table> |
| 475 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'> Foo!! </td><td data-parsoid='{"stx":"row"}'></td></tr> |
| 476 |
</tbody></table> |
| 477 |
!! end |
| 478 |
|
| 479 |
!! test |
| 480 |
Accept "||" in indented table headings |
| 481 |
!! wikitext |
| 482 |
:{| |
| 483 |
!h1||h2 |
| 484 |
|} |
| 485 |
!! html |
| 486 |
<dl><dd><table> |
| 487 |
<tbody><tr> |
| 488 |
<th>h1</th> |
| 489 |
<th>h2 |
| 490 |
</th></tr></tbody></table></dd></dl> |
| 491 |
!! end |
| 492 |
|
| 493 |
!! test |
| 494 |
Accept "!!" in templates |
| 495 |
!! wikitext |
| 496 |
{| |
| 497 |
!a {{1x|b!!c}} |
| 498 |
|} |
| 499 |
!! html/php |
| 500 |
<table> |
| 501 |
<tbody><tr> |
| 502 |
<th>a b</th> |
| 503 |
<th>c |
| 504 |
</th></tr></tbody></table> |
| 505 |
!! html/parsoid |
| 506 |
<table> |
| 507 |
<tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr> |
| 508 |
</tbody></table> |
| 509 |
!! end |
| 510 |
|
| 511 |
!! test |
| 512 |
Accept "!!" in table headings after newline |
| 513 |
!! wikitext |
| 514 |
{| |
| 515 |
!a |
| 516 |
b!!c |
| 517 |
|} |
| 518 |
!! html/php |
| 519 |
<table> |
| 520 |
<tbody><tr> |
| 521 |
<th>a |
| 522 |
<p>b!!c |
| 523 |
</p> |
| 524 |
</th></tr></tbody></table> |
| 525 |
!! html/parsoid |
| 526 |
<table> |
| 527 |
<tbody><tr><th>a |
| 528 |
<p>b!!c</p></th></tr> |
| 529 |
</tbody></table> |
| 530 |
!! end |
| 531 |
|
| 532 |
!! test |
| 533 |
Accept "!!" in table data of mixed wikitext / html syntax |
| 534 |
!! wikitext |
| 535 |
{| |
| 536 |
!a |
| 537 |
<tr><td>b!!c</td></tr> |
| 538 |
|} |
| 539 |
!! html/php |
| 540 |
<table> |
| 541 |
<tbody><tr> |
| 542 |
<th>a |
| 543 |
</th></tr><tr><td>b!!c</td></tr> |
| 544 |
</tbody></table> |
| 545 |
!! html/parsoid |
| 546 |
<table> |
| 547 |
<tbody><tr><th>a</th></tr> |
| 548 |
<tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr> |
| 549 |
</tbody></table> |
| 550 |
!! end |
| 551 |
|
| 552 |
!! test |
| 553 |
Accept empty attributes in td/th cells (td/th cells starting with leading ||) |
| 554 |
!! wikitext |
| 555 |
{| |
| 556 |
!|h1 |
| 557 |
||a |
| 558 |
|} |
| 559 |
!! html |
| 560 |
<table> |
| 561 |
<tbody><tr> |
| 562 |
<th>h1 |
| 563 |
</th> |
| 564 |
<td>a |
| 565 |
</td></tr></tbody></table> |
| 566 |
!! end |
| 567 |
|
| 568 |
!!test |
| 569 |
Accept "| !" at start of line in tables (ignore !-attribute) |
| 570 |
!! wikitext |
| 571 |
{| |
| 572 |
|- |
| 573 |
|!style="color:red"|bar |
| 574 |
|} |
| 575 |
!! html |
| 576 |
<table> |
| 577 |
|
| 578 |
<tbody><tr> |
| 579 |
<td>bar |
| 580 |
</td></tr></tbody></table> |
| 581 |
!!end |
| 582 |
|
| 583 |
!!test |
| 584 |
Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- |
| 585 |
!! wikitext |
| 586 |
{| |
| 587 |
|- |
| 588 |
|style='color:red;'|+1 |
| 589 |
|style='color:blue;'|-1 |
| 590 |
|- |
| 591 |
|1||2||3 |
| 592 |
|1||+2||-3 |
| 593 |
|- |
| 594 |
| +1 |
| 595 |
| -1 |
| 596 |
|} |
| 597 |
!! html |
| 598 |
<table> |
| 599 |
|
| 600 |
<tbody><tr> |
| 601 |
<td style="color:red;">+1 |
| 602 |
</td> |
| 603 |
<td style="color:blue;">-1 |
| 604 |
</td></tr> |
| 605 |
<tr> |
| 606 |
<td>1</td> |
| 607 |
<td>2</td> |
| 608 |
<td>3 |
| 609 |
</td> |
| 610 |
<td>1</td> |
| 611 |
<td>+2</td> |
| 612 |
<td>-3 |
| 613 |
</td></tr> |
| 614 |
<tr> |
| 615 |
<td>+1 |
| 616 |
</td> |
| 617 |
<td>-1 |
| 618 |
</td></tr></tbody></table> |
| 619 |
!!end |
| 620 |
|
| 621 |
# Differences between Parsoid and PHP re: trailing whitespace in a |
| 622 |
# table cell. |
| 623 |
!! test |
| 624 |
Table rowspan |
| 625 |
!! wikitext |
| 626 |
{| border=1 |
| 627 |
|Cell 1, row 1 |
| 628 |
|rowspan=2|Cell 2, row 1 (and 2) |
| 629 |
|Cell 3, row 1 |
| 630 |
|- |
| 631 |
|Cell 1, row 2 |
| 632 |
|Cell 3, row 2 |
| 633 |
|} |
| 634 |
!! html/php |
| 635 |
<table border="1"> |
| 636 |
<tbody><tr> |
| 637 |
<td>Cell 1, row 1 |
| 638 |
</td> |
| 639 |
<td rowspan="2">Cell 2, row 1 (and 2) |
| 640 |
</td> |
| 641 |
<td>Cell 3, row 1 |
| 642 |
</td></tr> |
| 643 |
<tr> |
| 644 |
<td>Cell 1, row 2 |
| 645 |
</td> |
| 646 |
<td>Cell 3, row 2 |
| 647 |
</td></tr></tbody></table> |
| 648 |
!! html/parsoid |
| 649 |
<table border="1"> |
| 650 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>Cell 1, row 1</td> |
| 651 |
<td rowspan="2">Cell 2, row 1 (and 2)</td> |
| 652 |
<td>Cell 3, row 1</td></tr> |
| 653 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 654 |
<td>Cell 1, row 2</td> |
| 655 |
<td>Cell 3, row 2</td></tr> |
| 656 |
</tbody></table> |
| 657 |
!! end |
| 658 |
|
| 659 |
!! test |
| 660 |
Nested table |
| 661 |
!! wikitext |
| 662 |
{| border=1 |
| 663 |
| α |
| 664 |
| |
| 665 |
{| bgcolor=#ABCDEF border=2 |
| 666 |
|nested |
| 667 |
|- |
| 668 |
|table |
| 669 |
|} |
| 670 |
|the original table again |
| 671 |
|} |
| 672 |
!! html |
| 673 |
<table border="1"> |
| 674 |
<tbody><tr> |
| 675 |
<td>α |
| 676 |
</td> |
| 677 |
<td> |
| 678 |
<table bgcolor="#ABCDEF" border="2"> |
| 679 |
<tbody><tr> |
| 680 |
<td>nested |
| 681 |
</td></tr> |
| 682 |
<tr> |
| 683 |
<td>table |
| 684 |
</td></tr></tbody></table> |
| 685 |
</td> |
| 686 |
<td>the original table again |
| 687 |
</td></tr></tbody></table> |
| 688 |
!! end |
| 689 |
|
| 690 |
!! test |
| 691 |
Invalid attributes in table cell (T3830) |
| 692 |
!! wikitext |
| 693 |
{| |
| 694 |
|Cell:|broken |
| 695 |
|} |
| 696 |
!! html |
| 697 |
<table> |
| 698 |
<tbody><tr> |
| 699 |
<td>broken |
| 700 |
</td></tr></tbody></table> |
| 701 |
!! end |
| 702 |
|
| 703 |
!! test |
| 704 |
Table cell attributes: Pipes protected by nowikis should be treated as a plain character |
| 705 |
!! wikitext |
| 706 |
{| |
| 707 |
|title="foo" |bar |
| 708 |
|title="foo<nowiki>|</nowiki>" |bar |
| 709 |
|title="foo<nowiki>|</nowiki>" bar |
| 710 |
|} |
| 711 |
!! html/php |
| 712 |
<table> |
| 713 |
<tbody><tr> |
| 714 |
<td title="foo">bar |
| 715 |
</td> |
| 716 |
<td title="foo|">bar |
| 717 |
</td> |
| 718 |
<td>title="foo|" bar |
| 719 |
</td></tr></tbody></table> |
| 720 |
!! html/parsoid |
| 721 |
<table> |
| 722 |
<tbody><tr><td title="foo">bar</td> |
| 723 |
<td title="foo|" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo<nowiki>|</nowiki>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"foo<span typeof=\"mw:Nowiki\" data-parsoid='{\"dsr\":[32,50,8,9]}'>|</span>"}]]}'>bar</td> |
| 724 |
<td>title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr> |
| 725 |
</tbody></table> |
| 726 |
!! end |
| 727 |
|
| 728 |
!! test |
| 729 |
Table cell attributes: Pipes protected by nested nowikis should be treated as a plain character |
| 730 |
!! wikitext |
| 731 |
{| |
| 732 |
|<code><nowiki>{{ACB|PG}}</nowiki></code> |
| 733 |
|} |
| 734 |
!! html/php |
| 735 |
<table> |
| 736 |
<tbody><tr> |
| 737 |
<td><code>{{ACB|PG}}</code> |
| 738 |
</td></tr></tbody></table> |
| 739 |
!! html/parsoid |
| 740 |
<table> |
| 741 |
<tbody><tr><td><code><span typeof="mw:Nowiki">{{ACB|PG}}</span></code></td></tr> |
| 742 |
</tbody></table> |
| 743 |
!! end |
| 744 |
|
| 745 |
# See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html |
| 746 |
# N.B. The "|}" to close the table is missing from the input, so parsoid's |
| 747 |
# *2wt modes will fail. |
| 748 |
!! test |
| 749 |
Table security: embedded pipes |
| 750 |
!! options |
| 751 |
parsoid=wt2html,html2html |
| 752 |
!! wikitext |
| 753 |
{| |
| 754 |
| |[ftp://|x||]" onmouseover="alert(document.cookie)">test |
| 755 |
!! html/php |
| 756 |
<table> |
| 757 |
<tbody><tr> |
| 758 |
<td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td> |
| 759 |
<td>]" onmouseover="alert(document.cookie)">test |
| 760 |
</td> |
| 761 |
</tr> |
| 762 |
</tbody></table> |
| 763 |
!! html/parsoid |
| 764 |
<table><tbody> |
| 765 |
<tr> |
| 766 |
<td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|"}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" class="external free" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row"}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table> |
| 767 |
!! end |
| 768 |
|
| 769 |
!! test |
| 770 |
Element attributes with double ! should not be broken up by <th> |
| 771 |
!! wikitext |
| 772 |
{| |
| 773 |
!hi <div class="!!">ha</div> ho |
| 774 |
|} |
| 775 |
!! html/php |
| 776 |
<table> |
| 777 |
<tbody><tr> |
| 778 |
<th>hi <div class="!!">ha</div> ho |
| 779 |
</th></tr></tbody></table> |
| 780 |
!! html/parsoid |
| 781 |
<table> |
| 782 |
<tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr> |
| 783 |
</tbody></table> |
| 784 |
!! end |
| 785 |
|
| 786 |
!! test |
| 787 |
! and || in element attributes should not be parsed as <th>/<td> |
| 788 |
!! wikitext |
| 789 |
{| |
| 790 |
|<div style="color: red !important;" data-contrived="put this here ||">hi</div> |
| 791 |
|} |
| 792 |
!! html/php |
| 793 |
<table> |
| 794 |
<tbody><tr> |
| 795 |
<td><div style="color: red !important;" data-contrived="put this here ||">hi</div> |
| 796 |
</td></tr></tbody></table> |
| 797 |
!! html/parsoid |
| 798 |
<table> |
| 799 |
<tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr> |
| 800 |
</tbody></table> |
| 801 |
!! end |
| 802 |
|
| 803 |
# FIXME: The output seems broken. Filed as T110268. |
| 804 |
!! test |
| 805 |
! and || in td attributes should not be parsed as <th>/<td> |
| 806 |
!! options |
| 807 |
parsoid=wt2html |
| 808 |
!! wikitext |
| 809 |
{| |
| 810 |
|style="color: red !important;" data-contrived="put this here ||"|foo |
| 811 |
|} |
| 812 |
!! html/php |
| 813 |
<table> |
| 814 |
<tbody><tr> |
| 815 |
<td>style="color: red !important;" data-contrived="put this here</td> |
| 816 |
<td>foo |
| 817 |
</td></tr></tbody></table> |
| 818 |
!! html/parsoid |
| 819 |
<table> |
| 820 |
<tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""}}'>foo</td></tr> |
| 821 |
</tbody></table> |
| 822 |
!! end |
| 823 |
|
| 824 |
## We don't support roundtripping of these attributes in Parsoid. |
| 825 |
## Selective serialization takes care of preventing dirty diffs. |
| 826 |
## But, on edits, we dirty-diff the invalid attribute text. |
| 827 |
!! test |
| 828 |
Invalid text in table attributes should be discarded |
| 829 |
!! options |
| 830 |
parsoid=wt2html |
| 831 |
!! wikitext |
| 832 |
{| <span>boo</span> style='border:1px solid black' |
| 833 |
| <span>boo</span> style='color:blue' |1 |
| 834 |
|<span>boo</span> style='color:blue'|2 |
| 835 |
|} |
| 836 |
!! html/php |
| 837 |
<table style="border:1px solid black"> |
| 838 |
<tbody><tr> |
| 839 |
<td style="color:blue">1 |
| 840 |
</td> |
| 841 |
<td style="color:blue">2 |
| 842 |
</td></tr></tbody></table> |
| 843 |
!! html/parsoid |
| 844 |
<table style="border:1px solid black"> |
| 845 |
<tr> |
| 846 |
<td style="color:blue">1</td> |
| 847 |
<td style="color:blue">2</td> |
| 848 |
</tr> |
| 849 |
</table> |
| 850 |
!! end |
| 851 |
|
| 852 |
!! test |
| 853 |
Invalid text in table attributes should be preserved by selective serializer |
| 854 |
!! options |
| 855 |
parsoid={ |
| 856 |
"modes": [ "selser" ], |
| 857 |
"changes": [ |
| 858 |
["td:first-child", "text", "abc"], |
| 859 |
["td + td", "text", "xyz"] |
| 860 |
] |
| 861 |
} |
| 862 |
!! wikitext |
| 863 |
{| <span>boo</span> style='border:1px solid black' |
| 864 |
| <span>boo</span> style='color:blue' | 1 |
| 865 |
|<span>boo</span> style='color:blue'| 2 |
| 866 |
|} |
| 867 |
!! wikitext/edited |
| 868 |
{| <span>boo</span> style='border:1px solid black' |
| 869 |
| <span>boo</span> style='color:blue' | abc |
| 870 |
|<span>boo</span> style='color:blue'| xyz |
| 871 |
|} |
| 872 |
!! end |
| 873 |
|
| 874 |
!! test |
| 875 |
1. Template-generated table cell attributes and cell content |
| 876 |
!! wikitext |
| 877 |
{| |
| 878 |
|{{table_attribs}} |
| 879 |
| {{table_attribs}} |
| 880 |
|| {{table_attribs_5}} |
| 881 |
| <!--foo--> <!--bar--> <!--baz--> {{table_attribs}} |
| 882 |
|align=center {{table_attribs}} |
| 883 |
| <!--foo--> align=center <!--bar--> {{table_attribs}} |
| 884 |
|} |
| 885 |
!! html |
| 886 |
<table> |
| 887 |
<tbody><tr> |
| 888 |
<td style="color:red;">Foo |
| 889 |
</td> |
| 890 |
<td style="color:red;">Foo |
| 891 |
</td> |
| 892 |
<td>style="color:red;"</td> |
| 893 |
<td>Bar |
| 894 |
</td> |
| 895 |
<td style="color:red;">Foo |
| 896 |
</td> |
| 897 |
<td align="center" style="color:red;">Foo |
| 898 |
</td> |
| 899 |
<td align="center" style="color:red;">Foo |
| 900 |
</td></tr></tbody></table> |
| 901 |
!! end |
| 902 |
|
| 903 |
# This test introduces a newline in a fosterable position which tangentially |
| 904 |
# tests template-wrapping behavior more explicitly tested by the # next test |
| 905 |
# ("2b: Delete ..."). |
| 906 |
!! test |
| 907 |
2a. Template-generated table cell attributes and cell content |
| 908 |
!! wikitext |
| 909 |
{| |
| 910 |
|{{table_attribs_2}} |
| 911 |
|} |
| 912 |
!! html/php |
| 913 |
<table> |
| 914 |
<tbody><tr> |
| 915 |
<td data-sort-value="" style="color:red;">Foo |
| 916 |
</td> |
| 917 |
<td>Bar</td> |
| 918 |
<td>Baz |
| 919 |
</td></tr></tbody></table> |
| 920 |
!! html/parsoid |
| 921 |
<table> |
| 922 |
<tbody><tr><td about="#mwt1" typeof="mw:Transclusion" data-sort-value="" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr> |
| 923 |
</tbody></table> |
| 924 |
!! end |
| 925 |
|
| 926 |
!! test |
| 927 |
2b: Delete whitespace/comments if found in fosterable position while template-wrapping |
| 928 |
!! options |
| 929 |
!! wikitext |
| 930 |
<table> |
| 931 |
<tr> |
| 932 |
<td>hi</td> |
| 933 |
{{1x|<td>ho</td> |
| 934 |
<!--comment--> |
| 935 |
<td>hi</td>}} |
| 936 |
<td>ho</td> |
| 937 |
</tr> |
| 938 |
</table> |
| 939 |
!! html/parsoid |
| 940 |
<table data-parsoid='{"stx":"html"}'> |
| 941 |
<tbody><tr> |
| 942 |
<td data-parsoid='{"stx":"html"}'>hi</td> |
| 943 |
<td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<td>ho</td>\n<!--comment-->\n<td>hi</td>"}},"i":0}}]}'>ho</td><td about="#mwt1">hi</td> |
| 944 |
<td>ho</td> |
| 945 |
</tr> |
| 946 |
</tbody></table> |
| 947 |
!! end |
| 948 |
|
| 949 |
!! test |
| 950 |
3. Template-generated table cell attributes and cell content |
| 951 |
!! wikitext |
| 952 |
{| |
| 953 |
!align=center {{table_header_cells}} |
| 954 |
|- |
| 955 |
|align=center {{table_cells}} |
| 956 |
|} |
| 957 |
!! html/php |
| 958 |
<table> |
| 959 |
<tbody><tr> |
| 960 |
<th align="center" style="color:red;">Foo</th> |
| 961 |
<th style="color:red;"><i>Bar</i></th> |
| 962 |
<th style="color:brown;"><i>Foo</i> and Baz |
| 963 |
</th></tr> |
| 964 |
<tr> |
| 965 |
<td align="center" style="color:red;">Foo</td> |
| 966 |
<td style="color:red;"><i>Bar</i></td> |
| 967 |
<td style="color:brown;"><i>Foo</i> and Baz |
| 968 |
</td></tr></tbody></table> |
| 969 |
!! html/parsoid |
| 970 |
<table> |
| 971 |
<tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr> |
| 972 |
<td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr> |
| 973 |
</tbody></table> |
| 974 |
!! end |
| 975 |
|
| 976 |
!! test |
| 977 |
4. Template-generated table cell attributes and cell content inside a templated table |
| 978 |
!! wikitext |
| 979 |
{{tbl-start}} |
| 980 |
!align=center {{table_header_cells}} |
| 981 |
|- |
| 982 |
|align=center {{table_cells}} |
| 983 |
{{tbl-end}} |
| 984 |
!! html/php |
| 985 |
<table> |
| 986 |
<tbody><tr> |
| 987 |
<th align="center" style="color:red;">Foo</th> |
| 988 |
<th style="color:red;"><i>Bar</i></th> |
| 989 |
<th style="color:brown;"><i>Foo</i> and Baz |
| 990 |
</th></tr> |
| 991 |
<tr> |
| 992 |
<td align="center" style="color:red;">Foo</td> |
| 993 |
<td style="color:red;"><i>Bar</i></td> |
| 994 |
<td style="color:brown;"><i>Foo</i> and Baz |
| 995 |
</td></tr></tbody></table> |
| 996 |
!! html/parsoid |
| 997 |
<table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'> |
| 998 |
<tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr> |
| 999 |
<tr> |
| 1000 |
<td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr> |
| 1001 |
</tbody></table> |
| 1002 |
!! end |
| 1003 |
|
| 1004 |
!! test |
| 1005 |
Table with row followed by newlines and table heading |
| 1006 |
!! options |
| 1007 |
parsoid=wt2html,html2html |
| 1008 |
!! wikitext |
| 1009 |
{| |
| 1010 |
|- |
| 1011 |
|
| 1012 |
!foo |
| 1013 |
|} |
| 1014 |
!! html/* |
| 1015 |
<table> |
| 1016 |
|
| 1017 |
|
| 1018 |
<tbody><tr> |
| 1019 |
<th>foo |
| 1020 |
</th></tr></tbody></table> |
| 1021 |
!! end |
| 1022 |
|
| 1023 |
!! test |
| 1024 |
Table with empty line following the start tag |
| 1025 |
!! options |
| 1026 |
parsoid=wt2html,html2html |
| 1027 |
!! wikitext |
| 1028 |
{| |
| 1029 |
|
| 1030 |
|- |
| 1031 |
|foo |
| 1032 |
|} |
| 1033 |
!! html/* |
| 1034 |
<table> |
| 1035 |
|
| 1036 |
|
| 1037 |
<tbody><tr> |
| 1038 |
<td>foo |
| 1039 |
</td></tr></tbody></table> |
| 1040 |
!! end |
| 1041 |
|
| 1042 |
!! test |
| 1043 |
Table attributes with empty value |
| 1044 |
!! options |
| 1045 |
parsoid=wt2html,html2html |
| 1046 |
!! wikitext |
| 1047 |
{| |
| 1048 |
| style=|hello |
| 1049 |
|} |
| 1050 |
!! html/php |
| 1051 |
<table> |
| 1052 |
<tbody><tr> |
| 1053 |
<td style="">hello |
| 1054 |
</td></tr></tbody></table> |
| 1055 |
!! html/parsoid |
| 1056 |
<table> |
| 1057 |
<tbody><tr><td style="">hello</td></tr> |
| 1058 |
</tbody></table> |
| 1059 |
!! end |
| 1060 |
|
| 1061 |
!! test |
| 1062 |
Wikitext table with a lot of comments |
| 1063 |
!! wikitext |
| 1064 |
{| |
| 1065 |
<!-- c0 --> |
| 1066 |
|foo |
| 1067 |
<!-- c1 --> |
| 1068 |
|-<!-- c2 --> |
| 1069 |
<!-- c3 --> |
| 1070 |
|<!-- c4 --> |
| 1071 |
<!-- c5 --> |
| 1072 |
|} |
| 1073 |
!! html |
| 1074 |
<table> |
| 1075 |
<tbody><tr> |
| 1076 |
<td>foo |
| 1077 |
</td></tr> |
| 1078 |
<tr> |
| 1079 |
<td> |
| 1080 |
</td></tr></tbody></table> |
| 1081 |
!! end |
| 1082 |
|
| 1083 |
!! test |
| 1084 |
Wikitext table comments represented in parsoid dom |
| 1085 |
!! wikitext |
| 1086 |
{|<!--c1--><!--c2--> |
| 1087 |
|-<!--c3--> |
| 1088 |
|x |
| 1089 |
|} |
| 1090 |
!! html/php |
| 1091 |
<table> |
| 1092 |
|
| 1093 |
<tbody><tr> |
| 1094 |
<td>x |
| 1095 |
</td></tr></tbody></table> |
| 1096 |
!! html/parsoid |
| 1097 |
<table><!--c1--><!--c2--> |
| 1098 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'><!--c3--> |
| 1099 |
<td data-parsoid='{}'>x</td></tr> |
| 1100 |
</tbody></table> |
| 1101 |
!! end |
| 1102 |
|
| 1103 |
!! test |
| 1104 |
Wikitext table with double-line table cell |
| 1105 |
!! wikitext |
| 1106 |
{| |
| 1107 |
|a |
| 1108 |
b |
| 1109 |
|} |
| 1110 |
!! html |
| 1111 |
<table> |
| 1112 |
<tbody><tr> |
| 1113 |
<td>a |
| 1114 |
<p>b |
| 1115 |
</p> |
| 1116 |
</td></tr></tbody></table> |
| 1117 |
!! end |
| 1118 |
|
| 1119 |
!! test |
| 1120 |
Table cell with a single comment |
| 1121 |
!! wikitext |
| 1122 |
{| |
| 1123 |
|<!-- c1 --> |
| 1124 |
|a |
| 1125 |
|} |
| 1126 |
!! html |
| 1127 |
<table> |
| 1128 |
<tbody><tr> |
| 1129 |
<td> |
| 1130 |
</td> |
| 1131 |
<td>a |
| 1132 |
</td></tr></tbody></table> |
| 1133 |
!! end |
| 1134 |
|
| 1135 |
!! test |
| 1136 |
Table-cell after a comment-only-empty-line |
| 1137 |
!! wikitext |
| 1138 |
{| |
| 1139 |
|a |
| 1140 |
<!--c1--> |
| 1141 |
<!--c2-->|b |
| 1142 |
|} |
| 1143 |
!! html |
| 1144 |
<table> |
| 1145 |
<tbody><tr> |
| 1146 |
<td>a |
| 1147 |
</td> |
| 1148 |
<td>b |
| 1149 |
</td></tr></tbody></table> |
| 1150 |
!! html/parsoid |
| 1151 |
<table> |
| 1152 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td data-parsoid='{}'>a |
| 1153 |
<!--c1--> |
| 1154 |
<!--c2--></td><td data-parsoid='{}'>b</td></tr> |
| 1155 |
</tbody></table> |
| 1156 |
!! end |
| 1157 |
|
| 1158 |
!! test |
| 1159 |
Build table with {{!}} |
| 1160 |
!! wikitext |
| 1161 |
{{{!}} class="wikitable" |
| 1162 |
!header |
| 1163 |
!second header |
| 1164 |
{{!}}- style="color:red;" |
| 1165 |
{{!}}data{{!}}{{!}} style="color:red;" {{!}}second data |
| 1166 |
{{!}}} |
| 1167 |
!! html |
| 1168 |
<table class="wikitable"> |
| 1169 |
<tbody><tr> |
| 1170 |
<th>header |
| 1171 |
</th> |
| 1172 |
<th>second header |
| 1173 |
</th></tr> |
| 1174 |
<tr style="color:red;"> |
| 1175 |
<td>data</td> |
| 1176 |
<td style="color:red;">second data |
| 1177 |
</td></tr></tbody></table> |
| 1178 |
!! end |
| 1179 |
|
| 1180 |
!! test |
| 1181 |
Build table with pipe as data |
| 1182 |
!! wikitext |
| 1183 |
{| class="wikitable" |
| 1184 |
!header |
| 1185 |
!second header |
| 1186 |
|- style="color:red;" |
| 1187 |
|data|| style="color:red;" |second data |
| 1188 |
|- |
| 1189 |
| style="color:red;" |data with | || style="color:red;" | second data with | |
| 1190 |
|- |
| 1191 |
||data with | |||second data with | |
| 1192 |
|} |
| 1193 |
!! html |
| 1194 |
<table class="wikitable"> |
| 1195 |
<tbody><tr> |
| 1196 |
<th>header |
| 1197 |
</th> |
| 1198 |
<th>second header |
| 1199 |
</th></tr> |
| 1200 |
<tr style="color:red;"> |
| 1201 |
<td>data</td> |
| 1202 |
<td style="color:red;">second data |
| 1203 |
</td></tr> |
| 1204 |
<tr> |
| 1205 |
<td style="color:red;">data with |</td> |
| 1206 |
<td style="color:red;">second data with | |
| 1207 |
</td></tr> |
| 1208 |
<tr> |
| 1209 |
<td>data with |</td> |
| 1210 |
<td>second data with | |
| 1211 |
</td></tr></tbody></table> |
| 1212 |
!! end |
| 1213 |
|
| 1214 |
!! test |
| 1215 |
Build table with wikilink |
| 1216 |
!! wikitext |
| 1217 |
{| class="wikitable" |
| 1218 |
!header||second header |
| 1219 |
|- style="color:red;" |
| 1220 |
|data [[Main Page|linktext]]||second data [[Main Page|linktext]] |
| 1221 |
|- |
| 1222 |
|data||second data [[Main Page|link|text with pipe]] |
| 1223 |
|} |
| 1224 |
!! html |
| 1225 |
<table class="wikitable"> |
| 1226 |
<tbody><tr> |
| 1227 |
<th>header</th> |
| 1228 |
<th>second header |
| 1229 |
</th></tr> |
| 1230 |
<tr style="color:red;"> |
| 1231 |
<td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td> |
| 1232 |
<td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a> |
| 1233 |
</td></tr> |
| 1234 |
<tr> |
| 1235 |
<td>data</td> |
| 1236 |
<td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a> |
| 1237 |
</td></tr></tbody></table> |
| 1238 |
!! end |
| 1239 |
|
| 1240 |
# The expected HTML structure in this test is debatable. The PHP parser does |
| 1241 |
# not parse this kind of table at all. The main focus for Parsoid is on |
| 1242 |
# round-tripping, so this output is ok for now. TODO: revisit! |
| 1243 |
!! test |
| 1244 |
Wikitext table with html-syntax row |
| 1245 |
!! wikitext |
| 1246 |
{| |
| 1247 |
|- |
| 1248 |
<td>foo</td> |
| 1249 |
|} |
| 1250 |
!! html/parsoid |
| 1251 |
<table> |
| 1252 |
<tbody> |
| 1253 |
<tr> |
| 1254 |
<td>foo</td></tr></tbody></table> |
| 1255 |
!! end |
| 1256 |
|
| 1257 |
## Remex doesn't account for fostered content. |
| 1258 |
!! test |
| 1259 |
Fostered content in tables: Plain text |
| 1260 |
!! options |
| 1261 |
parsoid=wt2html |
| 1262 |
!! wikitext |
| 1263 |
{| |
| 1264 |
|- |
| 1265 |
a |
| 1266 |
|} |
| 1267 |
!! html/php |
| 1268 |
|
| 1269 |
|
| 1270 |
a |
| 1271 |
<table></table> |
| 1272 |
!! html/parsoid |
| 1273 |
<p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> |
| 1274 |
a</p> |
| 1275 |
<table> |
| 1276 |
<tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table> |
| 1277 |
!! end |
| 1278 |
|
| 1279 |
# selser tests are needed below as a regression test for T233815 |
| 1280 |
# they also demonstrate DSR errors in fostered content (T254412) |
| 1281 |
!! test |
| 1282 |
Fostered content in tables: Lists |
| 1283 |
!! options |
| 1284 |
parsoid={ "modes": ["wt2html","selser"], "suppressErrors": true } |
| 1285 |
!! wikitext |
| 1286 |
{| |
| 1287 |
|- |
| 1288 |
*a |
| 1289 |
*b |
| 1290 |
|} |
| 1291 |
!! html/php |
| 1292 |
<ul><li>a</li> |
| 1293 |
<li>b</li></ul><table> |
| 1294 |
|
| 1295 |
|
| 1296 |
</table> |
| 1297 |
!! html/parsoid |
| 1298 |
<ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li><li>b</li></ul><table> |
| 1299 |
<tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'> |
| 1300 |
|
| 1301 |
</tr></tbody></table> |
| 1302 |
!! end |
| 1303 |
|
| 1304 |
!! test |
| 1305 |
Template generated table cell with attributes |
| 1306 |
!! wikitext |
| 1307 |
{| |
| 1308 |
|- |
| 1309 |
{{table_attribs_4}} ||a||b |
| 1310 |
|} |
| 1311 |
!! html/php |
| 1312 |
<table> |
| 1313 |
|
| 1314 |
<tbody><tr> |
| 1315 |
<td style="background-color:#DC241f;" width="10px"></td> |
| 1316 |
<td>a</td> |
| 1317 |
<td>b |
| 1318 |
</td></tr></tbody></table> |
| 1319 |
!! html/parsoid |
| 1320 |
<table> |
| 1321 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1322 |
<td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr> |
| 1323 |
</tbody></table> |
| 1324 |
!! end |
| 1325 |
|
| 1326 |
## FIXME: The only difference between the standalone & integrated modes |
| 1327 |
## is the ordering of attributes. This could perhaps be fixed differently |
| 1328 |
## in the test runner. |
| 1329 |
!! test |
| 1330 |
Templated table cell with untemplated attributes: Cell combination tests |
| 1331 |
!! wikitext |
| 1332 |
{| |
| 1333 |
|- |
| 1334 |
!class="test"{{table_cell_content|attr=! align=left}} /* th & th combine */ |
| 1335 |
|- |
| 1336 |
|class="test"{{table_cell_content}} /* td & td combine */ |
| 1337 |
|- |
| 1338 |
!class="test"{{table_cell_content}} /* th & td combine */ |
| 1339 |
|- |
| 1340 |
|class="test"{{table_cell_content|attr=! align=left}} /* td & th combine */ |
| 1341 |
|- |
| 1342 |
|class="test"{{table_cell_content|attr=style='color:red;'}} |
| 1343 |
|- |
| 1344 |
|class="test"{{table_cell_content|cmt=<!--bar-->}} |
| 1345 |
|} |
| 1346 |
!! html/php |
| 1347 |
<table> |
| 1348 |
|
| 1349 |
<tbody><tr> |
| 1350 |
<th class="test" align="left">foo /* th & th combine */ |
| 1351 |
</th></tr> |
| 1352 |
<tr> |
| 1353 |
<td class="test">foo /* td & td combine */ |
| 1354 |
</td></tr> |
| 1355 |
<tr> |
| 1356 |
<th class="test">foo /* th & td combine */ |
| 1357 |
</th></tr> |
| 1358 |
<tr> |
| 1359 |
<td class="test" align="left">foo /* td & th combine */ |
| 1360 |
</td></tr> |
| 1361 |
<tr> |
| 1362 |
<td class="test" style="color:red;">foo |
| 1363 |
</td></tr> |
| 1364 |
<tr> |
| 1365 |
<td class="test">foo |
| 1366 |
</td></tr></tbody></table> |
| 1367 |
!! html/parsoid+standalone |
| 1368 |
<table> |
| 1369 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1370 |
<th class="test" align="left" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"! align=left"}},"i":0}}," /* th & th combine */"]}'>foo /* th & th combine */</th></tr> |
| 1371 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1372 |
<td class="test" typeof="mw:Transclusion" about="#mwt2" data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{},"i":0}}," /* td & td combine */"]}'>foo /* td & td combine */</td></tr> |
| 1373 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1374 |
<th class="test" typeof="mw:Transclusion" about="#mwt3" data-mw='{"parts":["!class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{},"i":0}}," /* th & td combine */"]}'>foo /* th & td combine */</th></tr> |
| 1375 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1376 |
<td class="test" align="left" about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"! align=left"}},"i":0}}," /* td & th combine */"]}'>foo /* td & th combine */</td> |
| 1377 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1378 |
<td class="test" style="color:red;" typeof="mw:Transclusion" about="#mwt5" data-parsoid='{"pi":[[{"k":"attr","named":true}]]}' data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"style='color:red;'"}},"i":0}}]}'>foo</td></tr> |
| 1379 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1380 |
<td class="test" typeof="mw:Transclusion" about="#mwt6" data-parsoid='{"pi":[[{"k":"cmt","named":true}]]}' data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"cmt":{"wt":"<!--bar-->"}},"i":0}}]}'>foo</td></tr> |
| 1381 |
</tbody></table> |
| 1382 |
!! html/parsoid+integrated |
| 1383 |
<table> |
| 1384 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1385 |
<th align="left" typeof="mw:Transclusion" class="test" about="#mwt1" data-mw='{"parts":["!class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"! align=left"}},"i":0}}," /* th & th combine */"]}'>foo /* th & th combine */</th></tr> |
| 1386 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1387 |
<td typeof="mw:Transclusion" class="test" about="#mwt2" data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{},"i":0}}," /* td & td combine */"]}'>foo /* td & td combine */</td></tr> |
| 1388 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1389 |
<th typeof="mw:Transclusion" class="test" about="#mwt3" data-mw='{"parts":["!class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{},"i":0}}," /* th & td combine */"]}'>foo /* th & td combine */</th></tr> |
| 1390 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1391 |
<td align="left" typeof="mw:Transclusion" class="test" about="#mwt4" data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"! align=left"}},"i":0}}," /* td & th combine */"]}'>foo /* td & th combine */</td> |
| 1392 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1393 |
<td class="test" style="color:red;" typeof="mw:Transclusion" about="#mwt5" data-parsoid='{"pi":[[{"k":"attr","named":true}]]}' data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"style='color:red;'"}},"i":0}}]}'>foo</td></tr> |
| 1394 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 1395 |
<td typeof="mw:Transclusion" class="test" about="#mwt6" data-parsoid='{"pi":[[{"k":"cmt","named":true}]]}' data-mw='{"parts":["|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"cmt":{"wt":"<!--bar-->"}},"i":0}}]}'>foo</td></tr> |
| 1396 |
</tbody></table> |
| 1397 |
!! end |
| 1398 |
|
| 1399 |
# The failure in T343874 is only exercised in integrated mode |
| 1400 |
!! test |
| 1401 |
T343874: Templated table that has a templated cell with untemplated attributes |
| 1402 |
!! options |
| 1403 |
parsoid=wt2html |
| 1404 |
!! wikitext |
| 1405 |
{{tbl-start}} |
| 1406 |
|- |
| 1407 |
|class="test"{{table_cell_content}} |
| 1408 |
|- |
| 1409 |
|class="test"{{table_cell_content|attr=! align=left}} |
| 1410 |
{{tbl-end}} |
| 1411 |
!! html/php |
| 1412 |
<table> |
| 1413 |
|
| 1414 |
<tbody><tr> |
| 1415 |
<td class="test">foo |
| 1416 |
</td></tr> |
| 1417 |
<tr> |
| 1418 |
<td class="test" align="left">foo |
| 1419 |
</td></tr></tbody></table> |
| 1420 |
!! html/parsoid+integrated |
| 1421 |
<table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|-\n|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{},"i":1}},"\n|-\n|class=\"test\"",{"template":{"target":{"wt":"table_cell_content","href":"./Template:Table_cell_content"},"params":{"attr":{"wt":"! align=left"}},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'> |
| 1422 |
<tbody> |
| 1423 |
<tr><td class="test">foo</td></tr> |
| 1424 |
<tr><td align="left" class="test">foo</td></tr> |
| 1425 |
</tbody></table> |
| 1426 |
!! end |
| 1427 |
|
| 1428 |
!! test |
| 1429 |
Templated table cell with untemplated attributes: Regression tests |
| 1430 |
!! wikitext |
| 1431 |
{| |
| 1432 |
|class="foo" |
| 1433 |
{{1x|1={{!}}bar}} |
| 1434 |
|} |
| 1435 |
!! html/php |
| 1436 |
<table> |
| 1437 |
<tbody><tr> |
| 1438 |
<td>class="foo" |
| 1439 |
</td> |
| 1440 |
<td>bar |
| 1441 |
</td></tr></tbody></table> |
| 1442 |
!! html/parsoid |
| 1443 |
<table> |
| 1444 |
<tbody><tr> |
| 1445 |
<td>class="foo"</td> |
| 1446 |
<td about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{!}}bar"}},"i":0}}]}'>bar</td></tr> |
| 1447 |
</tbody></table> |
| 1448 |
|
| 1449 |
!! end |
| 1450 |
|
| 1451 |
!! test |
| 1452 |
Templated table cell with untemplated attributes: Unsupported (standalone mode) Scenarios |
| 1453 |
!! options |
| 1454 |
parsoid=wt2html |
| 1455 |
!! wikitext |
| 1456 |
{| |
| 1457 |
|- |
| 1458 |
|class="foo"{{1x|1= {{!}}bar}} |
| 1459 |
|- |
| 1460 |
|class="foo"{{1x|1= {{!}}bar}} |
| 1461 |
|} |
| 1462 |
!! html/php |
| 1463 |
<table> |
| 1464 |
|
| 1465 |
<tbody><tr> |
| 1466 |
<td class="foo">bar |
| 1467 |
</td></tr> |
| 1468 |
<tr> |
| 1469 |
<td class="foo">bar |
| 1470 |
</td></tr></tbody></table> |
| 1471 |
!! html/parsoid+standalone |
| 1472 |
This test fails both the two table cell scenarios for different reasons |
| 1473 |
because of differences how preprocessing works in standalone mode. |
| 1474 |
We don't intend to support this here. |
| 1475 |
!! html/parsoid+integrated |
| 1476 |
<table> |
| 1477 |
<tbody><tr> |
| 1478 |
<td about="#mwt1" typeof="mw:Transclusion" class="foo" data-mw='{"parts":["|class=\"foo\"",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"{{!}}bar"}},"i":0}}]}'>bar</td></tr> |
| 1479 |
<tr> |
| 1480 |
<td class="foo" typeof="mw:Transclusion" about="#mwt2" data-mw='{"parts":["|class=\"foo\"",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"&nbsp;{{!}}bar"}},"i":0}}]}'>bar</td></tr> |
| 1481 |
</tbody></table> |
| 1482 |
!! end |
| 1483 |
|
| 1484 |
!! test |
| 1485 |
Templated table cell with untemplated attributes: Unsupported Scenario |
| 1486 |
!! options |
| 1487 |
parsoid=wt2html |
| 1488 |
!! wikitext |
| 1489 |
{| |
| 1490 |
|- |
| 1491 |
|class="foo"{{1x|1={{!}}title="fail"{{!}}bar}} |
| 1492 |
|} |
| 1493 |
!! html/php |
| 1494 |
<table> |
| 1495 |
|
| 1496 |
<tbody><tr> |
| 1497 |
<td class="foo">title="fail"|bar |
| 1498 |
</td></tr></tbody></table> |
| 1499 |
!! html/parsoid |
| 1500 |
For now, we are deliberately not supporting this use cases in Parsoid unless |
| 1501 |
required or we find a simpler solution that covers everything uniformly. |
| 1502 |
!! end |
| 1503 |
|
| 1504 |
!! test |
| 1505 |
Parsoid: Round-trip tables directly followed by content (T53219) |
| 1506 |
!! options |
| 1507 |
parsoid=wt2html,wt2wt |
| 1508 |
!! wikitext |
| 1509 |
{| |
| 1510 |
|foo |
| 1511 |
|} bar |
| 1512 |
|
| 1513 |
{| |
| 1514 |
|baz |
| 1515 |
|}<b>quux</b> |
| 1516 |
!! html/php |
| 1517 |
<table> |
| 1518 |
<tbody><tr> |
| 1519 |
<td>foo |
| 1520 |
</td></tr></tbody></table><p> bar |
| 1521 |
</p><table> |
| 1522 |
<tbody><tr> |
| 1523 |
<td>baz |
| 1524 |
</td></tr></tbody></table><p><b>quux</b></p> |
| 1525 |
!! html/parsoid |
| 1526 |
<table> |
| 1527 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>foo</td></tr> |
| 1528 |
</tbody></table><p> bar</p> |
| 1529 |
|
| 1530 |
<table> |
| 1531 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>baz</td></tr> |
| 1532 |
</tbody></table><p><b data-parsoid='{"stx":"html"}'>quux</b></p> |
| 1533 |
!! end |
| 1534 |
|
| 1535 |
!! test |
| 1536 |
Parsoid: Default to a newline after tables in new content (T53219) |
| 1537 |
!! options |
| 1538 |
parsoid=html2wt |
| 1539 |
!! html/parsoid |
| 1540 |
<table><tbody> |
| 1541 |
<tr><td>foo</td></tr></tbody></table> bar |
| 1542 |
<table><tbody> |
| 1543 |
<tr><td>baz</td></tr></tbody></table><b>quux</b> |
| 1544 |
!! wikitext |
| 1545 |
{| |
| 1546 |
|foo |
| 1547 |
|} |
| 1548 |
bar |
| 1549 |
{| |
| 1550 |
|baz |
| 1551 |
|} |
| 1552 |
'''quux''' |
| 1553 |
!! end |
| 1554 |
|
| 1555 |
!! test |
| 1556 |
Parsoid: Row-syntax table headings followed by comment & table cells |
| 1557 |
!! options |
| 1558 |
parsoid=wt2html,wt2wt |
| 1559 |
!! wikitext |
| 1560 |
{| |
| 1561 |
!foo||bar |
| 1562 |
<!-- foo --> ||baz||quux |
| 1563 |
|} |
| 1564 |
!! html/php |
| 1565 |
<table> |
| 1566 |
<tbody><tr> |
| 1567 |
<th>foo</th> |
| 1568 |
<th>bar |
| 1569 |
</th> |
| 1570 |
<td>baz</td> |
| 1571 |
<td>quux |
| 1572 |
</td></tr></tbody></table> |
| 1573 |
!! html/parsoid |
| 1574 |
<table> |
| 1575 |
<tbody><tr><th>foo</th><th>bar |
| 1576 |
<!-- foo --></th><td> baz </td><td>quux</td></tr> |
| 1577 |
</tbody></table> |
| 1578 |
!! end |
| 1579 |
|
| 1580 |
!!test |
| 1581 |
Parsoid: Recover better from broken table attributes |
| 1582 |
!!options |
| 1583 |
parsoid=wt2html |
| 1584 |
!!wikitext |
| 1585 |
{| class="foo |
| 1586 |
| class="bar" | |
| 1587 |
foo |
| 1588 |
|} |
| 1589 |
!!html/php |
| 1590 |
<table class="foo"> |
| 1591 |
<tbody><tr> |
| 1592 |
<td class="bar"> |
| 1593 |
<p>foo |
| 1594 |
</p> |
| 1595 |
</td></tr></tbody></table> |
| 1596 |
!!html/parsoid |
| 1597 |
<table class="foo"> |
| 1598 |
<tr> |
| 1599 |
<td class="bar"> |
| 1600 |
<p>foo</p></td></tr> |
| 1601 |
</tbody></table> |
| 1602 |
!!end |
| 1603 |
|
| 1604 |
# Note: PHP parser omits empty rows |
| 1605 |
!! test |
| 1606 |
Tables: Digest broken attributes on table and tr tag |
| 1607 |
!! options |
| 1608 |
parsoid=wt2html |
| 1609 |
!! wikitext |
| 1610 |
{| || |} ++ |
| 1611 |
|- || || ++ -- |
| 1612 |
|- > [ |
| 1613 |
|} |
| 1614 |
!! html/php |
| 1615 |
<table> |
| 1616 |
|
| 1617 |
|
| 1618 |
</table> |
| 1619 |
!! html/parsoid |
| 1620 |
<table> |
| 1621 |
<tbody> |
| 1622 |
<tr class='mw-empty-elt'></tr> |
| 1623 |
<tr class='mw-empty-elt'></tr> |
| 1624 |
</tbody></table> |
| 1625 |
!! end |
| 1626 |
|
| 1627 |
!! test |
| 1628 |
Table with missing opening <tr> tag |
| 1629 |
!! options |
| 1630 |
parsoid=wt2html,wt2wt |
| 1631 |
!! wikitext |
| 1632 |
<table> |
| 1633 |
<td>foo</td> |
| 1634 |
</tr> |
| 1635 |
</table> |
| 1636 |
!! html |
| 1637 |
<table> |
| 1638 |
<tbody><tr><td>foo</td> |
| 1639 |
</tr> |
| 1640 |
</tbody></table> |
| 1641 |
!! end |
| 1642 |
|
| 1643 |
# T137406: Whitespace in the HTML |
| 1644 |
!! test |
| 1645 |
1. Generate correct wikitext for tables with thead/tbody/tfoot |
| 1646 |
!! options |
| 1647 |
parsoid=html2wt |
| 1648 |
!! html/parsoid |
| 1649 |
<table> |
| 1650 |
<caption>Test</caption> |
| 1651 |
<thead> |
| 1652 |
<tr> |
| 1653 |
<th>Month</th> |
| 1654 |
<th>Savings</th> |
| 1655 |
</tr> |
| 1656 |
</thead> |
| 1657 |
<tbody> |
| 1658 |
<tr> |
| 1659 |
<td>January</td> |
| 1660 |
<td>$100</td> |
| 1661 |
</tr> |
| 1662 |
<tr> |
| 1663 |
<td>February</td> |
| 1664 |
<td>$80</td> |
| 1665 |
</tr> |
| 1666 |
</tbody> |
| 1667 |
<tfoot> |
| 1668 |
<tr> |
| 1669 |
<td>Sum</td> |
| 1670 |
<td>$180</td> |
| 1671 |
</tr> |
| 1672 |
</tfoot> |
| 1673 |
</table> |
| 1674 |
!! wikitext |
| 1675 |
{| |
| 1676 |
|+Test |
| 1677 |
!Month |
| 1678 |
!Savings |
| 1679 |
|- |
| 1680 |
|January |
| 1681 |
|$100 |
| 1682 |
|- |
| 1683 |
|February |
| 1684 |
|$80 |
| 1685 |
|- |
| 1686 |
|Sum |
| 1687 |
|$180 |
| 1688 |
|} |
| 1689 |
!! html/php |
| 1690 |
<table> |
| 1691 |
<caption>Test |
| 1692 |
</caption> |
| 1693 |
<tbody><tr> |
| 1694 |
<th>Month |
| 1695 |
</th> |
| 1696 |
<th>Savings |
| 1697 |
</th></tr> |
| 1698 |
<tr> |
| 1699 |
<td>January |
| 1700 |
</td> |
| 1701 |
<td>$100 |
| 1702 |
</td></tr> |
| 1703 |
<tr> |
| 1704 |
<td>February |
| 1705 |
</td> |
| 1706 |
<td>$80 |
| 1707 |
</td></tr> |
| 1708 |
<tr> |
| 1709 |
<td>Sum |
| 1710 |
</td> |
| 1711 |
<td>$180 |
| 1712 |
</td></tr></tbody></table> |
| 1713 |
!! end |
| 1714 |
|
| 1715 |
# T137406: No whitespace in the HTML |
| 1716 |
!! test |
| 1717 |
2. Generate correct wikitext for tables with thead/tbody/tfoot |
| 1718 |
!! options |
| 1719 |
parsoid=html2wt |
| 1720 |
!! html/parsoid |
| 1721 |
<table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table> |
| 1722 |
!! wikitext |
| 1723 |
{| |
| 1724 |
!heading |
| 1725 |
|- |
| 1726 |
|foo |
| 1727 |
|} |
| 1728 |
!! end |
| 1729 |
|
| 1730 |
!! test |
| 1731 |
Wikitext tables can be nested inside HTML tables |
| 1732 |
!! options |
| 1733 |
parsoid=html2wt |
| 1734 |
!! html/parsoid |
| 1735 |
<table data-parsoid='{"stx":"html"}'> |
| 1736 |
<tr><td> |
| 1737 |
<table> |
| 1738 |
<tr><td>foo</td></tr> |
| 1739 |
</table> |
| 1740 |
</td></tr> |
| 1741 |
</table> |
| 1742 |
!! wikitext |
| 1743 |
<table> |
| 1744 |
<tr><td> |
| 1745 |
{| |
| 1746 |
|foo |
| 1747 |
|} |
| 1748 |
</td></tr> |
| 1749 |
</table> |
| 1750 |
!! html/php |
| 1751 |
<table> |
| 1752 |
<tbody><tr><td> |
| 1753 |
<table> |
| 1754 |
<tbody><tr> |
| 1755 |
<td>foo |
| 1756 |
</td></tr></tbody></table> |
| 1757 |
</td></tr> |
| 1758 |
</tbody></table> |
| 1759 |
!! end |
| 1760 |
|
| 1761 |
!! article |
| 1762 |
Eau |
| 1763 |
!! text |
| 1764 |
Dummy article to suppress redlinks in tests |
| 1765 |
!! end |
| 1766 |
|
| 1767 |
!! test |
| 1768 |
T319143 - copy-pasting of cells, before |
| 1769 |
!! options |
| 1770 |
parsoid={ |
| 1771 |
"modes": [ "selser" ], |
| 1772 |
"changes": [ |
| 1773 |
["td", "before", "<td data-parsoid=\"{}\"><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1774 |
] |
| 1775 |
} |
| 1776 |
!! wikitext |
| 1777 |
{| |
| 1778 |
|[[Eau]] |
| 1779 |
|} |
| 1780 |
!! wikitext/edited |
| 1781 |
{| |
| 1782 |
|[[Eau]] |
| 1783 |
|[[Eau]] |
| 1784 |
|} |
| 1785 |
!! end |
| 1786 |
|
| 1787 |
!! test |
| 1788 |
T319143 - copy-pasting of cells, after |
| 1789 |
!! options |
| 1790 |
parsoid={ |
| 1791 |
"modes": [ "selser" ], |
| 1792 |
"changes": [ |
| 1793 |
["td", "after", "<td data-parsoid=\"{}\"><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1794 |
] |
| 1795 |
} |
| 1796 |
!! wikitext |
| 1797 |
{| |
| 1798 |
|[[Eau]] |
| 1799 |
|} |
| 1800 |
!! wikitext/edited |
| 1801 |
{| |
| 1802 |
|[[Eau]] |
| 1803 |
|[[Eau]] |
| 1804 |
|} |
| 1805 |
!! end |
| 1806 |
|
| 1807 |
!! test |
| 1808 |
T319143 - copy-pasting of cells, before multiple cells |
| 1809 |
!! options |
| 1810 |
parsoid={ |
| 1811 |
"modes": [ "selser" ], |
| 1812 |
"changes": [ |
| 1813 |
["td:first-child", "before", "<td data-parsoid='{\"stx\":\"row\"}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1814 |
] |
| 1815 |
} |
| 1816 |
!! wikitext |
| 1817 |
{| |
| 1818 |
|[[Eau]]||[[Abc]] |
| 1819 |
|} |
| 1820 |
!! wikitext/edited |
| 1821 |
{| |
| 1822 |
|[[Eau]] |
| 1823 |
|[[Eau]]||[[Abc]] |
| 1824 |
|} |
| 1825 |
!! end |
| 1826 |
|
| 1827 |
!! test |
| 1828 |
T319143 - copy-pasting of cells, before multiple cells, without "row" |
| 1829 |
!! options |
| 1830 |
parsoid={ |
| 1831 |
"modes": [ "selser" ], |
| 1832 |
"changes": [ |
| 1833 |
["td:first-child", "before", "<td data-parsoid='{}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1834 |
] |
| 1835 |
} |
| 1836 |
!! wikitext |
| 1837 |
{| |
| 1838 |
|[[Eau]]||[[Abc]] |
| 1839 |
|} |
| 1840 |
!! wikitext/edited |
| 1841 |
{| |
| 1842 |
|[[Eau]] |
| 1843 |
|[[Eau]]||[[Abc]] |
| 1844 |
|} |
| 1845 |
!! end |
| 1846 |
|
| 1847 |
!! test |
| 1848 |
T319143 - copy-pasting of cells, between multiple cells |
| 1849 |
!! options |
| 1850 |
parsoid={ |
| 1851 |
"modes": [ "selser" ], |
| 1852 |
"changes": [ |
| 1853 |
["td:first-child", "after", "<td data-parsoid='{\"stx\":\"row\"}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1854 |
] |
| 1855 |
} |
| 1856 |
!! wikitext |
| 1857 |
{| |
| 1858 |
|[[Eau]]||[[Abc]] |
| 1859 |
|} |
| 1860 |
!! wikitext/edited |
| 1861 |
{| |
| 1862 |
|[[Eau]]||[[Eau]]||[[Abc]] |
| 1863 |
|} |
| 1864 |
!! end |
| 1865 |
|
| 1866 |
!! test |
| 1867 |
T319143 - copy-pasting of cells, between multiple cells, without "row" |
| 1868 |
!! options |
| 1869 |
parsoid={ |
| 1870 |
"modes": [ "selser" ], |
| 1871 |
"changes": [ |
| 1872 |
["td:first-child", "after", "<td data-parsoid='{}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1873 |
] |
| 1874 |
} |
| 1875 |
!! wikitext |
| 1876 |
{| |
| 1877 |
|[[Eau]]||[[Abc]] |
| 1878 |
|} |
| 1879 |
!! wikitext/edited |
| 1880 |
{| |
| 1881 |
|[[Eau]] |
| 1882 |
|[[Eau]]||[[Abc]] |
| 1883 |
|} |
| 1884 |
!! end |
| 1885 |
|
| 1886 |
!! test |
| 1887 |
T319143 - copy-pasting of cells, after multiple cells |
| 1888 |
!! options |
| 1889 |
parsoid={ |
| 1890 |
"modes": [ "selser" ], |
| 1891 |
"changes": [ |
| 1892 |
["td:last-child", "after", "<td data-parsoid='{\"stx\":\"row\"}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1893 |
] |
| 1894 |
} |
| 1895 |
!! wikitext |
| 1896 |
{| |
| 1897 |
|[[Eau]]||[[Abc]] |
| 1898 |
|} |
| 1899 |
!! wikitext/edited |
| 1900 |
{| |
| 1901 |
|[[Eau]]||[[Abc]]||[[Eau]] |
| 1902 |
|} |
| 1903 |
!! end |
| 1904 |
|
| 1905 |
!! test |
| 1906 |
T319143 - copy-pasting of cells, after multiple cells, without "row" |
| 1907 |
!! options |
| 1908 |
parsoid={ |
| 1909 |
"modes": [ "selser" ], |
| 1910 |
"changes": [ |
| 1911 |
["td:last-child", "after", "<td data-parsoid='{}'><a href=\"./Eau\" rel=\"mw:WikiLink\" title=\"Eau\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Eau\"},\"sa\":{\"href\":\"Eau\"},\"dsr\":[4,11,2,2]}'>Eau</a></td>"] |
| 1912 |
] |
| 1913 |
} |
| 1914 |
!! wikitext |
| 1915 |
{| |
| 1916 |
|[[Eau]]||[[Abc]] |
| 1917 |
|} |
| 1918 |
!! wikitext/edited |
| 1919 |
{| |
| 1920 |
|[[Eau]]||[[Abc]] |
| 1921 |
|[[Eau]] |
| 1922 |
|} |
| 1923 |
!! end |
| 1924 |
|
| 1925 |
!! test |
| 1926 |
Spec syntactic differences in parsing of !! compared to || |
| 1927 |
!! options |
| 1928 |
parsoid=wt2html,wt2wt |
| 1929 |
!! wikitext |
| 1930 |
{| |
| 1931 |
<!--cmt-->!!foo |
| 1932 |
{{1x|!!foo}} |
| 1933 |
<!--cmt-->!!foo!!bar |
| 1934 |
{{1x|!!foo}}{{1x|!!bar}} |
| 1935 |
|} |
| 1936 |
!! html/php |
| 1937 |
<table> |
| 1938 |
<tbody><tr> |
| 1939 |
<th>!foo |
| 1940 |
</th> |
| 1941 |
<th>!foo |
| 1942 |
</th> |
| 1943 |
<th>!foo</th> |
| 1944 |
<th>bar |
| 1945 |
</th> |
| 1946 |
<th>!foo</th> |
| 1947 |
<th>bar |
| 1948 |
</th></tr></tbody></table> |
| 1949 |
!! html/parsoid+integrated |
| 1950 |
<table><!--cmt--> |
| 1951 |
<tbody> |
| 1952 |
<tr> |
| 1953 |
<th>!foo</th> |
| 1954 |
<th about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"!!foo"}},"i":0}}]}'>!foo</th> |
| 1955 |
<!--cmt--> |
| 1956 |
<th>!foo</th> |
| 1957 |
<th>bar</th> |
| 1958 |
<th about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"!!foo"}},"i":0}}]}'>!foo</th> |
| 1959 |
<th about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"!!bar"}},"i":0}}]}'>bar</th> |
| 1960 |
</tr> |
| 1961 |
</tbody> |
| 1962 |
</table> |
| 1963 |
!! end |