| 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 |
Foo |
| 18 |
!!text |
| 19 |
FOO |
| 20 |
!!endarticle |
| 21 |
|
| 22 |
!! article |
| 23 |
Söfnuður |
| 24 |
!! text |
| 25 |
Test. |
| 26 |
!! endarticle |
| 27 |
|
| 28 |
!! article |
| 29 |
00 |
| 30 |
!! text |
| 31 |
This is 00. |
| 32 |
!! endarticle |
| 33 |
|
| 34 |
!! article |
| 35 |
Template:1x |
| 36 |
!! text |
| 37 |
{{{1}}} |
| 38 |
!! endarticle |
| 39 |
|
| 40 |
#### ---------------------------------------------------------------- |
| 41 |
#### The following section of tests are primarily to test |
| 42 |
#### wikitext escaping capabilities of Parsoid. Given that |
| 43 |
#### escaping can be done any number of ways, the wikitext (input) |
| 44 |
#### is always adjusted to reflect how Parsoid adds nowiki |
| 45 |
#### escape tags. |
| 46 |
#### |
| 47 |
#### We are marking several tests as parsoid-only since the |
| 48 |
#### HTML in the result section is different from what the |
| 49 |
#### PHP parser generates for it. |
| 50 |
#### ---------------------------------------------------------------- |
| 51 |
|
| 52 |
|
| 53 |
#### --------------- Headings --------------- |
| 54 |
#### 0. Unnested |
| 55 |
#### 1. Nested inside html <h1>=foo=</h1> |
| 56 |
#### 2. Outside heading nest on a single line <h1>foo</h1>*bar |
| 57 |
#### 3. Nested inside html with wikitext split by html tags |
| 58 |
#### 4. No escape needed |
| 59 |
#### 5. Empty headings <h1></h1> |
| 60 |
#### 6. Heading chars in SOL context |
| 61 |
#### ---------------------------------------- |
| 62 |
|
| 63 |
!! test |
| 64 |
Headings: 0. Unnested |
| 65 |
!! options |
| 66 |
parsoid=html2wt |
| 67 |
!! html/parsoid |
| 68 |
<p>=foo=</p> |
| 69 |
|
| 70 |
<p> =foo= |
| 71 |
<!--cmt--> |
| 72 |
=foo=</p> |
| 73 |
|
| 74 |
<p>=foo<i>a</i>=</p> |
| 75 |
!! wikitext |
| 76 |
<nowiki>=foo=</nowiki> |
| 77 |
|
| 78 |
<nowiki/>=foo= |
| 79 |
<!--cmt--> |
| 80 |
<nowiki>=foo=</nowiki> |
| 81 |
|
| 82 |
=foo''a''<nowiki>=</nowiki> |
| 83 |
!!end |
| 84 |
|
| 85 |
# New headings and existing headings are handled differently |
| 86 |
!! test |
| 87 |
Headings: 1. Nested inside html |
| 88 |
!! options |
| 89 |
parsoid=html2wt |
| 90 |
!! html/parsoid |
| 91 |
<h1>=foo=</h1> |
| 92 |
<h2>=foo=</h2> |
| 93 |
<h3>=foo=</h3> |
| 94 |
|
| 95 |
<h1 data-parsoid='{}'>=foo=</h1> |
| 96 |
<h2 data-parsoid='{}'>=foo=</h2> |
| 97 |
<h3 data-parsoid='{}'>=foo=</h3> |
| 98 |
<h4 data-parsoid='{}'>=foo=</h4> |
| 99 |
<h5 data-parsoid='{}'>=foo=</h5> |
| 100 |
<h6 data-parsoid='{}'>=foo=</h6> |
| 101 |
!! wikitext |
| 102 |
= =foo= = |
| 103 |
|
| 104 |
== =foo= == |
| 105 |
|
| 106 |
=== =foo= === |
| 107 |
|
| 108 |
=<nowiki>=foo=</nowiki>= |
| 109 |
==<nowiki>=foo=</nowiki>== |
| 110 |
===<nowiki>=foo=</nowiki>=== |
| 111 |
====<nowiki>=foo=</nowiki>==== |
| 112 |
=====<nowiki>=foo=</nowiki>===== |
| 113 |
======<nowiki>=foo=</nowiki>====== |
| 114 |
!! end |
| 115 |
|
| 116 |
!! test |
| 117 |
Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar |
| 118 |
!! options |
| 119 |
parsoid=html2wt |
| 120 |
!! html/parsoid |
| 121 |
<h1>foo</h1>*bar |
| 122 |
<h1>foo</h1>=bar |
| 123 |
<h1>foo</h1>=bar= |
| 124 |
!! wikitext |
| 125 |
= foo = |
| 126 |
<nowiki>*</nowiki>bar |
| 127 |
|
| 128 |
= foo = |
| 129 |
=bar |
| 130 |
|
| 131 |
= foo = |
| 132 |
<nowiki>=bar=</nowiki> |
| 133 |
!!end |
| 134 |
|
| 135 |
!! test |
| 136 |
Headings: 3. Nested inside html with wikitext split by html tags |
| 137 |
!! options |
| 138 |
parsoid=html2wt |
| 139 |
!! html/parsoid |
| 140 |
<h1>=<b>bold</b>foo=</h1> |
| 141 |
!! wikitext |
| 142 |
= ='''bold'''foo= = |
| 143 |
!!end |
| 144 |
|
| 145 |
!! test |
| 146 |
Headings: 4a. No escaping needed (testing just h1 and h2) |
| 147 |
!! options |
| 148 |
parsoid=html2wt |
| 149 |
!! html/parsoid |
| 150 |
<h1>=foo</h1> |
| 151 |
<h1>foo=</h1> |
| 152 |
<h1> =foo= </h1> |
| 153 |
<h1>=foo= bar</h1> |
| 154 |
<h2>=foo</h2> |
| 155 |
<h2>foo=</h2> |
| 156 |
<h1>=</h1> |
| 157 |
<h1><i>=</i>foo=</h1> |
| 158 |
!! wikitext |
| 159 |
= =foo = |
| 160 |
|
| 161 |
= foo= = |
| 162 |
|
| 163 |
= =foo= = |
| 164 |
|
| 165 |
= =foo= bar = |
| 166 |
|
| 167 |
== =foo == |
| 168 |
|
| 169 |
== foo= == |
| 170 |
|
| 171 |
= = = |
| 172 |
|
| 173 |
= ''=''foo= = |
| 174 |
!!end |
| 175 |
|
| 176 |
!! test |
| 177 |
Headings: 4b. No escaping needed (inside p-tags) |
| 178 |
!! options |
| 179 |
parsoid=html2wt |
| 180 |
!! html/parsoid |
| 181 |
<p>=foo= x |
| 182 |
=foo= <s></s> |
| 183 |
</p> |
| 184 |
!! wikitext |
| 185 |
=foo= x |
| 186 |
=foo= <s></s> |
| 187 |
!! html/php |
| 188 |
<p>=foo= x |
| 189 |
=foo= <s></s> |
| 190 |
</p> |
| 191 |
!!end |
| 192 |
|
| 193 |
!! test |
| 194 |
Headings: 4c. Short headings (1) |
| 195 |
!! options |
| 196 |
parsoid=html2wt |
| 197 |
!! html/parsoid |
| 198 |
<p>=== |
| 199 |
</p> |
| 200 |
!! wikitext |
| 201 |
<nowiki>===</nowiki> |
| 202 |
!! html/php |
| 203 |
<p>=== |
| 204 |
</p> |
| 205 |
!! end |
| 206 |
|
| 207 |
# in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>=' |
| 208 |
!! test |
| 209 |
Headings: 4d. Short headings (2) |
| 210 |
!! config |
| 211 |
wgParserEnableLegacyHeadingDOM=false |
| 212 |
!! options |
| 213 |
parsoid=wt2html,html2html |
| 214 |
!! wikitext |
| 215 |
= |
| 216 |
== |
| 217 |
=== |
| 218 |
==== |
| 219 |
===== |
| 220 |
!! html/php |
| 221 |
<p>= |
| 222 |
== |
| 223 |
</p> |
| 224 |
<div class="mw-heading mw-heading1"><h1 id=".3D">=</h1><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></div> |
| 225 |
<div class="mw-heading mw-heading1"><h1 id=".3D.3D">==</h1><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: ==">edit</a><span class="mw-editsection-bracket">]</span></span></div> |
| 226 |
<div class="mw-heading mw-heading2"><h2 id=".3D_2">=</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></div> |
| 227 |
!! html/parsoid |
| 228 |
<p>= |
| 229 |
==</p> |
| 230 |
<h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1> |
| 231 |
<h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1> |
| 232 |
<h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2> |
| 233 |
!! end |
| 234 |
|
| 235 |
!! test |
| 236 |
Headings: 5. Empty headings |
| 237 |
!! options |
| 238 |
parsoid=html2wt |
| 239 |
!! html/parsoid |
| 240 |
<h1 data-parsoid='{}'></h1> |
| 241 |
|
| 242 |
<h2 data-parsoid='{}'></h2> |
| 243 |
|
| 244 |
<h3 data-parsoid='{}'></h3> |
| 245 |
|
| 246 |
<h4 data-parsoid='{}'></h4> |
| 247 |
|
| 248 |
<h5 data-parsoid='{}'></h5> |
| 249 |
|
| 250 |
<h6 data-parsoid='{}'></h6> |
| 251 |
!! wikitext |
| 252 |
!! end |
| 253 |
|
| 254 |
!! test |
| 255 |
Headings: 6a. Heading chars in SOL context (with trailing spaces) |
| 256 |
!! options |
| 257 |
parsoid=html2wt |
| 258 |
!! html/parsoid |
| 259 |
<p>=a=</p> |
| 260 |
|
| 261 |
<p>=a=</p> |
| 262 |
|
| 263 |
<p>=a=</p> |
| 264 |
!! wikitext |
| 265 |
<nowiki>=a=</nowiki> |
| 266 |
|
| 267 |
<nowiki>=a=</nowiki> |
| 268 |
|
| 269 |
<nowiki>=a=</nowiki> |
| 270 |
!!end |
| 271 |
|
| 272 |
!! test |
| 273 |
Headings: 6b. Heading chars in SOL context (with trailing newlines) |
| 274 |
!! options |
| 275 |
parsoid=html2wt |
| 276 |
!! html/parsoid |
| 277 |
<p>=a= |
| 278 |
b</p> |
| 279 |
|
| 280 |
<p>=a= |
| 281 |
b</p> |
| 282 |
|
| 283 |
<p>=a= |
| 284 |
b</p> |
| 285 |
!! wikitext |
| 286 |
<nowiki>=a=</nowiki> |
| 287 |
b |
| 288 |
|
| 289 |
<nowiki>=a=</nowiki> |
| 290 |
b |
| 291 |
|
| 292 |
<nowiki>=a=</nowiki> |
| 293 |
b |
| 294 |
!!end |
| 295 |
|
| 296 |
!! test |
| 297 |
Headings: 6c. Heading chars in SOL context (leading newline break) |
| 298 |
!! options |
| 299 |
parsoid=html2wt |
| 300 |
!! html/parsoid |
| 301 |
<p>a |
| 302 |
=b=</p> |
| 303 |
!! wikitext |
| 304 |
a |
| 305 |
<nowiki>=b=</nowiki> |
| 306 |
!!end |
| 307 |
|
| 308 |
!! test |
| 309 |
Headings: 6d. Heading chars in SOL context (with interspersed comments) |
| 310 |
!! options |
| 311 |
parsoid=html2wt |
| 312 |
!! html/parsoid |
| 313 |
<!--c0--><p>=a=</p> |
| 314 |
|
| 315 |
<!--c1--><p>=a=</p> <!--c2--> <!--c3--> |
| 316 |
!! wikitext |
| 317 |
<!--c0--><nowiki>=a=</nowiki> |
| 318 |
|
| 319 |
<!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3--> |
| 320 |
!!end |
| 321 |
|
| 322 |
!! test |
| 323 |
Headings: 6d. Heading chars in SOL context (No escaping needed) |
| 324 |
!! options |
| 325 |
parsoid=html2wt |
| 326 |
!! html/parsoid |
| 327 |
=a=<div>b</div> |
| 328 |
!! wikitext |
| 329 |
=a=<div>b</div> |
| 330 |
!!end |
| 331 |
|
| 332 |
!! test |
| 333 |
Headings: 7. Insert a newline between new content and headings |
| 334 |
!! options |
| 335 |
parsoid=html2wt |
| 336 |
!! html/parsoid |
| 337 |
<h2>NEW</h2> |
| 338 |
<p>new</p> |
| 339 |
<h2 data-parsoid='{}'>A</h2> |
| 340 |
<p data-parsoid='{}'>a</p> |
| 341 |
!! wikitext |
| 342 |
== NEW == |
| 343 |
new |
| 344 |
|
| 345 |
==A== |
| 346 |
a |
| 347 |
!! end |
| 348 |
|
| 349 |
!! test |
| 350 |
Headings: Used as horizontal rule |
| 351 |
!! config |
| 352 |
wgParserEnableLegacyHeadingDOM=false |
| 353 |
wgFragmentMode=[ "html5", "legacy" ] |
| 354 |
!! options |
| 355 |
parsoid=wt2html |
| 356 |
!! wikitext |
| 357 |
=============== |
| 358 |
!! html/php |
| 359 |
<div class="mw-heading mw-heading6"><h6 id="==="><span id=".3D.3D.3D"></span>===</h6><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: ===">edit</a><span class="mw-editsection-bracket">]</span></span></div> |
| 360 |
!! html/parsoid |
| 361 |
<h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6> |
| 362 |
!! end |
| 363 |
|
| 364 |
#### --------------- Lists --------------- |
| 365 |
#### 0. Outside nests (*foo, etc.) |
| 366 |
#### 1. Nested inside html <ul><li>*foo</li></ul> |
| 367 |
#### 2. Inside definition lists |
| 368 |
#### 3. Only bullets at start should be escaped |
| 369 |
#### 4. No escapes needed |
| 370 |
#### 5. No unnecessary escapes |
| 371 |
#### 6. Escape bullets in SOL position |
| 372 |
#### 7. Escape bullets in a multi-line context |
| 373 |
#### ---------------------------------------- |
| 374 |
|
| 375 |
!! test |
| 376 |
Lists: 0. Outside nests |
| 377 |
!! options |
| 378 |
parsoid=html2wt |
| 379 |
!! html/parsoid |
| 380 |
<p>*foo</p> |
| 381 |
|
| 382 |
<p>#foo</p> |
| 383 |
|
| 384 |
<p>;Foo:bar</p> |
| 385 |
!! wikitext |
| 386 |
<nowiki>*</nowiki>foo |
| 387 |
|
| 388 |
<nowiki>#</nowiki>foo |
| 389 |
|
| 390 |
<nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar |
| 391 |
!!end |
| 392 |
|
| 393 |
## Making these next 3 tests Parsoid-only since they are html2wt tests |
| 394 |
## to test wikitext escaping, and insignificant whitespace diffs |
| 395 |
## cause PHP parser tests to barf |
| 396 |
!! test |
| 397 |
Lists: 1. Nested inside html (No unnecessary escapes) |
| 398 |
!! options |
| 399 |
parsoid=html2wt |
| 400 |
!! html/parsoid |
| 401 |
<ul> |
| 402 |
<li>*foo</li> |
| 403 |
<li>#foo</li> |
| 404 |
<li>:foo</li> |
| 405 |
<li>;foo</li> |
| 406 |
<li data-parsoid='{}'>*foo</li> |
| 407 |
<li data-parsoid='{}'>#foo</li> |
| 408 |
<li data-parsoid='{}'>:foo</li> |
| 409 |
<li data-parsoid='{}'>;foo</li> |
| 410 |
</ul> |
| 411 |
|
| 412 |
<ol> |
| 413 |
<li>*foo</li> |
| 414 |
<li>#foo</li> |
| 415 |
<li>:foo</li> |
| 416 |
<li>;foo</li> |
| 417 |
<li data-parsoid='{}'>*foo</li> |
| 418 |
<li data-parsoid='{}'>#foo</li> |
| 419 |
<li data-parsoid='{}'>:foo</li> |
| 420 |
<li data-parsoid='{}'>;foo</li> |
| 421 |
</ol> |
| 422 |
!! wikitext |
| 423 |
* *foo |
| 424 |
* #foo |
| 425 |
* :foo |
| 426 |
* ;foo |
| 427 |
*<nowiki>*foo</nowiki> |
| 428 |
*<nowiki>#foo</nowiki> |
| 429 |
*<nowiki>:foo</nowiki> |
| 430 |
*<nowiki>;foo</nowiki> |
| 431 |
|
| 432 |
# *foo |
| 433 |
# #foo |
| 434 |
# :foo |
| 435 |
# ;foo |
| 436 |
#<nowiki>*foo</nowiki> |
| 437 |
#<nowiki>#foo</nowiki> |
| 438 |
#<nowiki>:foo</nowiki> |
| 439 |
#<nowiki>;foo</nowiki> |
| 440 |
!!end |
| 441 |
|
| 442 |
!! test |
| 443 |
Lists: 2. Inside definition lists |
| 444 |
!! options |
| 445 |
parsoid=html2wt |
| 446 |
!! html/parsoid |
| 447 |
<dl><dt>;foo</dt></dl> |
| 448 |
<dl><dt>:foo</dt></dl> |
| 449 |
<dl><dt>:foo</dt> |
| 450 |
<dd>bar</dd></dl> |
| 451 |
<dl><dd>:foo</dd></dl> |
| 452 |
!! wikitext |
| 453 |
; ;foo |
| 454 |
|
| 455 |
; <nowiki>:foo</nowiki> |
| 456 |
|
| 457 |
; <nowiki>:foo</nowiki> |
| 458 |
: bar |
| 459 |
|
| 460 |
: :foo |
| 461 |
!!end |
| 462 |
|
| 463 |
!! test |
| 464 |
Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped |
| 465 |
!! options |
| 466 |
parsoid=html2wt |
| 467 |
!! html/parsoid |
| 468 |
<ul> |
| 469 |
<li>*foo*bar</li> |
| 470 |
<li data-parsoid='{}'>*foo<i>it</i>*bar</li> |
| 471 |
</ul> |
| 472 |
!! wikitext |
| 473 |
* *foo*bar |
| 474 |
*<nowiki>*foo</nowiki>''it''*bar |
| 475 |
!!end |
| 476 |
|
| 477 |
!! test |
| 478 |
Lists: 4. No escapes needed |
| 479 |
!! options |
| 480 |
parsoid=html2wt |
| 481 |
!! html/parsoid |
| 482 |
<ul> |
| 483 |
<li>foo*bar |
| 484 |
</li> |
| 485 |
</ul> |
| 486 |
<ul> |
| 487 |
<li><i>foo</i>*bar |
| 488 |
</li> |
| 489 |
</ul> |
| 490 |
<ul> |
| 491 |
<li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar |
| 492 |
</li> |
| 493 |
</ul> |
| 494 |
<ul> |
| 495 |
<li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar |
| 496 |
</li> |
| 497 |
</ul> |
| 498 |
!! wikitext |
| 499 |
*foo*bar |
| 500 |
|
| 501 |
*''foo''*bar |
| 502 |
|
| 503 |
*[[Foo]]: bar |
| 504 |
|
| 505 |
*[[Foo]]*bar |
| 506 |
!!end |
| 507 |
|
| 508 |
!! test |
| 509 |
Lists: 5. No unnecessary escapes |
| 510 |
!! options |
| 511 |
parsoid=html2wt |
| 512 |
!! html/parsoid |
| 513 |
<ul><li> bar <span>[[foo]]</span></li></ul> |
| 514 |
<ul><li> =bar <span>[[foo]]</span></li></ul> |
| 515 |
<ul><li> [[bar <span>[[foo]]</span></li></ul> |
| 516 |
<ul><li> ]]bar <span>[[foo]]</span></li></ul> |
| 517 |
<ul><li> =bar <span>foo]]</span>=</li></ul> |
| 518 |
<ul><li> <s></s>: a</li></ul> |
| 519 |
<ul><li> <i>* foo</i></li></ul> |
| 520 |
|
| 521 |
!! wikitext |
| 522 |
* bar <span><nowiki>[[foo]]</nowiki></span> |
| 523 |
|
| 524 |
* =bar <span><nowiki>[[foo]]</nowiki></span> |
| 525 |
|
| 526 |
* [[bar <span><nowiki>[[foo]]</nowiki></span> |
| 527 |
|
| 528 |
* ]]bar <span><nowiki>[[foo]]</nowiki></span> |
| 529 |
|
| 530 |
* =bar <span>foo]]</span>= |
| 531 |
|
| 532 |
* <s></s>: a |
| 533 |
|
| 534 |
* ''* foo'' |
| 535 |
!!end |
| 536 |
|
| 537 |
!! test |
| 538 |
Lists: 6. Escape bullets in SOL position |
| 539 |
!! options |
| 540 |
parsoid=html2wt |
| 541 |
!! html/parsoid |
| 542 |
<p><!--cmt-->*foo</p> |
| 543 |
!! wikitext |
| 544 |
<!--cmt--><nowiki>*</nowiki>foo |
| 545 |
!!end |
| 546 |
|
| 547 |
!! test |
| 548 |
Lists: 7. Escape bullets in a multi-line context |
| 549 |
!! options |
| 550 |
parsoid=html2wt |
| 551 |
!! html/parsoid |
| 552 |
<p>a |
| 553 |
*b |
| 554 |
</p> |
| 555 |
!! wikitext |
| 556 |
a |
| 557 |
<nowiki>*</nowiki>b |
| 558 |
!!end |
| 559 |
|
| 560 |
!! test |
| 561 |
Lists: 8. Escape colons only if not present in tags |
| 562 |
!! options |
| 563 |
parsoid=html2wt |
| 564 |
!! html/parsoid |
| 565 |
<dl><dt>a:b<i>c:d</i></dt></dl> |
| 566 |
!! wikitext |
| 567 |
; <nowiki>a:b</nowiki>''c:d'' |
| 568 |
!! end |
| 569 |
|
| 570 |
#### --------------- HRs --------------- |
| 571 |
#### 1. Single line |
| 572 |
#### ----------------------------------- |
| 573 |
|
| 574 |
!! test |
| 575 |
HRs: 1. Single line |
| 576 |
!! options |
| 577 |
parsoid=html2wt |
| 578 |
!! html/parsoid |
| 579 |
<hr />---- |
| 580 |
<hr />=foo= |
| 581 |
<hr />*foo |
| 582 |
!! wikitext |
| 583 |
----<nowiki>----</nowiki> |
| 584 |
----=foo= |
| 585 |
----*foo |
| 586 |
!! end |
| 587 |
|
| 588 |
#### --------------- Tables --------------- |
| 589 |
#### 1a. Simple example |
| 590 |
#### 1b. No escaping needed (!foo) |
| 591 |
#### 1c. No escaping needed (|foo) |
| 592 |
#### 1d. No escaping needed (|}foo) |
| 593 |
#### |
| 594 |
#### 2a. Nested in td (<td>foo|bar</td>) |
| 595 |
#### 2b. Nested in td (<td>foo||bar</td>) |
| 596 |
#### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>) |
| 597 |
#### |
| 598 |
#### 3a. Nested in th (<th>foo!bar</th>) |
| 599 |
#### 3b. Nested in th (<th>foo!!bar</th>) |
| 600 |
#### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>) |
| 601 |
#### |
| 602 |
#### 4a. Escape - |
| 603 |
#### 4b. Escape + |
| 604 |
#### 4c. No escaping needed |
| 605 |
#### -------------------------------------- |
| 606 |
|
| 607 |
!! test |
| 608 |
Tables: 1a. Simple example |
| 609 |
!! options |
| 610 |
parsoid=html2wt |
| 611 |
!! html/parsoid |
| 612 |
<p>{| |
| 613 |
|} |
| 614 |
</p> |
| 615 |
!! wikitext |
| 616 |
<nowiki>{|</nowiki> |
| 617 |
|} |
| 618 |
!! end |
| 619 |
|
| 620 |
!! test |
| 621 |
Tables: 1b. No escaping needed |
| 622 |
!! options |
| 623 |
parsoid=html2wt |
| 624 |
!! html/parsoid |
| 625 |
<p>!foo |
| 626 |
</p> |
| 627 |
!! wikitext |
| 628 |
!foo |
| 629 |
!! end |
| 630 |
|
| 631 |
!! test |
| 632 |
Tables: 1c. No escaping needed |
| 633 |
!! options |
| 634 |
parsoid=html2wt |
| 635 |
!! html/parsoid |
| 636 |
<p>|foo |
| 637 |
</p> |
| 638 |
!! wikitext |
| 639 |
|foo |
| 640 |
!! end |
| 641 |
|
| 642 |
!! test |
| 643 |
Tables: 1d. No escaping needed |
| 644 |
!! options |
| 645 |
parsoid=html2wt |
| 646 |
!! html/parsoid |
| 647 |
<p>|}foo |
| 648 |
</p> |
| 649 |
!! wikitext |
| 650 |
|}foo |
| 651 |
!! end |
| 652 |
|
| 653 |
!! test |
| 654 |
Tables: 2a. Nested in td |
| 655 |
!! options |
| 656 |
parsoid=html2wt |
| 657 |
!! html/parsoid |
| 658 |
<table><tbody><tr> |
| 659 |
<td>foo|bar</td></tr> |
| 660 |
<tr><td>x<div>a|b</div></td> |
| 661 |
</tbody></table> |
| 662 |
!! wikitext |
| 663 |
{| |
| 664 |
|<nowiki>foo|bar</nowiki> |
| 665 |
|- |
| 666 |
|x<div><nowiki>a|b</nowiki></div> |
| 667 |
|} |
| 668 |
!! html/php |
| 669 |
<table> |
| 670 |
<tbody><tr> |
| 671 |
<td>foo|bar |
| 672 |
</td></tr> |
| 673 |
<tr> |
| 674 |
<td>x<div>a|b</div> |
| 675 |
</td></tr></tbody></table> |
| 676 |
!! end |
| 677 |
|
| 678 |
!! test |
| 679 |
Tables: 2b. Nested in td |
| 680 |
!! options |
| 681 |
parsoid=html2wt |
| 682 |
!! html/parsoid |
| 683 |
<table><tbody><tr> |
| 684 |
<td>foo||bar</td> |
| 685 |
<td>a<i>b||c</i></td> |
| 686 |
<td>a<i><div>b||c</div></i></td> |
| 687 |
</tr></tbody></table> |
| 688 |
!! wikitext |
| 689 |
{| |
| 690 |
|<nowiki>foo||bar</nowiki> |
| 691 |
|a''<nowiki>b||c</nowiki>'' |
| 692 |
|a''<div><nowiki>b||c</nowiki></div>'' |
| 693 |
|} |
| 694 |
!! html/php |
| 695 |
<table> |
| 696 |
<tbody><tr> |
| 697 |
<td>foo||bar |
| 698 |
</td> |
| 699 |
<td>a<i>b||c</i> |
| 700 |
</td> |
| 701 |
<td>a<i><div>b||c</div></i> |
| 702 |
</td></tr></tbody></table> |
| 703 |
!! end |
| 704 |
|
| 705 |
!! test |
| 706 |
Tables: 2c. Nested in td -- no escaping needed |
| 707 |
!! options |
| 708 |
parsoid=html2wt |
| 709 |
!! html/* |
| 710 |
<table> |
| 711 |
<tbody><tr> |
| 712 |
<td>foo!!bar |
| 713 |
</td></tr></tbody></table> |
| 714 |
!! wikitext |
| 715 |
{| |
| 716 |
|foo!!bar |
| 717 |
|} |
| 718 |
!! end |
| 719 |
|
| 720 |
!! test |
| 721 |
Tables: 3a. Nested in th |
| 722 |
!! options |
| 723 |
parsoid=html2wt |
| 724 |
!! html/* |
| 725 |
<table> |
| 726 |
<tbody><tr> |
| 727 |
<th>foo!bar |
| 728 |
</th></tr></tbody></table> |
| 729 |
!! wikitext |
| 730 |
{| |
| 731 |
!foo!bar |
| 732 |
|} |
| 733 |
!! end |
| 734 |
|
| 735 |
!! test |
| 736 |
Tables: 3b. Nested in th |
| 737 |
!! options |
| 738 |
parsoid=html2wt |
| 739 |
!! html/parsoid |
| 740 |
<table><tbody> |
| 741 |
<tr><th>foo!!bar</th> |
| 742 |
<th><i>foo|bar</i></th> |
| 743 |
<th><i>foo!!bar</i></th> |
| 744 |
<th><i><span>foo!!bar</span></i></th> |
| 745 |
</tr></tbody></table> |
| 746 |
!! wikitext |
| 747 |
{| |
| 748 |
!<nowiki>foo!!bar</nowiki> |
| 749 |
!''<nowiki>foo|bar</nowiki>'' |
| 750 |
!''<nowiki>foo!!bar</nowiki>'' |
| 751 |
!''<span><nowiki>foo!!bar</nowiki></span>'' |
| 752 |
|} |
| 753 |
!! html/php |
| 754 |
<table> |
| 755 |
<tbody><tr> |
| 756 |
<th>foo!!bar |
| 757 |
</th> |
| 758 |
<th><i>foo|bar</i> |
| 759 |
</th> |
| 760 |
<th><i>foo!!bar</i> |
| 761 |
</th> |
| 762 |
<th><i><span>foo!!bar</span></i> |
| 763 |
</th></tr></tbody></table> |
| 764 |
!! end |
| 765 |
|
| 766 |
!! test |
| 767 |
Tables: 3c. Nested in th |
| 768 |
!! options |
| 769 |
parsoid=html2wt |
| 770 |
!! html/parsoid |
| 771 |
<table><tbody> |
| 772 |
<tr><th>foo||bar</th> |
| 773 |
<th><span typeof="mw:Nowiki">foo||bar</span></th> |
| 774 |
</tr></tbody></table> |
| 775 |
!! wikitext |
| 776 |
{| |
| 777 |
!<nowiki>foo||bar</nowiki> |
| 778 |
!<nowiki>foo||bar</nowiki> |
| 779 |
|} |
| 780 |
!! html/php |
| 781 |
<table> |
| 782 |
<tbody><tr> |
| 783 |
<th>foo||bar |
| 784 |
</th> |
| 785 |
<th>foo||bar |
| 786 |
</th></tr></tbody></table> |
| 787 |
!! end |
| 788 |
|
| 789 |
!! test |
| 790 |
Tables: 4a. Escape - |
| 791 |
!! options |
| 792 |
parsoid=html2wt |
| 793 |
!! html/* |
| 794 |
<table> |
| 795 |
<tbody><tr> |
| 796 |
<th>-bar |
| 797 |
</th></tr> |
| 798 |
<tr> |
| 799 |
<td>-bar |
| 800 |
</td></tr></tbody></table> |
| 801 |
!! wikitext |
| 802 |
{| |
| 803 |
!-bar |
| 804 |
|- |
| 805 |
| -bar |
| 806 |
|} |
| 807 |
!! end |
| 808 |
|
| 809 |
!! test |
| 810 |
Tables: 4b. Escape + |
| 811 |
!! options |
| 812 |
parsoid=html2wt |
| 813 |
!! html/* |
| 814 |
<table> |
| 815 |
<tbody><tr> |
| 816 |
<th>+bar |
| 817 |
</th></tr> |
| 818 |
<tr> |
| 819 |
<td>+bar |
| 820 |
</td></tr></tbody></table> |
| 821 |
!! wikitext |
| 822 |
{| |
| 823 |
!+bar |
| 824 |
|- |
| 825 |
| +bar |
| 826 |
|} |
| 827 |
!! end |
| 828 |
|
| 829 |
!! test |
| 830 |
Tables: 4c. No escaping needed |
| 831 |
!! options |
| 832 |
parsoid=html2wt |
| 833 |
!! html/parsoid |
| 834 |
<table><tbody> |
| 835 |
<tr><td>foo-bar</td><td>foo+bar</td></tr> |
| 836 |
<tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr> |
| 837 |
<tr><td>foo |
| 838 |
<p>bar|baz |
| 839 |
+bar |
| 840 |
-bar</p></td></tr> |
| 841 |
<tr><td>x |
| 842 |
<div>a|b</div></td> |
| 843 |
</tbody></table> |
| 844 |
!! wikitext |
| 845 |
{| |
| 846 |
|foo-bar |
| 847 |
|foo+bar |
| 848 |
|- |
| 849 |
|''foo''-bar |
| 850 |
|''foo''+bar |
| 851 |
|- |
| 852 |
|foo |
| 853 |
bar|baz |
| 854 |
+bar |
| 855 |
-bar |
| 856 |
|- |
| 857 |
|x |
| 858 |
<div>a|b</div> |
| 859 |
|} |
| 860 |
!! html/php |
| 861 |
<table> |
| 862 |
<tbody><tr> |
| 863 |
<td>foo-bar |
| 864 |
</td> |
| 865 |
<td>foo+bar |
| 866 |
</td></tr> |
| 867 |
<tr> |
| 868 |
<td><i>foo</i>-bar |
| 869 |
</td> |
| 870 |
<td><i>foo</i>+bar |
| 871 |
</td></tr> |
| 872 |
<tr> |
| 873 |
<td>foo |
| 874 |
<p>bar|baz |
| 875 |
+bar |
| 876 |
-bar |
| 877 |
</p> |
| 878 |
</td></tr> |
| 879 |
<tr> |
| 880 |
<td>x |
| 881 |
<div>a|b</div> |
| 882 |
</td></tr></tbody></table> |
| 883 |
!! end |
| 884 |
|
| 885 |
## FIXME: Looks like normalizing needs to learn about attrSepSrc |
| 886 |
!! test |
| 887 |
Tables: 4d. No escaping needed |
| 888 |
!! options |
| 889 |
parsoid=html2wt |
| 890 |
!! html/parsoid |
| 891 |
<table> |
| 892 |
<tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td> |
| 893 |
<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td> |
| 894 |
<td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr> |
| 895 |
</tbody></table> |
| 896 |
!! wikitext |
| 897 |
{| |
| 898 |
|[[Foo]]-bar |
| 899 |
||+1 |
| 900 |
||-2 |
| 901 |
|} |
| 902 |
!! html/php |
| 903 |
<table> |
| 904 |
<tbody><tr> |
| 905 |
<td><a href="/wiki/Foo" title="Foo">Foo</a>-bar |
| 906 |
</td> |
| 907 |
<td>+1 |
| 908 |
</td> |
| 909 |
<td>-2 |
| 910 |
</td></tr></tbody></table> |
| 911 |
!! end |
| 912 |
|
| 913 |
!! test |
| 914 |
Tables: 4e. Escape } |
| 915 |
!! options |
| 916 |
parsoid=html2wt |
| 917 |
!! html/parsoid |
| 918 |
<table> |
| 919 |
<tr><td>}</td></tr> |
| 920 |
<tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table> |
| 921 |
</table> |
| 922 |
!! wikitext |
| 923 |
{| |
| 924 |
| } |
| 925 |
|- |
| 926 |
|x||} |
| 927 |
|} |
| 928 |
!! html/php |
| 929 |
<table> |
| 930 |
<tbody><tr> |
| 931 |
<td>} |
| 932 |
</td></tr> |
| 933 |
<tr> |
| 934 |
<td>x</td> |
| 935 |
<td>} |
| 936 |
</td></tr></tbody></table> |
| 937 |
!! end |
| 938 |
|
| 939 |
!! test |
| 940 |
Tables: 5. Empty table cells should get whitespace to avoid need for nowikis |
| 941 |
!! options |
| 942 |
parsoid=html2wt |
| 943 |
!! html/parsoid |
| 944 |
<table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table> |
| 945 |
|
| 946 |
<table><tr><td></td><td align="center"></td><td></td></tr></table> |
| 947 |
|
| 948 |
<table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table> |
| 949 |
|
| 950 |
<table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table> |
| 951 |
!! wikitext |
| 952 |
{| |
| 953 |
| || align="center" | || |
| 954 |
|} |
| 955 |
|
| 956 |
{| |
| 957 |
| |
| 958 |
| align="center" | |
| 959 |
| |
| 960 |
|} |
| 961 |
|
| 962 |
{| |
| 963 |
| {{!}}{{!}} align="center" | || |
| 964 |
|} |
| 965 |
|
| 966 |
{| |
| 967 |
! !! align="center" | !! |
| 968 |
|} |
| 969 |
!! html/php |
| 970 |
<table> |
| 971 |
<tbody><tr> |
| 972 |
<td></td> |
| 973 |
<td align="center"></td> |
| 974 |
<td> |
| 975 |
</td></tr></tbody></table> |
| 976 |
<table> |
| 977 |
<tbody><tr> |
| 978 |
<td> |
| 979 |
</td> |
| 980 |
<td align="center"> |
| 981 |
</td> |
| 982 |
<td> |
| 983 |
</td></tr></tbody></table> |
| 984 |
<table> |
| 985 |
<tbody><tr> |
| 986 |
<td></td> |
| 987 |
<td align="center"></td> |
| 988 |
<td> |
| 989 |
</td></tr></tbody></table> |
| 990 |
<table> |
| 991 |
<tbody><tr> |
| 992 |
<th></th> |
| 993 |
<th align="center"></th> |
| 994 |
<th> |
| 995 |
</th></tr></tbody></table> |
| 996 |
!! end |
| 997 |
|
| 998 |
!! test |
| 999 |
T97430: Don't emit empty nowiki pairs around marker meta tags |
| 1000 |
!! options |
| 1001 |
parsoid=html2wt |
| 1002 |
!! html/parsoid |
| 1003 |
<p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs |
| 1004 |
|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p> |
| 1005 |
!! wikitext |
| 1006 |
<nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs |
| 1007 |
|** Make this another long long long sentence forcing the nowiki algo to split up the nowikis. |
| 1008 |
!! end |
| 1009 |
|
| 1010 |
!! test |
| 1011 |
Unclosed xmlish element in table line shouldn't eat end delimiters |
| 1012 |
!! options |
| 1013 |
parsoid=html2wt |
| 1014 |
!! html/parsoid |
| 1015 |
<table> |
| 1016 |
<tbody><tr><td> <foo</td> |
| 1017 |
<td> bar></td></tr> |
| 1018 |
</tbody></table> |
| 1019 |
!! wikitext |
| 1020 |
{| |
| 1021 |
| <foo |
| 1022 |
| bar> |
| 1023 |
|} |
| 1024 |
!! html/php |
| 1025 |
<table> |
| 1026 |
<tbody><tr> |
| 1027 |
<td><foo |
| 1028 |
</td> |
| 1029 |
<td>bar> |
| 1030 |
</td></tr></tbody></table> |
| 1031 |
!! end |
| 1032 |
|
| 1033 |
#### --------------- Links ---------------- |
| 1034 |
#### 1. Quote marks in link text |
| 1035 |
#### 2. Wikilinks: Escapes needed |
| 1036 |
#### 3. Wikilinks: No escapes needed |
| 1037 |
#### 4. Extlinks: Escapes needed |
| 1038 |
#### 5. Extlinks: No escapes needed |
| 1039 |
#### -------------------------------------- |
| 1040 |
!! test |
| 1041 |
Links 1. WikiLinks: No escapes needed |
| 1042 |
!! options |
| 1043 |
parsoid=html2wt |
| 1044 |
!! html/parsoid |
| 1045 |
<p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a> |
| 1046 |
<a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a> |
| 1047 |
<a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p> |
| 1048 |
!! wikitext |
| 1049 |
[[Foo|Foo''boo'']] |
| 1050 |
[[Foo|[Foobar]]] |
| 1051 |
[[Foo|x [Foobar] x]] |
| 1052 |
!! html/php |
| 1053 |
<p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a> |
| 1054 |
<a href="/wiki/Foo" title="Foo">[Foobar]</a> |
| 1055 |
<a href="/wiki/Foo" title="Foo">x [Foobar] x</a> |
| 1056 |
</p> |
| 1057 |
!! end |
| 1058 |
|
| 1059 |
!! test |
| 1060 |
Links 2. WikiLinks: Escapes needed |
| 1061 |
!! options |
| 1062 |
parsoid=html2wt |
| 1063 |
!! html/parsoid |
| 1064 |
<a href="Foo" rel="mw:WikiLink">Foobar]</a> |
| 1065 |
<a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a> |
| 1066 |
<a href="Foo" rel="mw:WikiLink">[[Bar]]</a> |
| 1067 |
<a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a> |
| 1068 |
<a href="Foo" rel="mw:WikiLink">|Bar</a> |
| 1069 |
<a href="Foo" rel="mw:WikiLink">]]bar</a> |
| 1070 |
<a href="Foo" rel="mw:WikiLink">[[bar</a> |
| 1071 |
<a href="Foo" rel="mw:WikiLink">x [[ y</a> |
| 1072 |
<a href="Foo" rel="mw:WikiLink">x ]] y</a> |
| 1073 |
<a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a> |
| 1074 |
!! wikitext |
| 1075 |
[[Foo|<nowiki>Foobar]</nowiki>]] |
| 1076 |
[[Foo|x <nowiki>[http://google.com g]</nowiki> x]] |
| 1077 |
[[Foo|<nowiki>[[Bar]]</nowiki>]] |
| 1078 |
[[Foo|<nowiki>x [[Bar]] x</nowiki>]] |
| 1079 |
[[Foo||Bar]] |
| 1080 |
[[Foo|<nowiki>]]bar</nowiki>]] |
| 1081 |
[[Foo|<nowiki>[[bar</nowiki>]] |
| 1082 |
[[Foo|<nowiki>x [[ y</nowiki>]] |
| 1083 |
[[Foo|<nowiki>x ]] y</nowiki>]] |
| 1084 |
[[Foo|<nowiki>x ]] y [[ z</nowiki>]] |
| 1085 |
!! html/php |
| 1086 |
<p><a href="/wiki/Foo" title="Foo">Foobar]</a> |
| 1087 |
<a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a> |
| 1088 |
<a href="/wiki/Foo" title="Foo">[[Bar]]</a> |
| 1089 |
<a href="/wiki/Foo" title="Foo">x [[Bar]] x</a> |
| 1090 |
<a href="/wiki/Foo" title="Foo">|Bar</a> |
| 1091 |
<a href="/wiki/Foo" title="Foo">]]bar</a> |
| 1092 |
<a href="/wiki/Foo" title="Foo">[[bar</a> |
| 1093 |
<a href="/wiki/Foo" title="Foo">x [[ y</a> |
| 1094 |
<a href="/wiki/Foo" title="Foo">x ]] y</a> |
| 1095 |
<a href="/wiki/Foo" title="Foo">x ]] y [[ z</a> |
| 1096 |
</p> |
| 1097 |
!! end |
| 1098 |
|
| 1099 |
!! test |
| 1100 |
Links 3. WikiLinks: No escapes needed |
| 1101 |
!! options |
| 1102 |
parsoid=html2wt |
| 1103 |
!! html/parsoid |
| 1104 |
<p><a rel="mw:WikiLink" href="Foo">[Foobar</a> |
| 1105 |
<a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p> |
| 1106 |
!! wikitext |
| 1107 |
[[Foo|[Foobar]] |
| 1108 |
[[Foo|foo|bar]] |
| 1109 |
!! html/php |
| 1110 |
<p><a href="/wiki/Foo" title="Foo">[Foobar</a> |
| 1111 |
<a href="/wiki/Foo" title="Foo">foo|bar</a> |
| 1112 |
</p> |
| 1113 |
!! end |
| 1114 |
|
| 1115 |
!! test |
| 1116 |
Links 4. ExtLinks: Escapes needed |
| 1117 |
!! options |
| 1118 |
parsoid=html2wt |
| 1119 |
!! html/parsoid |
| 1120 |
<p><a rel="mw:ExtLink" href="http://google.com">[google]</a> |
| 1121 |
<a rel="mw:ExtLink" href="http://google.com">google]</a> |
| 1122 |
<a rel="mw:ExtLink" href="http://google.com">goog] le</a></p> |
| 1123 |
<p>[http://google.com]</p> |
| 1124 |
<p>[http://google.com google]</p> |
| 1125 |
<p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p> |
| 1126 |
<p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p> |
| 1127 |
!! wikitext |
| 1128 |
[http://google.com <nowiki>[google]</nowiki>] |
| 1129 |
[http://google.com <nowiki>google]</nowiki>] |
| 1130 |
[http://google.com <nowiki>goog] le</nowiki>] |
| 1131 |
|
| 1132 |
<nowiki>[http://google.com]</nowiki> |
| 1133 |
|
| 1134 |
<nowiki>[http://google.com google]</nowiki> |
| 1135 |
|
| 1136 |
[http://google.com<nowiki>]</nowiki> |
| 1137 |
|
| 1138 |
[{{1x|http://google.com}}<nowiki>]</nowiki> |
| 1139 |
!! html/php |
| 1140 |
<p><a rel="nofollow" class="external text" href="http://google.com">[google]</a> |
| 1141 |
<a rel="nofollow" class="external text" href="http://google.com">google]</a> |
| 1142 |
<a rel="nofollow" class="external text" href="http://google.com">goog] le</a> |
| 1143 |
</p><p>[http://google.com] |
| 1144 |
</p><p>[http://google.com google] |
| 1145 |
</p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>] |
| 1146 |
</p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>] |
| 1147 |
</p> |
| 1148 |
!! end |
| 1149 |
|
| 1150 |
!! test |
| 1151 |
Links 5. ExtLinks: No escapes needed |
| 1152 |
!! options |
| 1153 |
parsoid=html2wt |
| 1154 |
!! html/parsoid |
| 1155 |
<p><a rel="mw:ExtLink" href="http://google.com">[google</a></p> |
| 1156 |
<p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p> |
| 1157 |
!! wikitext |
| 1158 |
[http://google.com [google] |
| 1159 |
|
| 1160 |
[[http://google.com]] |
| 1161 |
!! html/php |
| 1162 |
<p><a rel="nofollow" class="external text" href="http://google.com">[google</a> |
| 1163 |
</p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>] |
| 1164 |
</p> |
| 1165 |
!! end |
| 1166 |
|
| 1167 |
!! test |
| 1168 |
Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300) |
| 1169 |
!! options |
| 1170 |
parsoid=html2wt |
| 1171 |
!! html/parsoid |
| 1172 |
<p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y |
| 1173 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x |
| 1174 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&x |
| 1175 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x |
| 1176 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x |
| 1177 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x |
| 1178 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x |
| 1179 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x |
| 1180 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x |
| 1181 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x |
| 1182 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x |
| 1183 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x) |
| 1184 |
<a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>) |
| 1185 |
</p> |
| 1186 |
!! wikitext |
| 1187 |
x<nowiki/>http://example.com<nowiki/>y |
| 1188 |
http://example.com<nowiki/>?x |
| 1189 |
http://example.com<nowiki/>&x |
| 1190 |
http://example.com<nowiki/>'x |
| 1191 |
http://example.com<nowiki/>,x |
| 1192 |
http://example.com<nowiki/>.x |
| 1193 |
http://example.com<nowiki/>;x |
| 1194 |
http://example.com<nowiki/>:x |
| 1195 |
http://example.com<nowiki/>;x |
| 1196 |
http://example.com<nowiki/>!x |
| 1197 |
http://example.com<nowiki/>=x |
| 1198 |
http://example.com<nowiki/>(x) |
| 1199 |
http://example.com(x<nowiki/>) |
| 1200 |
!! end |
| 1201 |
|
| 1202 |
!! test |
| 1203 |
Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300) |
| 1204 |
!! options |
| 1205 |
parsoid=html2wt |
| 1206 |
!! html/parsoid |
| 1207 |
<p>x |
| 1208 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> |
| 1209 |
y |
| 1210 |
"<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>" |
| 1211 |
(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) |
| 1212 |
(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo |
| 1213 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, |
| 1214 |
<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo |
| 1215 |
</p> |
| 1216 |
!! wikitext |
| 1217 |
x |
| 1218 |
http://example.com |
| 1219 |
y |
| 1220 |
"http://example.com" |
| 1221 |
(http://example.com) |
| 1222 |
(http://example.com) foo |
| 1223 |
http://example.com, |
| 1224 |
http://example.com, foo |
| 1225 |
!! html/php |
| 1226 |
<p>x |
| 1227 |
<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> |
| 1228 |
y |
| 1229 |
"<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>" |
| 1230 |
(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) |
| 1231 |
(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo |
| 1232 |
<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, |
| 1233 |
<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo |
| 1234 |
</p> |
| 1235 |
!! end |
| 1236 |
|
| 1237 |
!! test |
| 1238 |
Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300) |
| 1239 |
!! options |
| 1240 |
parsoid=html2wt |
| 1241 |
!! html/parsoid |
| 1242 |
<p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\ |
| 1243 |
-<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p> |
| 1244 |
!! wikitext |
| 1245 |
http://example.com.,;:!?\ |
| 1246 |
-http://example.com: |
| 1247 |
!! html/php |
| 1248 |
<p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\ |
| 1249 |
-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>: |
| 1250 |
</p> |
| 1251 |
!! end |
| 1252 |
|
| 1253 |
!! test |
| 1254 |
Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300) |
| 1255 |
!! options |
| 1256 |
parsoid=html2wt |
| 1257 |
!! html/parsoid |
| 1258 |
<p><a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4 |
| 1259 |
<a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y |
| 1260 |
X<a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p> |
| 1261 |
!! wikitext |
| 1262 |
RFC 123<nowiki/>4 |
| 1263 |
RFC 123<nowiki/>y |
| 1264 |
X<nowiki/>RFC 123<nowiki/>y |
| 1265 |
!! end |
| 1266 |
|
| 1267 |
!! test |
| 1268 |
Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300) |
| 1269 |
!! options |
| 1270 |
parsoid=html2wt |
| 1271 |
!! html/parsoid |
| 1272 |
<p><a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo |
| 1273 |
<a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&foo |
| 1274 |
-<a href="https://datatracker.ietf.org/doc/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>- |
| 1275 |
</p> |
| 1276 |
!! wikitext |
| 1277 |
RFC 123?foo |
| 1278 |
RFC 123&foo |
| 1279 |
-RFC 123- |
| 1280 |
!! html/php |
| 1281 |
<p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc123">RFC 123</a>?foo |
| 1282 |
<a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc123">RFC 123</a>&foo |
| 1283 |
-<a class="external mw-magiclink-rfc" rel="nofollow" href="https://datatracker.ietf.org/doc/html/rfc123">RFC 123</a>- |
| 1284 |
</p> |
| 1285 |
!! end |
| 1286 |
|
| 1287 |
!! test |
| 1288 |
Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300) |
| 1289 |
!! options |
| 1290 |
parsoid=html2wt |
| 1291 |
!! html/parsoid |
| 1292 |
<p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4 |
| 1293 |
<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y |
| 1294 |
X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y |
| 1295 |
!! wikitext |
| 1296 |
PMID 123<nowiki/>4 |
| 1297 |
PMID 123<nowiki/>y |
| 1298 |
X<nowiki/>PMID 123<nowiki/>y |
| 1299 |
!! end |
| 1300 |
|
| 1301 |
!! test |
| 1302 |
Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300) |
| 1303 |
!! options |
| 1304 |
parsoid=html2wt |
| 1305 |
!! html/parsoid |
| 1306 |
<p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo |
| 1307 |
<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo |
| 1308 |
-<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>- |
| 1309 |
</p> |
| 1310 |
!! wikitext |
| 1311 |
PMID 123?foo |
| 1312 |
PMID 123&foo |
| 1313 |
-PMID 123- |
| 1314 |
!! html/php |
| 1315 |
<p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo |
| 1316 |
<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&foo |
| 1317 |
-<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>- |
| 1318 |
</p> |
| 1319 |
!! end |
| 1320 |
|
| 1321 |
!! test |
| 1322 |
Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300) |
| 1323 |
!! options |
| 1324 |
parsoid=html2wt |
| 1325 |
!! html/parsoid |
| 1326 |
<p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1 |
| 1327 |
<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x |
| 1328 |
a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b |
| 1329 |
</p> |
| 1330 |
!! wikitext |
| 1331 |
ISBN 1234567890<nowiki/>1 |
| 1332 |
ISBN 1234567890<nowiki/>x |
| 1333 |
a<nowiki/>ISBN 1234567890<nowiki/>b |
| 1334 |
!! end |
| 1335 |
|
| 1336 |
!! test |
| 1337 |
Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300) |
| 1338 |
!! options |
| 1339 |
parsoid=html2wt |
| 1340 |
!! html/parsoid |
| 1341 |
<p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s |
| 1342 |
!! wikitext |
| 1343 |
-ISBN 1234567890's |
| 1344 |
!! html/php |
| 1345 |
<p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s |
| 1346 |
</p> |
| 1347 |
!! end |
| 1348 |
|
| 1349 |
!! test |
| 1350 |
Links 14. Protect link-like plain text. (Parsoid bug T78425) |
| 1351 |
!! options |
| 1352 |
parsoid=html2wt |
| 1353 |
!! html/* |
| 1354 |
<p>this is not a link: http://example.com |
| 1355 |
</p> |
| 1356 |
!! wikitext |
| 1357 |
this is not a link: <nowiki>http://example.com</nowiki> |
| 1358 |
!! end |
| 1359 |
|
| 1360 |
!! test |
| 1361 |
Links 15. Link trails can't become link prefixes. |
| 1362 |
!! options |
| 1363 |
language=is |
| 1364 |
parsoid=html2wt |
| 1365 |
!! html/parsoid |
| 1366 |
<p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p> |
| 1367 |
!! wikitext |
| 1368 |
[[Söfnuður]]-[[00]] |
| 1369 |
!! html/php |
| 1370 |
<p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a> |
| 1371 |
</p> |
| 1372 |
!! end |
| 1373 |
|
| 1374 |
# This example actually from lnwiki, but arwiki has the same link |
| 1375 |
# prefix and equivalent link trail for this purpose. |
| 1376 |
!! test |
| 1377 |
Links 17. Link trails (T236183) |
| 1378 |
!! options |
| 1379 |
language=ar |
| 1380 |
!! wikitext |
| 1381 |
[[Likalo]] · |
| 1382 |
[[Pusupúsu]] · |
| 1383 |
!! html/php |
| 1384 |
<p><a href="/index.php?title=Likalo&action=edit&redlink=1" class="new" title="Likalo (الصفحة غير موجودة)">Likalo</a> · |
| 1385 |
<a href="/index.php?title=Pusup%C3%BAsu&action=edit&redlink=1" class="new" title="Pusupúsu (الصفحة غير موجودة)">Pusupúsu</a> · |
| 1386 |
</p> |
| 1387 |
!! html/parsoid |
| 1388 |
<p><a rel="mw:WikiLink" href="./Likalo?action=edit&redlink=1" title="Likalo" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Likalo"},"sa":{"href":"Likalo"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Likalo"]}}'>Likalo</a><span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>· |
| 1389 |
<a rel="mw:WikiLink" href="./Pusupúsu?action=edit&redlink=1" title="Pusupúsu" class="new" typeof="mw:LocalizedAttrs" data-parsoid='{"stx":"simple","a":{"href":"./Pusupúsu"},"sa":{"href":"Pusupúsu"}}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Pusupúsu"]}}'>Pusupúsu</a><span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>·</p> |
| 1390 |
!! end |
| 1391 |
|
| 1392 |
#### --------------- Quotes --------------- |
| 1393 |
#### 1. Quotes inside <b> and <i> |
| 1394 |
#### 2. Link fragments separated by <i> and <b> tags |
| 1395 |
#### 3. Link fragments inside <i> and <b> |
| 1396 |
#### 4. No escaping needed |
| 1397 |
#### -------------------------------------- |
| 1398 |
!! test |
| 1399 |
1a. Quotes inside <b> and <i> |
| 1400 |
!! options |
| 1401 |
parsoid=html2wt |
| 1402 |
!! html/* |
| 1403 |
<p><i>'foo'</i> |
| 1404 |
<i>''foo''</i> |
| 1405 |
<i>'''foo'''</i> |
| 1406 |
<i>foo</i>'s |
| 1407 |
<b>'foo'</b> |
| 1408 |
<b>''foo''</b> |
| 1409 |
<b>'''foo'''</b> |
| 1410 |
<b>foo'<i>bar'</i>baz</b> |
| 1411 |
<b>foo</b>'s |
| 1412 |
'<i>foo</i> |
| 1413 |
<i>foo</i>' |
| 1414 |
<i>foo'</i>' |
| 1415 |
'<i>foo</i>' |
| 1416 |
'<b>foo</b> |
| 1417 |
<b>foo</b>' |
| 1418 |
'<b>foo</b>' |
| 1419 |
<i>fools'<span> errand</span></i> |
| 1420 |
<i><span>fool</span>'s errand</i> |
| 1421 |
'<i>foo</i> bar '<i>baz</i> |
| 1422 |
a|!*#-:;+-~[]{}b'<i>x</i> |
| 1423 |
</p> |
| 1424 |
!! wikitext |
| 1425 |
''<nowiki/>'foo''' |
| 1426 |
''<nowiki>''foo''</nowiki>'' |
| 1427 |
''<nowiki>'''foo'''</nowiki>'' |
| 1428 |
''foo''<nowiki/>'s |
| 1429 |
'''<nowiki/>'foo'''' |
| 1430 |
'''<nowiki>''foo''</nowiki>''' |
| 1431 |
'''<nowiki>'''foo'''</nowiki>''' |
| 1432 |
'''foo'<nowiki/>''bar'<nowiki/>''baz''' |
| 1433 |
'''foo'''<nowiki/>'s |
| 1434 |
'''foo'' |
| 1435 |
''foo''<nowiki/>' |
| 1436 |
''foo'''<nowiki/>' |
| 1437 |
'''foo''<nowiki/>' |
| 1438 |
''''foo''' |
| 1439 |
'''foo'''<nowiki/>' |
| 1440 |
''''foo'''<nowiki/>' |
| 1441 |
''fools'<span> errand</span>'' |
| 1442 |
''<span>fool</span>'s errand'' |
| 1443 |
'<nowiki/>''foo'' bar '''baz'' |
| 1444 |
a|!*#-:;+-~[]{}b'''x'' |
| 1445 |
!! end |
| 1446 |
|
| 1447 |
!! test |
| 1448 |
1b. Quotes inside <b> and <i> with other tags on same line |
| 1449 |
!! options |
| 1450 |
parsoid=html2wt |
| 1451 |
!! html/parsoid |
| 1452 |
'<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> |
| 1453 |
<i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i> |
| 1454 |
<i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b> |
| 1455 |
<a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i> |
| 1456 |
'<i>foo</i> <span typeof="mw:Extension/spantag" about="#mwt3" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"test"}}'>test</span> |
| 1457 |
'<i>foo</i> <div title="name">test</div> |
| 1458 |
'<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar |
| 1459 |
!! wikitext |
| 1460 |
'''a'' foo ''[[bar]]'' |
| 1461 |
''a''' foo ''[[bar]]'' |
| 1462 |
''a''' foo '''{{1x|[[bar]]}}''' |
| 1463 |
[[foo]] x'''[[bar]]'' |
| 1464 |
'''foo'' <spantag>test</spantag> |
| 1465 |
'''foo'' <div title="name">test</div> |
| 1466 |
'''foo'' and <br> bar |
| 1467 |
!! end |
| 1468 |
|
| 1469 |
!! test |
| 1470 |
2. Link fragments separated by <i> and <b> tags |
| 1471 |
!! options |
| 1472 |
parsoid=html2wt |
| 1473 |
!! html/parsoid |
| 1474 |
<p>[[<i>foo</i>hello]]</p> |
| 1475 |
<p>[[<b>foo</b>hello]]</p> |
| 1476 |
!! wikitext |
| 1477 |
[[''foo''<nowiki>hello]]</nowiki> |
| 1478 |
|
| 1479 |
[['''foo'''<nowiki>hello]]</nowiki> |
| 1480 |
!! end |
| 1481 |
|
| 1482 |
# FIXME: Escaping one or both of [[ and ]] is also acceptable -- |
| 1483 |
# this is one of the shortcomings of this format |
| 1484 |
!! test |
| 1485 |
3. Link fragments inside <i> and <b> |
| 1486 |
!! options |
| 1487 |
parsoid=html2wt |
| 1488 |
!! html/parsoid |
| 1489 |
<p><i>[[foo</i>]]</p> |
| 1490 |
<p><b>[[foo</b>]]</p> |
| 1491 |
!! wikitext |
| 1492 |
''[[foo''<nowiki>]]</nowiki> |
| 1493 |
|
| 1494 |
'''[[foo'''<nowiki>]]</nowiki> |
| 1495 |
!! end |
| 1496 |
|
| 1497 |
!! test |
| 1498 |
4. No escaping needed |
| 1499 |
!! options |
| 1500 |
parsoid=html2wt |
| 1501 |
!! html/parsoid |
| 1502 |
<p>'<span><i>bar</i></span>' |
| 1503 |
'<span><b>bar</b></span>' |
| 1504 |
'a:b'foo |
| 1505 |
</p> |
| 1506 |
!! wikitext |
| 1507 |
'<span>''bar''</span>' |
| 1508 |
'<span>'''bar'''</span>' |
| 1509 |
'a:b'foo |
| 1510 |
!! end |
| 1511 |
|
| 1512 |
#### ----------- Paragraphs --------------- |
| 1513 |
#### 1. No unnecessary escapes |
| 1514 |
#### -------------------------------------- |
| 1515 |
|
| 1516 |
!! test |
| 1517 |
1. No unnecessary escapes |
| 1518 |
!! options |
| 1519 |
parsoid=html2wt |
| 1520 |
!! html/parsoid |
| 1521 |
<p>bar <span>[[foo]]</span> |
| 1522 |
</p><p>=bar <span>[[foo]]</span> |
| 1523 |
</p><p>[[bar <span>[[foo]]</span> |
| 1524 |
</p><p>]]bar <span>[[foo]]</span> |
| 1525 |
</p><p>=bar <span>foo]]</span>= |
| 1526 |
</p> |
| 1527 |
!! wikitext |
| 1528 |
bar <span><nowiki>[[foo]]</nowiki></span> |
| 1529 |
|
| 1530 |
=bar <span><nowiki>[[foo]]</nowiki></span> |
| 1531 |
|
| 1532 |
[[bar <span><nowiki>[[foo]]</nowiki></span> |
| 1533 |
|
| 1534 |
]]bar <span><nowiki>[[foo]]</nowiki></span> |
| 1535 |
|
| 1536 |
=bar <span>foo]]</span><nowiki>=</nowiki> |
| 1537 |
!!end |
| 1538 |
|
| 1539 |
#### ----------------------- PRE -------------------------- |
| 1540 |
|
| 1541 |
!! test |
| 1542 |
1. Leading whitespace in SOL context should be stripped |
| 1543 |
!! options |
| 1544 |
parsoid=html2wt |
| 1545 |
!! html/parsoid |
| 1546 |
<p> a</p> |
| 1547 |
|
| 1548 |
<p> a</p> |
| 1549 |
|
| 1550 |
<p> a(tab)</p> |
| 1551 |
|
| 1552 |
<p> a |
| 1553 |
<!--cmt--> |
| 1554 |
a</p> |
| 1555 |
|
| 1556 |
<p>a |
| 1557 |
b</p> |
| 1558 |
|
| 1559 |
<p>a |
| 1560 |
b</p> |
| 1561 |
|
| 1562 |
<p>a |
| 1563 |
b</p> |
| 1564 |
!! wikitext |
| 1565 |
a |
| 1566 |
|
| 1567 |
a |
| 1568 |
|
| 1569 |
a(tab) |
| 1570 |
|
| 1571 |
a |
| 1572 |
<!--cmt--> |
| 1573 |
a |
| 1574 |
|
| 1575 |
a |
| 1576 |
b |
| 1577 |
|
| 1578 |
a |
| 1579 |
b |
| 1580 |
|
| 1581 |
a |
| 1582 |
b |
| 1583 |
!! html/php |
| 1584 |
<p>a |
| 1585 |
</p><p>a |
| 1586 |
</p><p> a(tab) |
| 1587 |
</p><p>a |
| 1588 |
a |
| 1589 |
</p><p>a |
| 1590 |
b |
| 1591 |
</p><p>a |
| 1592 |
b |
| 1593 |
</p><p>a |
| 1594 |
b |
| 1595 |
</p> |
| 1596 |
!! end |
| 1597 |
|
| 1598 |
!! test |
| 1599 |
2. Leading whitespace in non-indent-pre contexts should not be escaped |
| 1600 |
!! options |
| 1601 |
parsoid=html2wt |
| 1602 |
!! html/parsoid |
| 1603 |
<p>foo <span typeof="mw:Extension/spantag" about="#mwt2" data-mw='{"name":"spantag","attrs":{},"body":{"extsrc":"''a''\n b"}}'><i>a</i> |
| 1604 |
b</span></p> |
| 1605 |
!! wikitext |
| 1606 |
foo <spantag>''a'' |
| 1607 |
b</spantag> |
| 1608 |
!! end |
| 1609 |
|
| 1610 |
!! test |
| 1611 |
3. Leading whitespace in indent-pre suppressing contexts should not be escaped |
| 1612 |
!! options |
| 1613 |
parsoid=html2wt |
| 1614 |
!! html/parsoid |
| 1615 |
<blockquote> |
| 1616 |
<p> |
| 1617 |
a |
| 1618 |
<span>b</span> |
| 1619 |
c</p> |
| 1620 |
</blockquote> |
| 1621 |
!! wikitext |
| 1622 |
<blockquote> |
| 1623 |
a |
| 1624 |
<span>b</span> |
| 1625 |
c |
| 1626 |
</blockquote> |
| 1627 |
!! end |
| 1628 |
|
| 1629 |
!! test |
| 1630 |
4. Leading whitespace in indent-pre suppressing contexts should not be escaped |
| 1631 |
!! options |
| 1632 |
parsoid=html2wt |
| 1633 |
!! html/parsoid |
| 1634 |
<figure class="mw-default-size" typeof="mw:File/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure> |
| 1635 |
!! wikitext |
| 1636 |
[[File:Foobar.jpg|thumb|caption]] |
| 1637 |
!! end |
| 1638 |
|
| 1639 |
!! test |
| 1640 |
5. Nowiki escaping should account for indent-pres |
| 1641 |
!! options |
| 1642 |
parsoid=html2wt |
| 1643 |
!! html/parsoid |
| 1644 |
<pre>==foo==</pre> |
| 1645 |
!! wikitext |
| 1646 |
==foo== |
| 1647 |
!! end |
| 1648 |
|
| 1649 |
!! test |
| 1650 |
T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block |
| 1651 |
!! options |
| 1652 |
parsoid=html2wt |
| 1653 |
!! html/parsoid |
| 1654 |
<pre> |
| 1655 |
* foo |
| 1656 |
* bar |
| 1657 |
</pre> |
| 1658 |
!! wikitext |
| 1659 |
* foo |
| 1660 |
* bar |
| 1661 |
!! end |
| 1662 |
|
| 1663 |
!! test |
| 1664 |
Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup |
| 1665 |
!! options |
| 1666 |
parsoid = { |
| 1667 |
"modes": ["html2wt"] |
| 1668 |
} |
| 1669 |
!! html/parsoid |
| 1670 |
<p> foo</p> |
| 1671 |
<p> %foo</p> |
| 1672 |
<p> *foo</p> |
| 1673 |
<p> #foo</p> |
| 1674 |
<p> =foo=</p> |
| 1675 |
<p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p> |
| 1676 |
<p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p> |
| 1677 |
<p> <!--boo-->*foo</p> |
| 1678 |
<p><!--boo--> *foo</p> |
| 1679 |
<p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p> |
| 1680 |
<p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p> |
| 1681 |
!! wikitext |
| 1682 |
foo |
| 1683 |
|
| 1684 |
%foo |
| 1685 |
|
| 1686 |
<nowiki/>*foo |
| 1687 |
|
| 1688 |
<nowiki/>#foo |
| 1689 |
|
| 1690 |
<nowiki/>=foo= |
| 1691 |
|
| 1692 |
[[Category:Foo]] |
| 1693 |
<nowiki/>*foo |
| 1694 |
|
| 1695 |
[[Category:Foo]] |
| 1696 |
<nowiki>*</nowiki>foo |
| 1697 |
|
| 1698 |
<nowiki/><!--boo-->*foo |
| 1699 |
|
| 1700 |
<!--boo--><nowiki/>*foo |
| 1701 |
|
| 1702 |
<!--a--><!--b--><!--c--><!--d--><!--e-->foo |
| 1703 |
|
| 1704 |
<!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo |
| 1705 |
!! end |
| 1706 |
|
| 1707 |
#### --------------- Behavior Switches -------------------- |
| 1708 |
|
| 1709 |
!! test |
| 1710 |
1. Valid behavior switches should be escaped |
| 1711 |
!! options |
| 1712 |
parsoid=html2wt |
| 1713 |
!! html/parsoid |
| 1714 |
__TOC__ |
| 1715 |
<i>__TOC__</i> |
| 1716 |
!! wikitext |
| 1717 |
<nowiki>__TOC__</nowiki> |
| 1718 |
''<nowiki>__TOC__</nowiki>'' |
| 1719 |
!! end |
| 1720 |
|
| 1721 |
!! test |
| 1722 |
2. Invalid behavior switches should not be escaped |
| 1723 |
!! options |
| 1724 |
parsoid=html2wt |
| 1725 |
!! html/parsoid |
| 1726 |
__TOO__ |
| 1727 |
__|__ |
| 1728 |
!! wikitext |
| 1729 |
__TOO__ |
| 1730 |
__|__ |
| 1731 |
!! end |
| 1732 |
|
| 1733 |
# We use indent-pre as an indirect way to test for sol-transparent behavior. |
| 1734 |
!! test |
| 1735 |
Behavior switches should be SOL-transparent |
| 1736 |
!! options |
| 1737 |
parsoid=html2wt |
| 1738 |
!! html/parsoid |
| 1739 |
<meta property="mw:PageProp/toc" /> |
| 1740 |
|
| 1741 |
<!-- this one's bogus --> |
| 1742 |
<pre>__TOO__</pre> |
| 1743 |
|
| 1744 |
<pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre> |
| 1745 |
|
| 1746 |
<meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre> |
| 1747 |
!! wikitext |
| 1748 |
__TOC__ |
| 1749 |
|
| 1750 |
<!-- this one's bogus --> |
| 1751 |
__TOO__ |
| 1752 |
|
| 1753 |
__TOC__ foo |
| 1754 |
|
| 1755 |
__TOC__ |
| 1756 |
bar |
| 1757 |
!! end |
| 1758 |
|
| 1759 |
# last two <meta> tags test case-insensitivity |
| 1760 |
!! test |
| 1761 |
During serialization, normalize output when given a SOL-transparent prefix |
| 1762 |
!! options |
| 1763 |
parsoid=html2wt |
| 1764 |
!! html/parsoid |
| 1765 |
<p> x</p> |
| 1766 |
<p><meta property="mw:PageProp/notoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/> y</p> |
| 1767 |
<p><meta property="mw:PageProp/notoc" data-parsoid='{"src":"__NotoC__","magicSrc":"__NotoC__"}'/> z</p> |
| 1768 |
<p><meta property="mw:PageProp/notoc" data-parsoid='{"src":"__notoc__","magicSrc":"__notoc__"}'/> p</p> |
| 1769 |
!! wikitext |
| 1770 |
x |
| 1771 |
|
| 1772 |
__NOTOC__y |
| 1773 |
|
| 1774 |
__NOTOC__z |
| 1775 |
|
| 1776 |
__notoc__p |
| 1777 |
!! end |
| 1778 |
|
| 1779 |
#### --------------- HTML tags --------------- |
| 1780 |
#### 1. a tags |
| 1781 |
#### 2. other tags |
| 1782 |
#### 3. multi-line html tag |
| 1783 |
#### 4. extension tags |
| 1784 |
#### ----------------------------------------- |
| 1785 |
!! test |
| 1786 |
1. a tags |
| 1787 |
!! options |
| 1788 |
parsoid=html2wt |
| 1789 |
!! html/parsoid |
| 1790 |
<a href="http://google.com">google</a> |
| 1791 |
!! wikitext |
| 1792 |
<a href="http://google.com">google</a> |
| 1793 |
!! end |
| 1794 |
|
| 1795 |
!! test |
| 1796 |
2. other tags |
| 1797 |
!! options |
| 1798 |
parsoid=html2wt |
| 1799 |
!! html/parsoid |
| 1800 |
<ul><li> <div>foo</div></li> |
| 1801 |
<li> <div style="color:red">foo</div></li> |
| 1802 |
<li> <td></li></ul> |
| 1803 |
|
| 1804 |
!! wikitext |
| 1805 |
* <nowiki><div>foo</div></nowiki> |
| 1806 |
* <nowiki><div style="color:red">foo</div></nowiki> |
| 1807 |
* <nowiki><td></nowiki> |
| 1808 |
!! end |
| 1809 |
|
| 1810 |
!! test |
| 1811 |
3. multi-line html tag |
| 1812 |
!! options |
| 1813 |
parsoid=html2wt |
| 1814 |
!! html/parsoid |
| 1815 |
<p><div |
| 1816 |
>foo</div |
| 1817 |
> |
| 1818 |
</p> |
| 1819 |
!! wikitext |
| 1820 |
<nowiki><div |
| 1821 |
>foo</div |
| 1822 |
></nowiki> |
| 1823 |
!! end |
| 1824 |
|
| 1825 |
!! test |
| 1826 |
4. extension tags |
| 1827 |
!! options |
| 1828 |
parsoid=html2wt |
| 1829 |
!! html/parsoid |
| 1830 |
<p><ref>foo</ref> |
| 1831 |
</p><p><ref>bar |
| 1832 |
</p><p>baz</ref> |
| 1833 |
</p> |
| 1834 |
!! wikitext |
| 1835 |
<nowiki><ref>foo</ref></nowiki> |
| 1836 |
|
| 1837 |
<nowiki><ref>bar</nowiki> |
| 1838 |
|
| 1839 |
baz<nowiki></ref></nowiki> |
| 1840 |
!! end |
| 1841 |
|
| 1842 |
## FIXME: This test is less useful now that the leading space is normalized away |
| 1843 |
!! test |
| 1844 |
Parsoid: newline inducing block nodes don't suppress <nowiki> |
| 1845 |
!! options |
| 1846 |
parsoid=html2wt |
| 1847 |
!! html/parsoid |
| 1848 |
a<h1>foo</h1> |
| 1849 |
!! wikitext |
| 1850 |
a |
| 1851 |
|
| 1852 |
= foo = |
| 1853 |
!! end |
| 1854 |
|
| 1855 |
#### --------------- Others --------------- |
| 1856 |
|
| 1857 |
!! test |
| 1858 |
Escaping nowikis |
| 1859 |
!! options |
| 1860 |
parsoid=html2wt |
| 1861 |
!! html/parsoid |
| 1862 |
<p><nowiki>foo</nowiki> |
| 1863 |
</p> |
| 1864 |
!! wikitext |
| 1865 |
<nowiki>foo</nowiki> |
| 1866 |
!! end |
| 1867 |
|
| 1868 |
## The quote-char in the input is necessary for triggering the bug |
| 1869 |
!! test |
| 1870 |
(T54035) Nowiki-escaping should not get tripped by " :" in text |
| 1871 |
!! options |
| 1872 |
parsoid=html2wt |
| 1873 |
!! html/parsoid |
| 1874 |
<p>foo's bar :</p> |
| 1875 |
!! wikitext |
| 1876 |
foo's bar : |
| 1877 |
!! end |
| 1878 |
|
| 1879 |
!! test |
| 1880 |
Ensure that when a leading-whitespace-containing string is emitted on a newline, it is correctly escaped |
| 1881 |
!! options |
| 1882 |
parsoid={ |
| 1883 |
"modes": ["selser"], |
| 1884 |
"selser": "noauto", |
| 1885 |
"changes": [ |
| 1886 |
[ "div > p", "html", "DEF" ] |
| 1887 |
] |
| 1888 |
} |
| 1889 |
!! wikitext |
| 1890 |
<div> |
| 1891 |
ABC |
| 1892 |
{{1x| |
| 1893 |
{{{!}} |
| 1894 |
{{!}} a |
| 1895 |
{{!}}}}} b |
| 1896 |
!! wikitext/edited |
| 1897 |
<div> |
| 1898 |
DEF |
| 1899 |
{{1x| |
| 1900 |
{{{!}} |
| 1901 |
{{!}} a |
| 1902 |
{{!}}}}} b |
| 1903 |
!! end |