| 1 |
# The parsoid-compatible option below is only relevant when we are running |
| 2 |
# parser tests in integrated mode with Parsoid. This option is ignored |
| 3 |
# when this test file is run with Parsoid in standalone mode. |
| 4 |
!! options |
| 5 |
parsoid-compatible=wt2html,wt2wt |
| 6 |
version=2 |
| 7 |
!! end |
| 8 |
|
| 9 |
!!article |
| 10 |
Foo |
| 11 |
!!text |
| 12 |
FOO |
| 13 |
!!endarticle |
| 14 |
|
| 15 |
!! article |
| 16 |
Template:1x |
| 17 |
!! text |
| 18 |
{{{1}}} |
| 19 |
!! endarticle |
| 20 |
|
| 21 |
!!article |
| 22 |
Template:Bullet |
| 23 |
!!text |
| 24 |
*Bar |
| 25 |
!!endarticle |
| 26 |
|
| 27 |
!! article |
| 28 |
Template:Precedence5 |
| 29 |
!! text |
| 30 |
{{{{{1}}}}} |
| 31 |
!! endarticle |
| 32 |
|
| 33 |
!! article |
| 34 |
Template:Preprocessor_precedence_9 |
| 35 |
!! text |
| 36 |
;4: {{{{1}}}} |
| 37 |
;5: {{{{{2}}}}} |
| 38 |
;6: {{{{{{3}}}}}} |
| 39 |
;7: {{{{{{{4}}}}}}} |
| 40 |
!! endarticle |
| 41 |
|
| 42 |
!! article |
| 43 |
Template:Preprocessor_precedence_10 |
| 44 |
!! text |
| 45 |
;1: -{R|raw}- |
| 46 |
;2: -{{Bullet}}- |
| 47 |
;3: -{{{1}}}- |
| 48 |
;4: -{{{{2}}}}- |
| 49 |
;5: -{{{{{3}}}}}- |
| 50 |
;6: -{{{{{{4}}}}}}- |
| 51 |
;7: -{{{{{{{5}}}}}}}- |
| 52 |
!! endarticle |
| 53 |
|
| 54 |
### |
| 55 |
### Preprocessor precedence tests |
| 56 |
### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF |
| 57 |
### |
| 58 |
##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]] |
| 59 |
!! test |
| 60 |
Preprocessor precedence 1: link is rightmost opening |
| 61 |
!! options |
| 62 |
parsoid=wt2html |
| 63 |
!! wikitext |
| 64 |
{{[[Foo|bar}}]] |
| 65 |
|
| 66 |
But close-brace is not a valid character in a link title: |
| 67 |
{{[[Foo}}|bar]] |
| 68 |
|
| 69 |
However, we can still tell this was handled as a link in the preprocessor: |
| 70 |
{{1x|[[Foo}}|bar]]|bat}} |
| 71 |
!! html/php |
| 72 |
<p>{{<a href="/wiki/Foo" title="Foo">bar}}</a> |
| 73 |
</p><p>But close-brace is not a valid character in a link title: |
| 74 |
{{[[Foo}}|bar]] |
| 75 |
</p><p>However, we can still tell this was handled as a link in the preprocessor: |
| 76 |
[[Foo}}|bar]] |
| 77 |
</p> |
| 78 |
!! html/parsoid |
| 79 |
<p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p> |
| 80 |
<p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p> |
| 81 |
<p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p> |
| 82 |
!! end |
| 83 |
|
| 84 |
!! test |
| 85 |
Preprocessor precedence 2: template is rightmost opening |
| 86 |
!! options |
| 87 |
language=zh |
| 88 |
!! wikitext |
| 89 |
-{{1x|foo}-}}- |
| 90 |
!! html/php |
| 91 |
<p>-foo}-- |
| 92 |
</p> |
| 93 |
!! html/parsoid |
| 94 |
<p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p> |
| 95 |
!! end |
| 96 |
|
| 97 |
!! test |
| 98 |
Preprocessor precedence 3: language converter is rightmost opening |
| 99 |
!! options |
| 100 |
language=zh |
| 101 |
parsoid=wt2html |
| 102 |
!! wikitext |
| 103 |
{{1x|hi}} |
| 104 |
|
| 105 |
{{-{R|1x|hi}}}- |
| 106 |
|
| 107 |
[[-{R|raw]]}- |
| 108 |
!! html/php |
| 109 |
<p>hi |
| 110 |
</p><p>{{1x|hi}} |
| 111 |
</p><p>[[raw]] |
| 112 |
</p> |
| 113 |
!! html/parsoid |
| 114 |
<p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></p> |
| 115 |
<p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"1x|hi}}"}}'></span></p> |
| 116 |
<p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p> |
| 117 |
!! end |
| 118 |
|
| 119 |
!! test |
| 120 |
Preprocessor precedence 4: left-most angle bracket |
| 121 |
!! options |
| 122 |
language=zh |
| 123 |
!! wikitext |
| 124 |
<!--{raw}--> |
| 125 |
!! html/php |
| 126 |
!! html/parsoid |
| 127 |
<!--{raw}--> |
| 128 |
!! end |
| 129 |
|
| 130 |
!! test |
| 131 |
Preprocessor precedence 5: tplarg takes precedence over template |
| 132 |
!! wikitext |
| 133 |
{{Precedence5|Bullet}} |
| 134 |
!! html/php |
| 135 |
<ul><li>Bar</li></ul> |
| 136 |
!! html/parsoid |
| 137 |
<ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul> |
| 138 |
!! end |
| 139 |
|
| 140 |
!! test |
| 141 |
Preprocessor precedence 6: broken link is rightmost opening |
| 142 |
!! options |
| 143 |
parsoid=wt2html |
| 144 |
!! wikitext |
| 145 |
{{1x|[[Foo}} |
| 146 |
|
| 147 |
{{1x|[[Foo|bar|bat=baz}} |
| 148 |
!! html/php |
| 149 |
<p>{{1x|[[Foo}} |
| 150 |
</p><p>{{1x|[[Foo|bar|bat=baz}} |
| 151 |
</p> |
| 152 |
!! html/parsoid |
| 153 |
<p>{{1x|[[Foo}}</p> |
| 154 |
<p>{{1x|[[Foo|bar|bat=baz}}</p> |
| 155 |
!! end |
| 156 |
|
| 157 |
# This next test exposes a difference between PHP and Parsoid: |
| 158 |
# Given [[Foo|{{1x|Bar]]x}}y]]z: |
| 159 |
# 1) Both PHP and Parsoid ignore the `]]` inside the `1x` in the |
| 160 |
# "preprocessor" stage. The `{{1x` extends until the `x}}`, and the |
| 161 |
# outer `[[Foo` extends until the `y]]` |
| 162 |
# 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an |
| 163 |
# intermediate result (after template expansion), and link processing |
| 164 |
# happens on this intermediate result, which moves the wikilink |
| 165 |
# boundary leftward to `[[Foo|Bar]]` |
| 166 |
# 2b) Parsoid works in a single step, so it's going to keep the |
| 167 |
# wikilink as extending to the `y]]` |
| 168 |
# 3a) Then PHP does linktrail processing which slurps up the trailing |
| 169 |
# `xy` inside the link. |
| 170 |
# 3b) Parsoid will do linktrail processing to slurp up the trailing |
| 171 |
# `z` inside the link. |
| 172 |
# This is "correct" behavior. Parsoid's basic worldview is that the |
| 173 |
# `]]` inside the template shouldn't be allowed to leak out to affect |
| 174 |
# the surrounding wikilink. PHP may match Parsoid (in the future) |
| 175 |
# if you use {{#balance}} (T114445). |
| 176 |
|
| 177 |
!! test |
| 178 |
Preprocessor precedence 7: broken template is rightmost opening |
| 179 |
!! options |
| 180 |
parsoid=wt2html |
| 181 |
!! wikitext |
| 182 |
[[Foo|{{1x|Bar]] |
| 183 |
|
| 184 |
[[Foo|{{1x|Bar]]-x}}-y]]-z |
| 185 |
|
| 186 |
Careful: linktrails can move the end of the wikilink: |
| 187 |
[[Foo|{{1x|y']]a}}l]]l |
| 188 |
!! html/php |
| 189 |
<p><a href="/wiki/Foo" title="Foo">{{1x|Bar</a> |
| 190 |
</p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z |
| 191 |
</p><p>Careful: linktrails can move the end of the wikilink: |
| 192 |
<a href="/wiki/Foo" title="Foo">y'al</a>]]l |
| 193 |
</p> |
| 194 |
!! html/parsoid |
| 195 |
<p>[[Foo|{{1x|Bar]]</p> |
| 196 |
<p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p> |
| 197 |
<p>Careful: linktrails can move the end of the wikilink: |
| 198 |
<a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"y']]a"}},"i":0}}]}'>y']]a</span>ll</a></p> |
| 199 |
!! end |
| 200 |
|
| 201 |
!! test |
| 202 |
Preprocessor precedence 8: broken language converter is rightmost opening |
| 203 |
!! options |
| 204 |
language=zh |
| 205 |
!! wikitext |
| 206 |
[[Foo-{R|raw]] |
| 207 |
!! html |
| 208 |
<p>[[Foo-{R|raw]] |
| 209 |
</p> |
| 210 |
!! end |
| 211 |
|
| 212 |
!! test |
| 213 |
Preprocessor precedence 9: groups of braces |
| 214 |
!! wikitext |
| 215 |
{{Preprocessor precedence 9|Four|Bullet|1|2}} |
| 216 |
!! html/php |
| 217 |
<dl><dt>4</dt> |
| 218 |
<dd>{Four}</dd> |
| 219 |
<dt>5</dt> |
| 220 |
<dd></dd></dl> |
| 221 |
<ul><li>Bar</li></ul> |
| 222 |
<dl><dt>6</dt> |
| 223 |
<dd>Four</dd> |
| 224 |
<dt>7</dt> |
| 225 |
<dd>{Bullet}</dd></dl> |
| 226 |
!! html/parsoid+standalone |
| 227 |
<dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'><dt>4</dt><dd>{Four}</dd> |
| 228 |
<dt>5</dt><dd></dd></dl><ul about="#mwt1"><li>Bar</li></ul><span about="#mwt1"> |
| 229 |
</span><dl about="#mwt1"><dt>6</dt><dd>Four</dd> |
| 230 |
<dt>7</dt><dd>{Bullet}</dd></dl> |
| 231 |
!! html/parsoid+integrated |
| 232 |
<dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'><dt>4</dt><dd>{Four}</dd> |
| 233 |
<dt>5</dt><dd></dd></dl><span about="#mwt1"> |
| 234 |
</span><ul about="#mwt1"><li>Bar</li></ul><span about="#mwt1"> |
| 235 |
</span><dl about="#mwt1"><dt>6</dt><dd>Four</dd> |
| 236 |
<dt>7</dt><dd>{Bullet}</dd></dl> |
| 237 |
!! end |
| 238 |
|
| 239 |
!! test |
| 240 |
Preprocessor precedence 10: groups of braces with leading dash |
| 241 |
!! options |
| 242 |
language=zh |
| 243 |
!! wikitext |
| 244 |
{{Preprocessor precedence 10|Three|raw2|Bullet|1|2}} |
| 245 |
!! html/php |
| 246 |
<dl><dt>1</dt> |
| 247 |
<dd>raw</dd> |
| 248 |
<dt>2</dt> |
| 249 |
<dd>-</dd></dl> |
| 250 |
<ul><li>Bar-</li></ul> |
| 251 |
<dl><dt>3</dt> |
| 252 |
<dd>-Three-</dd> |
| 253 |
<dt>4</dt> |
| 254 |
<dd>raw2</dd> |
| 255 |
<dt>5</dt> |
| 256 |
<dd>-</dd></dl> |
| 257 |
<ul><li>Bar-</li></ul> |
| 258 |
<dl><dt>6</dt> |
| 259 |
<dd>-Three-</dd> |
| 260 |
<dt>7</dt> |
| 261 |
<dd>raw2</dd></dl> |
| 262 |
!! html/parsoid+standalone |
| 263 |
<dl about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"},{"k":"4"},{"k":"5"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'><dt>1</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd> |
| 264 |
<dt>2</dt><dd>-</dd></dl><ul about="#mwt1"><li>Bar-</li></ul><span about="#mwt1"> |
| 265 |
</span><dl about="#mwt1"><dt>3</dt><dd>-Three-</dd> |
| 266 |
<dt>4</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd> |
| 267 |
<dt>5</dt><dd>-</dd></dl><ul about="#mwt1"><li>Bar-</li></ul><span about="#mwt1"> |
| 268 |
</span><dl about="#mwt1"><dt>6</dt><dd>-Three-</dd> |
| 269 |
<dt>7</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd></dl> |
| 270 |
!! html/parsoid+integrated |
| 271 |
<dl about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"},{"k":"4"},{"k":"5"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'><dt>1</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd> |
| 272 |
<dt>2</dt><dd>-</dd></dl><span about="#mwt1"> |
| 273 |
</span><ul about="#mwt1"><li>Bar-</li></ul><span about="#mwt1"> |
| 274 |
</span><dl about="#mwt1"><dt>3</dt><dd>-Three-</dd> |
| 275 |
<dt>4</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd> |
| 276 |
<dt>5</dt><dd>-</dd></dl><span about="#mwt1"> |
| 277 |
</span><ul about="#mwt1"><li>Bar-</li></ul><span about="#mwt1"> |
| 278 |
</span><dl about="#mwt1"><dt>6</dt><dd>-Three-</dd> |
| 279 |
<dt>7</dt><dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd></dl> |
| 280 |
!! end |
| 281 |
|
| 282 |
!! test |
| 283 |
Preprocessor precedence 11: found during visual diff testing |
| 284 |
!! wikitext |
| 285 |
{{#tag:span|-{{#tag:span|-{{1x|x}}}}}} |
| 286 |
|
| 287 |
{{1x|-{{1x|-{{1x|x}}}}}} |
| 288 |
|
| 289 |
{{1x|-{{1x|x}}}} |
| 290 |
!! html/php |
| 291 |
<p><span>-<span>-x</span></span> |
| 292 |
</p><p>--x |
| 293 |
</p><p>-x |
| 294 |
</p> |
| 295 |
!! html/parsoid |
| 296 |
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{1x|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p> |
| 297 |
|
| 298 |
<p><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"-{{1x|-{{1x|x}}}}"}},"i":0}}]}'>--x</span></p> |
| 299 |
|
| 300 |
<p><span about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"-{{1x|x}}"}},"i":0}}]}'>-x</span></p> |
| 301 |
!! end |
| 302 |
|
| 303 |
# FIXME: In integrated mode, the preprocessor returns {{1x|<tag>foo-{bar}bat</tag>}} |
| 304 |
# and doesn't expand it. This is a difference with legacy processing and could lead to |
| 305 |
# edge-case rendering diffs on pages wit broken language converter markup. |
| 306 |
# For now, we'll leave te integrated mode test as a known failure, but this isn't |
| 307 |
# very high priority to fix. |
| 308 |
!! test |
| 309 |
Preprocessor precedence 12: broken language converter closed by brace. |
| 310 |
!! options |
| 311 |
parsoid=wt2html |
| 312 |
!! wikitext |
| 313 |
This form breaks the template, which is unfortunate: |
| 314 |
*{{1x|foo-{bar}bat}} |
| 315 |
|
| 316 |
But if the broken language converter markup is inside an extension |
| 317 |
tag, nothing bad happens: |
| 318 |
*<nowiki>foo-{bar}bat</nowiki> |
| 319 |
*{{1x|<nowiki>foo-{bar}bat</nowiki>}} |
| 320 |
*<pre>foo-{bar}bat</pre> |
| 321 |
*{{1x|<pre>foo-{bar}bat</pre>}} |
| 322 |
|
| 323 |
<tag>foo-{bar}bat</tag> |
| 324 |
{{1x|<tag>foo-{bar}bat</tag>}} |
| 325 |
|
| 326 |
!! html/php |
| 327 |
<p>This form breaks the template, which is unfortunate: |
| 328 |
</p> |
| 329 |
<ul><li>{{1x|foo-{bar}bat}}</li></ul> |
| 330 |
<p>But if the broken language converter markup is inside an extension |
| 331 |
tag, nothing bad happens: |
| 332 |
</p> |
| 333 |
<ul><li>foo-{bar}bat</li> |
| 334 |
<li>foo-{bar}bat</li> |
| 335 |
<li><pre>foo-{bar}bat</pre></li> |
| 336 |
<li><pre>foo-{bar}bat</pre></li></ul> |
| 337 |
<pre>'foo-{bar}bat' |
| 338 |
array ( |
| 339 |
) |
| 340 |
</pre> |
| 341 |
<pre>'foo-{bar}bat' |
| 342 |
array ( |
| 343 |
) |
| 344 |
</pre> |
| 345 |
!! html/parsoid |
| 346 |
<p>This form breaks the template, which is unfortunate:</p> |
| 347 |
<ul><li>{{1x|foo-{bar}bat}}</li></ul> |
| 348 |
|
| 349 |
<p>But if the broken language converter markup is inside an extension |
| 350 |
tag, nothing bad happens:</p> |
| 351 |
<ul><li><span typeof="mw:Nowiki">foo-{bar}bat</span></li> |
| 352 |
<li><span typeof="mw:Nowiki mw:Transclusion" about="#mwt9" data-parsoid='{"pi":[[{"k":"1"}]],}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<nowiki>foo-{bar}bat</nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li> |
| 353 |
<li><pre typeof="mw:Extension/pre" about="#mwt11" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li> |
| 354 |
<li><pre typeof="mw:Extension/pre mw:Transclusion" about="#mwt12" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"},"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<pre>foo-{bar}bat</pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li></ul> |
| 355 |
|
| 356 |
<pre typeof="mw:Extension/tag" about="#mwt16" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>'foo-{bar}bat' |
| 357 |
array ( |
| 358 |
) |
| 359 |
</pre> |
| 360 |
<pre typeof="mw:Extension/tag mw:Transclusion" about="#mwt17" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"},"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<tag>foo-{bar}bat</tag>"}},"i":0}}]}'>'foo-{bar}bat' |
| 361 |
array ( |
| 362 |
) |
| 363 |
</pre> |
| 364 |
!! end |
| 365 |
|
| 366 |
!! test |
| 367 |
Preprocessor precedence 13: broken language converter in external link |
| 368 |
!! options |
| 369 |
parsoid=wt2html |
| 370 |
!! wikitext |
| 371 |
*[http://example.com/-{foo Example in URL] |
| 372 |
*[http://example.com Example in -{link} description] |
| 373 |
*{{1x|[http://example.com/-{foo Breaks template, however]}} |
| 374 |
!! html/php |
| 375 |
<ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li> |
| 376 |
<li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li> |
| 377 |
<li>{{1x|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul> |
| 378 |
!! html/parsoid |
| 379 |
<ul> |
| 380 |
<li><a rel="mw:ExtLink" href="http://example.com/-{foo" class="external text">Example in URL</a></li> |
| 381 |
<li><a rel="mw:ExtLink" href="http://example.com" class="external text">Example in -{link} description</a></li> |
| 382 |
<li>{{1x|<a rel="mw:ExtLink" href="http://example.com/-{foo" class="external text">Breaks template, however</a>}}</li> |
| 383 |
</ul> |
| 384 |
!! end |
| 385 |
|
| 386 |
## Parsoid integrated mode will drop all comments in templates & template args |
| 387 |
!! test |
| 388 |
Preprocessor precedence 14: broken language converter in comment |
| 389 |
!! wikitext |
| 390 |
*<!--{{foo}}-->...should be ok |
| 391 |
*<!---{{foo}}-->...extra dashes |
| 392 |
*{{1x|foo<!-- -{bar} -->bat}}...should be ok |
| 393 |
!! html/php |
| 394 |
<ul><li>...should be ok</li> |
| 395 |
<li>...extra dashes</li> |
| 396 |
<li>foobat...should be ok</li></ul> |
| 397 |
!! html/parsoid+standalone |
| 398 |
<ul><li data-parsoid="{}"><!--{{foo}}-->...should be ok</li> |
| 399 |
<li data-parsoid="{}"><!---{{foo}}-->...extra dashes</li> |
| 400 |
<li data-parsoid="{}"><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo<!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- -{bar} --></span><span about="#mwt1">bat</span>...should be ok</li></ul> |
| 401 |
!! html/parsoid+integrated |
| 402 |
<ul><li data-parsoid="{}"><!--{{foo}}-->...should be ok</li> |
| 403 |
<li data-parsoid="{}"><!---{{foo}}-->...extra dashes</li> |
| 404 |
<li><span typeof="mw:Transclusion" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"foo<!-- -{bar} -->bat"}},"i":0}}]}'>foobat</span>...should be ok</li> |
| 405 |
!! end |
| 406 |
|
| 407 |
!! test |
| 408 |
Preprocessor precedence 15: broken brace markup in headings |
| 409 |
!! config |
| 410 |
wgFragmentMode=[ "html5", "legacy" ] |
| 411 |
wgParserEnableLegacyHeadingDOM=false |
| 412 |
!! options |
| 413 |
parsoid=wt2html |
| 414 |
!! wikitext |
| 415 |
__NOTOC__ __NOEDITSECTION__ |
| 416 |
===1 foo[bar 1=== |
| 417 |
1 |
| 418 |
===2 foo[[bar 2=== |
| 419 |
2 |
| 420 |
===3 foo{bar 3=== |
| 421 |
3 |
| 422 |
===4 foo{{bar 4=== |
| 423 |
4 |
| 424 |
===5 foo{{{bar 5=== |
| 425 |
5 |
| 426 |
===6 foo-{bar 6=== |
| 427 |
6 |
| 428 |
!! html/php |
| 429 |
<div class="mw-heading mw-heading3"><h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1"></span>1 foo[bar 1</h3></div> |
| 430 |
<p>1 |
| 431 |
</p> |
| 432 |
<div class="mw-heading mw-heading3"><h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2"></span>2 foo[[bar 2</h3></div> |
| 433 |
<p>2 |
| 434 |
</p> |
| 435 |
<div class="mw-heading mw-heading3"><h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3"></span>3 foo{bar 3</h3></div> |
| 436 |
<p>3 |
| 437 |
</p> |
| 438 |
<div class="mw-heading mw-heading3"><h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4"></span>4 foo{{bar 4</h3></div> |
| 439 |
<p>4 |
| 440 |
</p> |
| 441 |
<div class="mw-heading mw-heading3"><h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5"></span>5 foo{{{bar 5</h3></div> |
| 442 |
<p>5 |
| 443 |
</p> |
| 444 |
<div class="mw-heading mw-heading3"><h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6"></span>6 foo-{bar 6</h3></div> |
| 445 |
<p>6 |
| 446 |
</p> |
| 447 |
!! html/parsoid |
| 448 |
<meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/> |
| 449 |
<h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3> |
| 450 |
<p>1</p> |
| 451 |
<h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3> |
| 452 |
<p>2</p> |
| 453 |
<h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3> |
| 454 |
<p>3</p> |
| 455 |
<h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3> |
| 456 |
<p>4</p> |
| 457 |
<h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3> |
| 458 |
<p>5</p> |
| 459 |
<h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3> |
| 460 |
<p>6</p> |
| 461 |
!! end |
| 462 |
|
| 463 |
!! test |
| 464 |
Preprocessor precedence 16: matching closing braces to opening braces |
| 465 |
!! options |
| 466 |
language=zh |
| 467 |
parsoid=wt2html |
| 468 |
!! wikitext |
| 469 |
-{{{1x|foo}}bar}- |
| 470 |
!! html/php |
| 471 |
<p>foobar |
| 472 |
</p> |
| 473 |
!! html/parsoid |
| 474 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</span>bar"}}'></span></p> |
| 475 |
!! end |
| 476 |
|
| 477 |
!! test |
| 478 |
Preprocessor precedence 17: template w/o target shouldn't prevent closing |
| 479 |
!! options |
| 480 |
parsoid=wt2html |
| 481 |
!! wikitext |
| 482 |
{{1x|hi {{}}}} |
| 483 |
!! html/php |
| 484 |
<p>hi {{}} |
| 485 |
</p> |
| 486 |
!! html/parsoid |
| 487 |
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</span></p> |
| 488 |
!! end |
| 489 |
|
| 490 |
# Ensure we're using a language without variants for this test; even |
| 491 |
# if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily. |
| 492 |
!! test |
| 493 |
Preprocessor precedence 18: another rightmost wins scenario |
| 494 |
!! options |
| 495 |
parsoid=wt2html |
| 496 |
language=de |
| 497 |
!! wikitext |
| 498 |
{{ -{{{{1|tplarg}}} }} }- |
| 499 |
!! html/php |
| 500 |
<p>{{ -{tplarg }} }- |
| 501 |
</p> |
| 502 |
!! html/parsoid |
| 503 |
<p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p> |
| 504 |
!! end |
| 505 |
|
| 506 |
!! test |
| 507 |
Preprocessor precedence 19: break syntax |
| 508 |
!! options |
| 509 |
parsoid=wt2html |
| 510 |
!! wikitext |
| 511 |
-{{ |
| 512 |
!! html/php |
| 513 |
<p>-{{ |
| 514 |
</p> |
| 515 |
!! html/parsoid |
| 516 |
<p>-{{</p> |
| 517 |
!! end |
| 518 |
|
| 519 |
## Regression test for Parsoid |
| 520 |
!! test |
| 521 |
Language converter over extlink |
| 522 |
!! wikitext |
| 523 |
{{1x |
| 524 |
| [-{oh no]}-] |
| 525 |
}} |
| 526 |
!! html/php |
| 527 |
<pre>[-{oh no]}-] |
| 528 |
</pre> |
| 529 |
!! html/parsoid |
| 530 |
<pre about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"1x\n","href":"./Template:1x"},"params":{"1":{"wt":" [-{oh no]}-]\n"}},"i":0}}]}'>[-{oh no]}-]</pre><span about="#mwt1"> |
| 531 |
</span> |
| 532 |
!! end |