| 1 |
!! Version 2 |
| 2 |
# LanguageConverter and language variants parser tests |
| 3 |
|
| 4 |
# This is the standard article assumed to exist. |
| 5 |
!! article |
| 6 |
Main Page |
| 7 |
!! text |
| 8 |
blah blah |
| 9 |
!! endarticle |
| 10 |
|
| 11 |
!! article |
| 12 |
A |
| 13 |
!! text |
| 14 |
Dummy article to suppress redlinks in tests |
| 15 |
!! end |
| 16 |
|
| 17 |
!! article |
| 18 |
Template:1x |
| 19 |
!! text |
| 20 |
{{{1}}} |
| 21 |
!! endarticle |
| 22 |
|
| 23 |
# For Serbian; localize Template namespace |
| 24 |
!! article |
| 25 |
Шаблон:1x |
| 26 |
!! text |
| 27 |
{{{1}}} |
| 28 |
!! endarticle |
| 29 |
|
| 30 |
!! article |
| 31 |
Тест |
| 32 |
!! text |
| 33 |
sr-el article variant |
| 34 |
!! endarticle |
| 35 |
|
| 36 |
## sr-ec ## |
| 37 |
|
| 38 |
!! test |
| 39 |
sr-ec: Simple conversion of Latin to Cyrillic |
| 40 |
!! options |
| 41 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 42 |
!! wikitext |
| 43 |
abvg |
| 44 |
!! html/php |
| 45 |
<p>абвг |
| 46 |
</p> |
| 47 |
!! html/parsoid |
| 48 |
<p>abvg</p> |
| 49 |
!! html/parsoid+langconv |
| 50 |
<p data-mw-variant-lang="sr-el">абвг</p> |
| 51 |
!! end |
| 52 |
|
| 53 |
!! test |
| 54 |
sr-ec: Same as above, but assert that -{}-s must be removed and not converted (1) |
| 55 |
!! options |
| 56 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 57 |
!! wikitext |
| 58 |
-{lj}-аб-{nj}-вг-{dž}- |
| 59 |
!! html/php |
| 60 |
<p>ljабnjвгdž |
| 61 |
</p> |
| 62 |
!! html/parsoid |
| 63 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"lj"}}'></span>аб<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nj"}}'></span>вг<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"dž"}}'></span></p> |
| 64 |
!! html/parsoid+langconv |
| 65 |
<p data-mw-variant-lang="sr-ec"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"lj"}}'>lj</span>аб<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nj"}}'>nj</span>вг<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"dž"}}'>dž</span></p> |
| 66 |
!! end |
| 67 |
|
| 68 |
!! test |
| 69 |
sr-ec: This text has some Cyrillic, but is recognized as Latin, so it should be converted |
| 70 |
!! options |
| 71 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 72 |
!! wikitext |
| 73 |
абвгšđžčć |
| 74 |
!! html/php |
| 75 |
<p>абвгшђжчћ |
| 76 |
</p> |
| 77 |
!! html/parsoid |
| 78 |
<p>абвгšđžčć</p> |
| 79 |
!! html/parsoid+langconv |
| 80 |
<p data-mw-variant-lang="sr-ec"><span typeof="mw:LanguageVariant" data-mw-variant-lang="sr-el" data-mw-variant='{"twoway":[{"l":"sr-el","t":"абвгšđžčć"},{"l":"sr-ec","t":"абвгшђжчћ"}],"rt":true}'>абвгшђжчћ</span></p> |
| 81 |
!! end |
| 82 |
|
| 83 |
!! test |
| 84 |
sr-ec: Same as above, but assert that -{}-s must be removed and not converted (2) |
| 85 |
!! options |
| 86 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 87 |
!! wikitext |
| 88 |
-{lj}-абвг-{nj}-šđžčć-{dž}- |
| 89 |
!! html/php |
| 90 |
<p>ljабвгnjшђжчћdž |
| 91 |
</p> |
| 92 |
!! html/parsoid |
| 93 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"lj"}}'></span>абвг<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nj"}}'></span>šđžčć<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"dž"}}'></span></p> |
| 94 |
!! html/parsoid+langconv |
| 95 |
<p data-mw-variant-lang="sr-el"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"lj"}}'>lj</span><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"sr-el","t":"абвг"},{"l":"sr-ec","t":"абвг"}],"rt":true}'>абвг</span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nj"}}'>nj</span>шђжчћ<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"dž"}}'>dž</span></p> |
| 96 |
!! end |
| 97 |
|
| 98 |
!! test |
| 99 |
sr-ec: Roman numerals are not converted |
| 100 |
!! options |
| 101 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 102 |
!! wikitext |
| 103 |
a I b II v III g IV šđžčć |
| 104 |
!! html/php |
| 105 |
<p>а I б II в III г IV шђжчћ |
| 106 |
</p> |
| 107 |
!! html/parsoid |
| 108 |
<p>a I b II v III g IV šđžčć</p> |
| 109 |
!! html/parsoid+langconv |
| 110 |
<p data-mw-variant-lang="sr-el">а I б II в III г IV шђжчћ</p> |
| 111 |
!! end |
| 112 |
|
| 113 |
## sr-el ## |
| 114 |
|
| 115 |
!! test |
| 116 |
sr-el: A simple conversion of Latin to Latin |
| 117 |
!! options |
| 118 |
language=sr htmlVariantLanguage=sr-Latn |
| 119 |
!! wikitext |
| 120 |
abcd |
| 121 |
!! html/php |
| 122 |
<p>abcd |
| 123 |
</p> |
| 124 |
!! html/parsoid |
| 125 |
<p>abcd</p> |
| 126 |
!! html/parsoid+langconv |
| 127 |
<p data-mw-variant-lang="sr-el">abcd</p> |
| 128 |
!! end |
| 129 |
|
| 130 |
!! test |
| 131 |
sr-el: A simple conversion of Cyrillic to Latin |
| 132 |
!! options |
| 133 |
language=sr htmlVariantLanguage=sr-Latn |
| 134 |
!! wikitext |
| 135 |
абцд |
| 136 |
!! html/php |
| 137 |
<p>abcd |
| 138 |
</p> |
| 139 |
!! html/parsoid |
| 140 |
<p>абцд</p> |
| 141 |
!! html/parsoid+langconv |
| 142 |
<p data-mw-variant-lang="sr-ec">abcd</p> |
| 143 |
!! end |
| 144 |
|
| 145 |
!! test |
| 146 |
sr-el: This text has some Latin, but is recognized as Cyrillic, so it should be converted |
| 147 |
!! options |
| 148 |
language=sr htmlVariantLanguage=sr-Latn |
| 149 |
!! wikitext |
| 150 |
abcdшђжчћ |
| 151 |
!! html/php |
| 152 |
<p>abcdšđžčć |
| 153 |
</p> |
| 154 |
!! html/parsoid |
| 155 |
<p>abcdшђжчћ</p> |
| 156 |
!! html/parsoid+langconv |
| 157 |
<p data-mw-variant-lang="sr-ec"><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"sr-ec","t":"abcdшђжчћ"},{"l":"sr-el","t":"abcdšđžčć"}],"rt":true}'>abcdšđžčć</span></p> |
| 158 |
!! end |
| 159 |
|
| 160 |
!! test |
| 161 |
External links should be converted, unless they "look like a URL". |
| 162 |
!! options |
| 163 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 164 |
!! wikitext |
| 165 |
[http://example.com abcd] |
| 166 |
|
| 167 |
[http://example.com http://foo.com] |
| 168 |
|
| 169 |
http://example.com |
| 170 |
|
| 171 |
[http://example.com -{abcd}-] |
| 172 |
!! html/php |
| 173 |
<p><a rel="nofollow" class="external text" href="http://example.com">абцд</a> |
| 174 |
</p><p><a rel="nofollow" class="external text" href="http://example.com">http://foo.com</a> |
| 175 |
</p><p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> |
| 176 |
</p><p><a rel="nofollow" class="external text" href="http://example.com">abcd</a> |
| 177 |
</p> |
| 178 |
!! html/parsoid |
| 179 |
<p><a rel="mw:ExtLink" href="http://example.com" class="external text">abcd</a></p> |
| 180 |
<p><a rel="mw:ExtLink" href="http://example.com" class="external text">http://foo.com</a></p> |
| 181 |
<p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a></p> |
| 182 |
<p><a rel="mw:ExtLink" href="http://example.com" class="external text"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"abcd"}}'></span></a></p> |
| 183 |
!! html/parsoid+langconv |
| 184 |
<p data-mw-variant-lang="sr-el"><a rel="mw:ExtLink" href="http://example.com" class="external text">абцд</a></p> |
| 185 |
<p data-mw-variant-lang="sr-el"><a rel="mw:ExtLink" href="http://example.com" class="external text">http://foo.com</a></p> |
| 186 |
<p data-mw-variant-lang="sr-el"><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a></p> |
| 187 |
<p data-mw-variant-lang="sr-ec"><a rel="mw:ExtLink" href="http://example.com" class="external text"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"abcd"}}'>abcd</span></a></p> |
| 188 |
!! end |
| 189 |
|
| 190 |
!! test |
| 191 |
Language converter: output gets cut off unexpectedly (T7757) |
| 192 |
!! options |
| 193 |
language=zh |
| 194 |
!! wikitext |
| 195 |
this bit is safe: }- |
| 196 |
|
| 197 |
but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}- |
| 198 |
|
| 199 |
then we get cut off here: }- |
| 200 |
|
| 201 |
all additional text is vanished |
| 202 |
!! html/php |
| 203 |
<p>this bit is safe: }- |
| 204 |
</p><p>but if we add a conversion instance: xxx |
| 205 |
</p><p>then we get cut off here: }- |
| 206 |
</p><p>all additional text is vanished |
| 207 |
</p> |
| 208 |
!! html/parsoid |
| 209 |
<p>this bit is safe: }-</p> |
| 210 |
<p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p> |
| 211 |
<p>then we get cut off here: }-</p> |
| 212 |
<p>all additional text is vanished</p> |
| 213 |
!! end |
| 214 |
|
| 215 |
!! test |
| 216 |
Language converter glossary rules inside attributes (T119158) |
| 217 |
!! options |
| 218 |
language=sr htmlVariantLanguage=sr-Latn |
| 219 |
!! config |
| 220 |
wgParserEnableLegacyMediaDOM=false |
| 221 |
!! wikitext |
| 222 |
-{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}- |
| 223 |
|
| 224 |
[[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]] |
| 225 |
!! html/php |
| 226 |
<p class="mw-empty-elt"> |
| 227 |
</p><p><span class="mw-default-size" typeof="mw:File"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="mw-file-description"><img alt="" onload="alert(1)" data-foo="" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="mw-file-element" /></a></span> |
| 228 |
</p> |
| 229 |
!! html/parsoid |
| 230 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p> |
| 231 |
|
| 232 |
<p><span class="mw-default-size" typeof="mw:File mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=<span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\"\"}}' data-parsoid='{\"fl\":[],\"dsr\":[76,80,null,2]}'></span>foAjrjvi<span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\"\"}}' data-parsoid='{\"fl\":[],\"dsr\":[88,92,null,2]}'></span>","txt":"foAjrjvi"}]]}'><a href="./Датотека:Foobar.jpg" class="mw-file-description"><img alt="foAjrjvi" resource="./Датотека:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}' class="mw-file-element"/></a></span></p> |
| 233 |
!! end |
| 234 |
|
| 235 |
### |
| 236 |
### Language variants related tests |
| 237 |
### |
| 238 |
|
| 239 |
!! test |
| 240 |
Self-link in language variants |
| 241 |
!! options |
| 242 |
title=[[Dunav]] language=sr |
| 243 |
!! wikitext |
| 244 |
Both [[Dunav]] and [[Дунав]] are names for this river. |
| 245 |
!! html/php |
| 246 |
<p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river. |
| 247 |
</p> |
| 248 |
!! html/parsoid |
| 249 |
<p>Both <a rel="mw:WikiLink" href="./Dunav" class="mw-selflink selflink">Dunav</a> and <a rel="mw:WikiLink" href="./Dunav" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Dunav","title":"Dunav"},"sa":{"href":"Дунав","title":"Дунав"}}'>Дунав</a> are names for this river.</p> |
| 250 |
!! end |
| 251 |
|
| 252 |
!! article |
| 253 |
Дуна |
| 254 |
!! text |
| 255 |
content |
| 256 |
!! endarticle |
| 257 |
|
| 258 |
!! test |
| 259 |
Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title |
| 260 |
!! options |
| 261 |
title=[[Duna]] language=sr |
| 262 |
!! wikitext |
| 263 |
[[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links. |
| 264 |
!! html/php |
| 265 |
<p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links. |
| 266 |
</p> |
| 267 |
!! html/parsoid |
| 268 |
<p><a rel="mw:WikiLink" href="./Дуна" title="Дуна">Дуна</a> is not a self-link while <a rel="mw:WikiLink" href="./Duna" class="mw-selflink selflink">Duna</a> and <a rel="mw:WikiLink" href="./Duna" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Duna","title":"Duna"},"sa":{"href":"Dуна","title":"Dуна"}}'>Dуна</a> are still self-links.</p> |
| 269 |
!! end |
| 270 |
|
| 271 |
!! test |
| 272 |
Link to a section of a variant of this title should be parsed as mw-selflink-fragment |
| 273 |
!! options |
| 274 |
title=[[Duna]] language=sr |
| 275 |
!! wikitext |
| 276 |
[[Dуна]] is a self-link while [[Duna#Foo]] and [[Dуна#Foo]] are mw-selflink-fragments. |
| 277 |
!! html/php |
| 278 |
<p><a class="mw-selflink selflink">Dуна</a> is a self-link while <a class="mw-selflink-fragment" href="#Foo">Duna#Foo</a> and <a class="mw-selflink-fragment" href="#Foo">Dуна#Foo</a> are mw-selflink-fragments. |
| 279 |
</p> |
| 280 |
!! html/parsoid |
| 281 |
<p><a rel="mw:WikiLink" href="./Duna" class="mw-selflink selflink" data-parsoid='{"stx":"simple","a":{"href":"./Duna","title":"Duna"},"sa":{"href":"Dуна","title":"Dуна"}}'>Dуна</a> is a self-link while <a rel="mw:WikiLink" href="./Duna#Foo" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Duna#Foo","title":"Duna"},"sa":{"href":"Duna#Foo","title":"Duna"}}'>Duna#Foo</a> and <a rel="mw:WikiLink" href="./Duna#Foo" class="mw-selflink-fragment" data-parsoid='{"stx":"simple","a":{"href":"./Duna#Foo","title":"Duna"},"sa":{"href":"Dуна#Foo","title":"Dуна"}}'>Dуна#Foo</a> are mw-selflink-fragments.</p> |
| 282 |
!! end |
| 283 |
|
| 284 |
!! test |
| 285 |
Link to pages in language variants |
| 286 |
!! options |
| 287 |
language=sr |
| 288 |
!! wikitext |
| 289 |
Main Page can be written as [[Маин Паге]] |
| 290 |
!! html/php |
| 291 |
<p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> |
| 292 |
</p> |
| 293 |
!! html/parsoid |
| 294 |
<p>Main Page can be written as <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page","title":"Main Page"},"sa":{"href":"Маин Паге","title":"Маин Паге"}}'>Маин Паге</a></p> |
| 295 |
!! end |
| 296 |
|
| 297 |
!! test |
| 298 |
Multiple links to pages in language variants |
| 299 |
!! options |
| 300 |
language=sr |
| 301 |
!! wikitext |
| 302 |
[[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. |
| 303 |
!! html/php |
| 304 |
<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>. |
| 305 |
</p> |
| 306 |
!! html/parsoid |
| 307 |
<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a> can be written as <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page","title":"Main Page"},"sa":{"href":"Маин Паге","title":"Маин Паге"}}'>Маин Паге</a> same as <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page","title":"Main Page"},"sa":{"href":"Маин Паге","title":"Маин Паге"}}'>Маин Паге</a>.</p> |
| 308 |
!! end |
| 309 |
|
| 310 |
!! article |
| 311 |
Template:test |
| 312 |
!! text |
| 313 |
This is a test template |
| 314 |
!! endarticle |
| 315 |
|
| 316 |
!! test |
| 317 |
Simple template in language variants |
| 318 |
!! options |
| 319 |
language=sr |
| 320 |
!! wikitext |
| 321 |
{{тест}} |
| 322 |
!! html/php |
| 323 |
<p>This is a test template |
| 324 |
</p> |
| 325 |
!! end |
| 326 |
|
| 327 |
|
| 328 |
!! test |
| 329 |
Template with explicit namespace in language variants |
| 330 |
!! options |
| 331 |
language=sr |
| 332 |
!! wikitext |
| 333 |
{{Template:тест}} |
| 334 |
!! html/php |
| 335 |
<p>This is a test template |
| 336 |
</p> |
| 337 |
!! end |
| 338 |
|
| 339 |
!! article |
| 340 |
Template:paramtest |
| 341 |
!! text |
| 342 |
This is a test template with parameter {{{param}}} |
| 343 |
!! endarticle |
| 344 |
|
| 345 |
!! test |
| 346 |
Basic test for template parameter in language variants |
| 347 |
!! options |
| 348 |
language=sr |
| 349 |
!! wikitext |
| 350 |
{{парамтест|param=foo}} |
| 351 |
!! html/php |
| 352 |
<p>This is a test template with parameter foo |
| 353 |
</p> |
| 354 |
!! end |
| 355 |
|
| 356 |
!! test |
| 357 |
Simple category in language variants |
| 358 |
!! options |
| 359 |
language=sr cat |
| 360 |
!! metadata |
| 361 |
cat=МедиаWики_Усер'с_Гуиде sort= |
| 362 |
!! wikitext |
| 363 |
[[Category:МедиаWики Усер'с Гуиде]] |
| 364 |
!! html/php |
| 365 |
!! html/parsoid |
| 366 |
<link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер'с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер'с Гуиде"}}'/> |
| 367 |
!! end |
| 368 |
|
| 369 |
!! article |
| 370 |
Category:分类 |
| 371 |
!! text |
| 372 |
blah |
| 373 |
!! endarticle |
| 374 |
|
| 375 |
!! article |
| 376 |
Category:分類 |
| 377 |
!! text |
| 378 |
blah |
| 379 |
!! endarticle |
| 380 |
|
| 381 |
## We used to, but no longer wt2wt this test since the default serializer |
| 382 |
## will normalize all categories to serialize on their own line. |
| 383 |
## This wikitext usage is going to be fairly uncommon in production and |
| 384 |
## selser will take care of preserving formatting in those scenarios. |
| 385 |
!! test |
| 386 |
Don't convert blue categorylinks to another variant (T35210) |
| 387 |
!! options |
| 388 |
cat |
| 389 |
language=zh |
| 390 |
parsoid=wt2html |
| 391 |
!! metadata |
| 392 |
cat=分类 sort= |
| 393 |
!! wikitext |
| 394 |
[[A]][[Category:分类]] |
| 395 |
!! html/php |
| 396 |
<p><a href="/wiki/A" title="A">A</a> |
| 397 |
</p> |
| 398 |
!! html/parsoid |
| 399 |
<p><a rel="mw:WikiLink" href="./A" title="A">A</a></p> |
| 400 |
<link rel="mw:PageProp/Category" href="./Category:分类"/> |
| 401 |
!! end |
| 402 |
|
| 403 |
!! test |
| 404 |
Stripping -{}- tags (language variants) |
| 405 |
!! options |
| 406 |
language=sr |
| 407 |
!! wikitext |
| 408 |
Latin proverb: -{Ne nuntium necare}- |
| 409 |
!! html/php |
| 410 |
<p>Latin proverb: Ne nuntium necare |
| 411 |
</p> |
| 412 |
!! html/parsoid |
| 413 |
<p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p> |
| 414 |
!! end |
| 415 |
|
| 416 |
|
| 417 |
!! test |
| 418 |
Prevent conversion with -{}- tags (language variants) |
| 419 |
!! options |
| 420 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 421 |
!! wikitext |
| 422 |
Latinski: -{Ne nuntium necare}- |
| 423 |
!! html/php |
| 424 |
<p>Латински: Ne nuntium necare |
| 425 |
</p> |
| 426 |
!! html/parsoid |
| 427 |
<p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p> |
| 428 |
!! end |
| 429 |
|
| 430 |
!! test |
| 431 |
Prevent conversion of text with -{}- tags (language variants) |
| 432 |
!! options |
| 433 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 434 |
!! wikitext |
| 435 |
Latinski: -{Ne nuntium necare}- |
| 436 |
!! html/php |
| 437 |
<p>Латински: Ne nuntium necare |
| 438 |
</p> |
| 439 |
!! html/parsoid |
| 440 |
<p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p> |
| 441 |
!! end |
| 442 |
|
| 443 |
!! test |
| 444 |
Prevent conversion of links with -{}- tags (language variants) |
| 445 |
!! options |
| 446 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 447 |
!! wikitext |
| 448 |
-{[[Main Page]]}- |
| 449 |
!! html/php |
| 450 |
<p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> |
| 451 |
</p> |
| 452 |
!! html/parsoid |
| 453 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}'>Main Page</a>"}}'></span></p> |
| 454 |
!! end |
| 455 |
|
| 456 |
!! test |
| 457 |
-{}- tags within headlines (within html for parserConvert()) |
| 458 |
!! config |
| 459 |
wgFragmentMode=[ "html5", "legacy" ] |
| 460 |
!! options |
| 461 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 462 |
!! wikitext |
| 463 |
==-{Naslov}-== |
| 464 |
|
| 465 |
Note that even an unprotected headline ID is not affected by language |
| 466 |
conversion: |
| 467 |
|
| 468 |
==Latinski== |
| 469 |
!! html/php |
| 470 |
<h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Уредите одељак „Naslov”">уреди</a><span class="mw-editsection-bracket">]</span></span></h2> |
| 471 |
<p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге |
| 472 |
цонверсион: |
| 473 |
</p> |
| 474 |
<h2><span class="mw-headline" id="Latinski">Латински</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Уредите одељак „Латински”">уреди</a><span class="mw-editsection-bracket">]</span></span></h2> |
| 475 |
!! html/parsoid |
| 476 |
<h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2> |
| 477 |
|
| 478 |
<p>Note that even an unprotected headline ID is not affected by language |
| 479 |
conversion:</p> |
| 480 |
|
| 481 |
<h2 id="Latinski">Latinski</h2> |
| 482 |
!! end |
| 483 |
|
| 484 |
!! test |
| 485 |
Explicit definition of language variant alternatives |
| 486 |
!! options |
| 487 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 488 |
!! wikitext |
| 489 |
-{zh:China;zh-tw:Taiwan}-, not China |
| 490 |
!! html/php |
| 491 |
<p>Taiwan, not China |
| 492 |
</p> |
| 493 |
!! html/parsoid |
| 494 |
<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, not China</p> |
| 495 |
!! end |
| 496 |
|
| 497 |
!! test |
| 498 |
Explicit definition of language variant alternatives (BCP 47 codes) |
| 499 |
!! options |
| 500 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 501 |
!! wikitext |
| 502 |
-{zh:China;zh-Hant-TW:Taiwan}-, not China |
| 503 |
!! html/php |
| 504 |
<p>Taiwan, not China |
| 505 |
</p> |
| 506 |
!! html/parsoid |
| 507 |
<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-Hant-TW","t":"Taiwan"}]}'></span>, not China</p> |
| 508 |
!! end |
| 509 |
|
| 510 |
!! test |
| 511 |
Filter syntax for language variants |
| 512 |
!! options |
| 513 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 514 |
!! wikitext |
| 515 |
foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux |
| 516 |
!! html/php |
| 517 |
<p>fooblog, WEBJOURNAL, WEBLOGquux |
| 518 |
</p> |
| 519 |
!! html/parsoid |
| 520 |
<p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p> |
| 521 |
!! end |
| 522 |
|
| 523 |
# Note that Parsoid post-processing for language variants needs to |
| 524 |
# update the `title` attribute here, based on the mw:ExpandedAttrs property |
| 525 |
!! test |
| 526 |
Conversion around HTML tags |
| 527 |
!! options |
| 528 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 529 |
!! wikitext |
| 530 |
-{H|span=>sr-ec:script;title=>sr-ec:src}- |
| 531 |
<span title="La-{sr-el:L;sr-ec:C}-tin">ski</span> |
| 532 |
!! html/php |
| 533 |
<p> |
| 534 |
<span title="ЛаCтин">ски</span> |
| 535 |
</p> |
| 536 |
!! html/parsoid |
| 537 |
<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/> |
| 538 |
<span title="Latin" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"La<span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}'></span>tin"}]]}'>ski</span></p> |
| 539 |
!! end |
| 540 |
|
| 541 |
!! test |
| 542 |
Explicit session-wise two-way language variant mapping (A flag and - flag) |
| 543 |
!! options |
| 544 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 545 |
!! wikitext |
| 546 |
This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now. |
| 547 |
|
| 548 |
Taiwan is not China. |
| 549 |
|
| 550 |
But -{A|zh:China; zh-tw:Taiwan}- is China, |
| 551 |
|
| 552 |
(This-{-|zh:China; zh-tw:Taiwan}- should be stripped!) |
| 553 |
|
| 554 |
and -{China}- is China. |
| 555 |
!! html/php |
| 556 |
<p>This is Taiwan, but we'll forget that now. |
| 557 |
</p><p>Taiwan is not China. |
| 558 |
</p><p>But Taiwan is Taiwan, |
| 559 |
</p><p>(This should be stripped!) |
| 560 |
</p><p>and China is China. |
| 561 |
</p> |
| 562 |
!! html/parsoid |
| 563 |
<p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p> |
| 564 |
<p>Taiwan is not China.</p> |
| 565 |
<p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span> is China,</p> |
| 566 |
<p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"remove":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p> |
| 567 |
<p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p> |
| 568 |
!! end |
| 569 |
|
| 570 |
!! test |
| 571 |
Explicit session-wise one-way language variant mapping (A flag and - flag) |
| 572 |
!! options |
| 573 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 574 |
!! wikitext |
| 575 |
This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now. |
| 576 |
|
| 577 |
COUNTRY is China or Taiwan. |
| 578 |
|
| 579 |
But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY, |
| 580 |
|
| 581 |
(This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!) |
| 582 |
|
| 583 |
and -{COUNTRY}- is COUNTRY. |
| 584 |
!! html/php |
| 585 |
<p>This is Taiwan, but we'll forget that now. |
| 586 |
</p><p>COUNTRY is China or Taiwan. |
| 587 |
</p><p>But Taiwan is Taiwan, |
| 588 |
</p><p>(This should be stripped!) |
| 589 |
</p><p>and COUNTRY is COUNTRY. |
| 590 |
</p> |
| 591 |
!! html/parsoid |
| 592 |
<p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p> |
| 593 |
<p>COUNTRY is China or Taiwan.</p> |
| 594 |
<p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span> is COUNTRY,</p> |
| 595 |
<p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}],"remove":true}'/> should be stripped!)</p> |
| 596 |
<p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p> |
| 597 |
!! end |
| 598 |
|
| 599 |
!! test |
| 600 |
Explicit session-wise two-way language variant mapping (H flag for hide) |
| 601 |
!! options |
| 602 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 603 |
!! wikitext |
| 604 |
(This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) |
| 605 |
|
| 606 |
Taiwan is China. |
| 607 |
!! html/php |
| 608 |
<p>(This should be stripped!) |
| 609 |
</p><p>Taiwan is Taiwan. |
| 610 |
</p> |
| 611 |
!! html/parsoid |
| 612 |
<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p> |
| 613 |
<p>Taiwan is China.</p> |
| 614 |
!! end |
| 615 |
|
| 616 |
!! test |
| 617 |
Explicit session-wise one-way language variant mapping (H flag for hide) |
| 618 |
!! options |
| 619 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 620 |
!! wikitext |
| 621 |
(This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!) |
| 622 |
|
| 623 |
COUNTRY is Taiwan or China. |
| 624 |
!! html/php |
| 625 |
<p>(This should be stripped!) |
| 626 |
</p><p>Taiwan is Taiwan or China. |
| 627 |
</p> |
| 628 |
!! html/parsoid |
| 629 |
<p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p> |
| 630 |
<p>COUNTRY is Taiwan or China.</p> |
| 631 |
!! end |
| 632 |
|
| 633 |
## Note that parsoid test runner does not support 'showtitle' option. |
| 634 |
!! test |
| 635 |
Adding explicit conversion rule for title (T flag) |
| 636 |
!! options |
| 637 |
language=zh htmlVariantLanguage=zh-Hant-TW showtitle |
| 638 |
!! wikitext |
| 639 |
Should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
| 640 |
|
| 641 |
Taiwan is China. |
| 642 |
!! html/php |
| 643 |
Taiwan |
| 644 |
<p>Should be stripped! |
| 645 |
</p><p>Taiwan is China. |
| 646 |
</p> |
| 647 |
!! html/parsoid |
| 648 |
<p>Should be stripped<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p> |
| 649 |
<p>Taiwan is China.</p> |
| 650 |
!! end |
| 651 |
|
| 652 |
!! test |
| 653 |
Code coverage: T combined with H flag |
| 654 |
!! options |
| 655 |
language=zh htmlVariantLanguage=zh-Hant-TW showtitle |
| 656 |
!! wikitext |
| 657 |
Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-! |
| 658 |
|
| 659 |
Taiwan is China. |
| 660 |
!! html/php |
| 661 |
Taiwan |
| 662 |
<p>Should be stripped! |
| 663 |
</p><p>Taiwan is Taiwan. |
| 664 |
</p> |
| 665 |
!! html/parsoid |
| 666 |
<p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p> |
| 667 |
<p>Taiwan is China.</p> |
| 668 |
!! end |
| 669 |
|
| 670 |
!! test |
| 671 |
Code coverage: T with no variants |
| 672 |
!! options |
| 673 |
language=zh htmlVariantLanguage=zh-Hant-TW showtitle |
| 674 |
!! wikitext |
| 675 |
-{H|zh:China; zh-tw:Taiwan}- |
| 676 |
Taiwan is China.-{T|Taiwan is China}- |
| 677 |
!! html/php |
| 678 |
Taiwan is China |
| 679 |
<p> |
| 680 |
Taiwan is Taiwan. |
| 681 |
</p> |
| 682 |
!! html/parsoid |
| 683 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> |
| 684 |
Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p> |
| 685 |
!! end |
| 686 |
|
| 687 |
!! test |
| 688 |
Code coverage: rules with no variants |
| 689 |
!! options |
| 690 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 691 |
!! wikitext |
| 692 |
-{H|zh:China; zh-tw:Taiwan}- |
| 693 |
Taiwan is China. |
| 694 |
-{H|China}- |
| 695 |
Taiwan is China. |
| 696 |
!! html/php |
| 697 |
<p> |
| 698 |
Taiwan is Taiwan. |
| 699 |
|
| 700 |
Taiwan is China. |
| 701 |
</p> |
| 702 |
!! html/parsoid |
| 703 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> |
| 704 |
Taiwan is China. |
| 705 |
<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/> |
| 706 |
Taiwan is China.</p> |
| 707 |
!! end |
| 708 |
|
| 709 |
|
| 710 |
!! test |
| 711 |
Code coverage: D flag for conversion rule |
| 712 |
!! options |
| 713 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 714 |
!! wikitext |
| 715 |
-{D|zh-cn:XA; zh-tw:YA}- |
| 716 |
-{A;D|zh-cn:XB; zh-tw:YB}- |
| 717 |
-{D;H|zh-cn:XC; zh-tw:YC}- |
| 718 |
|
| 719 |
-{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}- |
| 720 |
|
| 721 |
-{D|0=>zh-tw:1}- |
| 722 |
-{A;D|2=>zh-tw:3}- |
| 723 |
-{D;H|4=>zh-tw:5}- |
| 724 |
|
| 725 |
XA XB XC YA YB YC FOO BAR BAT 012345 |
| 726 |
!! html/php |
| 727 |
<p>大陆:XA;臺灣:YA; |
| 728 |
|
| 729 |
大陆:XC;臺灣:YC; |
| 730 |
</p><p>FOO⇒臺灣:BAR;FOO⇒大陆:BAT; |
| 731 |
</p><p>0⇒臺灣:1; |
| 732 |
|
| 733 |
4⇒臺灣:5; |
| 734 |
</p><p>XA YB YC YA YB YC BAR BAR BAT 013355 |
| 735 |
</p> |
| 736 |
!! html/parsoid |
| 737 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span> |
| 738 |
<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/> |
| 739 |
<span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p> |
| 740 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p> |
| 741 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span> |
| 742 |
<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/> |
| 743 |
<span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p> |
| 744 |
<p>XA XB XC YA YB YC FOO BAR BAT 012345</p> |
| 745 |
!! end |
| 746 |
|
| 747 |
!! test |
| 748 |
Code coverage: N flag for conversion rule |
| 749 |
!! options |
| 750 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 751 |
!! wikitext |
| 752 |
-{N|zh-cn}- |
| 753 |
|
| 754 |
-{N|zh-tw}- |
| 755 |
|
| 756 |
-{N|sr-ec}- |
| 757 |
!! html/php |
| 758 |
<p>大陆 |
| 759 |
</p><p>臺灣 |
| 760 |
</p><p>српски (ћирилица) |
| 761 |
</p> |
| 762 |
!! html/parsoid |
| 763 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p> |
| 764 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p> |
| 765 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p> |
| 766 |
!! end |
| 767 |
|
| 768 |
# html2wt suppresses the bogus 'D' flag, so this is wt2html only |
| 769 |
!! test |
| 770 |
Code coverage: N flag for conversion rule (wt2html only) |
| 771 |
!! options |
| 772 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 773 |
parsoid=wt2html,html2html |
| 774 |
!! wikitext |
| 775 |
-{D;N|en}- |
| 776 |
!! html/php |
| 777 |
<p>English |
| 778 |
</p> |
| 779 |
!! html/parsoid |
| 780 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p> |
| 781 |
!! end |
| 782 |
|
| 783 |
!! test |
| 784 |
Testing that changing the language variant here in the tests actually works |
| 785 |
!! options |
| 786 |
language=zh htmlVariantLanguage=zh showtitle |
| 787 |
!! wikitext |
| 788 |
Should be stripped-{T|zh:China; zh-tw:Taiwan}-! |
| 789 |
!! html/php |
| 790 |
China |
| 791 |
<p>Should be stripped! |
| 792 |
</p> |
| 793 |
!! html/parsoid |
| 794 |
<p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p> |
| 795 |
!! end |
| 796 |
|
| 797 |
!! test |
| 798 |
Title with HTML |
| 799 |
!! options |
| 800 |
language=zh htmlVariantLanguage=zh showtitle |
| 801 |
!! wikitext |
| 802 |
-{T|zh:Title <i style="color:red">with</i> HTML&Entities}- |
| 803 |
Should be stripped! |
| 804 |
!! html/php |
| 805 |
Title <i style="color:red">with</i> HTML&Entities |
| 806 |
<p> |
| 807 |
Should be stripped! |
| 808 |
</p> |
| 809 |
!! end |
| 810 |
|
| 811 |
!! test |
| 812 |
Title with Wiki syntax |
| 813 |
!! options |
| 814 |
language=zh htmlVariantLanguage=zh showtitle |
| 815 |
!! wikitext |
| 816 |
-{T|zh:Title ''with'' Wiki's süntax©}- |
| 817 |
Should be stripped! |
| 818 |
!! html/php |
| 819 |
Title <i>with</i> Wiki's süntax&copy |
| 820 |
<p> |
| 821 |
Should be stripped! |
| 822 |
</p> |
| 823 |
!! end |
| 824 |
|
| 825 |
!! test |
| 826 |
Title with JavaScript injection |
| 827 |
!! options |
| 828 |
language=zh htmlVariantLanguage=zh showtitle |
| 829 |
!! wikitext |
| 830 |
-{T|zh:Title <i onclick="alert(42)">click me</i> <script>alert(43)</script>}- |
| 831 |
Should be stripped! |
| 832 |
!! html/php |
| 833 |
Title <i>click me</i> <script>alert(43)</script> |
| 834 |
<p> |
| 835 |
Should be stripped! |
| 836 |
</p> |
| 837 |
!! end |
| 838 |
|
| 839 |
!! test |
| 840 |
Test 1 from T298401/T67747 |
| 841 |
!! options |
| 842 |
language=zh htmlVariantLanguage=zh showtitle |
| 843 |
!! wikitext |
| 844 |
-{T|zh:Title <script>a</script>&<i>b</i>}- |
| 845 |
Should be stripped! |
| 846 |
!! html/php |
| 847 |
Title <script>a</script>&<i>b</i> |
| 848 |
<p> |
| 849 |
Should be stripped! |
| 850 |
</p> |
| 851 |
!! end |
| 852 |
|
| 853 |
!! test |
| 854 |
Test 2 from T298401/T67747 |
| 855 |
!! options |
| 856 |
language=zh htmlVariantLanguage=zh showtitle |
| 857 |
!! wikitext |
| 858 |
-{T|zh:Title <code style="display:none">}- |
| 859 |
Should be stripped! |
| 860 |
!! html/php |
| 861 |
Title <code style="display:none"></code> |
| 862 |
<p> |
| 863 |
Should be stripped! |
| 864 |
</p> |
| 865 |
!! end |
| 866 |
|
| 867 |
!! test |
| 868 |
Test 3 from T298401/T67747 |
| 869 |
!! options |
| 870 |
language=zh htmlVariantLanguage=zh showtitle |
| 871 |
!! wikitext |
| 872 |
-{T|zh:Title <b>Foo bar<b>}- |
| 873 |
Should be stripped! |
| 874 |
!! html/php |
| 875 |
Title <b>Foo bar<b></b></b> |
| 876 |
<p> |
| 877 |
Should be stripped! |
| 878 |
</p> |
| 879 |
!! end |
| 880 |
|
| 881 |
!! test |
| 882 |
Recursive conversion of alt and title attrs shouldn't clear converter state |
| 883 |
!! options |
| 884 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 885 |
showtitle |
| 886 |
!! wikitext |
| 887 |
-{H|zh-cn:Exclamation; zh-tw:exclamation}- |
| 888 |
Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span> |
| 889 |
!! html/php |
| 890 |
China |
| 891 |
<p> |
| 892 |
Should be stripped<span title="Exclamation">!</span> |
| 893 |
</p> |
| 894 |
!! html/parsoid |
| 895 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/> |
| 896 |
Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/><span title="exclamation">!</span></p> |
| 897 |
!! end |
| 898 |
|
| 899 |
!! test |
| 900 |
T26072: more test on conversion rule for title |
| 901 |
!! options |
| 902 |
language=zh htmlVariantLanguage=zh-Hant-TW showtitle |
| 903 |
!! wikitext |
| 904 |
This should be stripped-{T|zh:China; zh-tw:Taiwan}-! |
| 905 |
|
| 906 |
This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-. |
| 907 |
!! html/php |
| 908 |
Taiwan |
| 909 |
<p>This should be stripped! |
| 910 |
</p><p>This won't take interferes with the title rule. |
| 911 |
</p> |
| 912 |
!! html/parsoid |
| 913 |
<p>This should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p> |
| 914 |
<p>This won't take interferes with the title rule<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p> |
| 915 |
!! end |
| 916 |
|
| 917 |
!! test |
| 918 |
Partly disable title conversion if variant == main language code |
| 919 |
!! options |
| 920 |
language=zh htmlVariantLanguage=zh title=[[ZH]] showtitle |
| 921 |
!! wikitext |
| 922 |
-{T|zh-cn:CN;zh-tw:TW}- |
| 923 |
!! html/php |
| 924 |
<span class="mw-page-title-main">ZH</span> |
| 925 |
<p class="mw-empty-elt"> |
| 926 |
</p> |
| 927 |
!! html/parsoid |
| 928 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}]}'/></p> |
| 929 |
!! end |
| 930 |
|
| 931 |
!! test |
| 932 |
Partly disable title conversion if variant == main language code, more |
| 933 |
!! options |
| 934 |
language=zh htmlVariantLanguage=zh title=[[ZH]] showtitle |
| 935 |
!! wikitext |
| 936 |
-{T|TW}- |
| 937 |
!! html/php |
| 938 |
<span class="mw-page-title-main">ZH</span> |
| 939 |
<p class="mw-empty-elt"> |
| 940 |
</p> |
| 941 |
!! html/parsoid |
| 942 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p> |
| 943 |
!! end |
| 944 |
|
| 945 |
!! test |
| 946 |
Raw output of variant escape tags (R flag) |
| 947 |
!! options |
| 948 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 949 |
!! wikitext |
| 950 |
Raw: -{R|zh:China;zh-tw:Taiwan}- |
| 951 |
!! html/php |
| 952 |
<p>Raw: zh:China;zh-tw:Taiwan |
| 953 |
</p> |
| 954 |
!! html/parsoid |
| 955 |
<p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p> |
| 956 |
!! end |
| 957 |
|
| 958 |
# html2wt suppresses the bogus 'D' flags, so this is wt2html only |
| 959 |
!! test |
| 960 |
Raw output of variant escape tags (R flag) (wt2html only) |
| 961 |
!! options |
| 962 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 963 |
parsoid=wt2html,html2html |
| 964 |
!! wikitext |
| 965 |
-{Variant}- -{D|syntax}- -{D;R|options}- |
| 966 |
!! html/php |
| 967 |
<p>Variant syntax options |
| 968 |
</p> |
| 969 |
!! html/parsoid |
| 970 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Variant"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"syntax"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"options"}}'></span></p> |
| 971 |
!! end |
| 972 |
|
| 973 |
!! test |
| 974 |
Nested markup inside raw output of variant escape tags (R flag) |
| 975 |
!! options |
| 976 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 977 |
!! wikitext |
| 978 |
Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}- |
| 979 |
!! html/php |
| 980 |
<p>Nested raw: nested Taiwan nested |
| 981 |
</p> |
| 982 |
!! html/parsoid |
| 983 |
<p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}'></span> nested"}}'></span></p> |
| 984 |
!! end |
| 985 |
|
| 986 |
!! test |
| 987 |
Nested markup and spaces inside raw output of variant escape tags (R flag) |
| 988 |
!! options |
| 989 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 990 |
!! wikitext |
| 991 |
X-{ outer -{ inner }- outer }-X |
| 992 |
!! html/php |
| 993 |
<p>X outer inner outer X |
| 994 |
</p> |
| 995 |
!! html/parsoid |
| 996 |
<p>X<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":" outer <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\" inner \"}}' data-parsoid='{\"fl\":[],\"dsr\":[10,21,null,2]}'></span> outer "}}'></span>X</p> |
| 997 |
!! end |
| 998 |
|
| 999 |
!! test |
| 1000 |
Templates inside raw output of variant escape tags (R flag) |
| 1001 |
!! options |
| 1002 |
language=zh htmlVariantLanguage=zh-Hant-TW |
| 1003 |
!! wikitext |
| 1004 |
Nested raw: -{R|nested {{1x|hi}} templates}- |
| 1005 |
!! html/php |
| 1006 |
<p>Nested raw: nested hi templates |
| 1007 |
</p> |
| 1008 |
!! html/parsoid |
| 1009 |
<p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested <span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}'>hi</span> templates"}}'></span></p> |
| 1010 |
!! end |
| 1011 |
|
| 1012 |
!! test |
| 1013 |
Strings evaluating false shouldn't be ignored by Language converter (T51072) |
| 1014 |
!! options |
| 1015 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1016 |
!! wikitext |
| 1017 |
-{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}- |
| 1018 |
!! html/php |
| 1019 |
<p>0 |
| 1020 |
</p> |
| 1021 |
!! html/parsoid |
| 1022 |
<p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p> |
| 1023 |
!! end |
| 1024 |
|
| 1025 |
!! test |
| 1026 |
Conversion rules from [numeric-only string] to [something else] (T48634) |
| 1027 |
!! options |
| 1028 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1029 |
!! wikitext |
| 1030 |
-{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345 |
| 1031 |
!! html/php |
| 1032 |
<p>D12345EE12345 |
| 1033 |
</p> |
| 1034 |
!! html/parsoid |
| 1035 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p> |
| 1036 |
!! end |
| 1037 |
|
| 1038 |
!! test |
| 1039 |
Two-way converter rule entries with an empty value should be ignored (T53551) |
| 1040 |
!! options |
| 1041 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1042 |
!! wikitext |
| 1043 |
-{H|zh-cn:foo;zh-tw:;}-foobar |
| 1044 |
!! html/php |
| 1045 |
<p>foobar |
| 1046 |
</p> |
| 1047 |
!! html/parsoid |
| 1048 |
<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p> |
| 1049 |
!! end |
| 1050 |
|
| 1051 |
!! test |
| 1052 |
One-way converter rule entries with an empty "from" string should be ignored (T53551) |
| 1053 |
!! options |
| 1054 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1055 |
!! wikitext |
| 1056 |
-{H|=>zh-cn:foo;}-foobar |
| 1057 |
!! html/php |
| 1058 |
<p>foobar |
| 1059 |
</p> |
| 1060 |
!! html/parsoid |
| 1061 |
<p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p> |
| 1062 |
!! end |
| 1063 |
|
| 1064 |
!! test |
| 1065 |
Empty converter rule entries shouldn't be inserted into the conversion table (T53551) |
| 1066 |
!! options |
| 1067 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1068 |
!! wikitext |
| 1069 |
-{H|}-foobar |
| 1070 |
!! html/php |
| 1071 |
<p>foobar |
| 1072 |
</p> |
| 1073 |
!! html/parsoid |
| 1074 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p> |
| 1075 |
!! end |
| 1076 |
|
| 1077 |
!! test |
| 1078 |
Nested using of manual convert syntax |
| 1079 |
!! options |
| 1080 |
language=zh htmlVariantLanguage=zh-Hant-HK |
| 1081 |
!! wikitext |
| 1082 |
Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-! |
| 1083 |
!! html/php |
| 1084 |
<p>Nested: Hello Hong Kong! |
| 1085 |
</p> |
| 1086 |
!! html/parsoid |
| 1087 |
<p>Nested: <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}' data-parsoid='{\"fl\":[],\"src\":\"-{zh-cn:China;zh-sg:Singapore;}-\",\"tSp\":[7],\"dsr\":[21,53,2,2]}'></span>"},{"l":"zh-hant","t":"Hello <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"src\\\":\\\"-{ong}-\\\",\\\"dsr\\\":[90,97,2,2]}&apos;>&lt;/span> K&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"src\\\":\\\"-{}-\\\",\\\"dsr\\\":[99,103,2,2]}&apos;>&lt;/span>ong\"}]}' data-parsoid='{\"fl\":[],\"src\":\"-{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-\",\"tSp\":[7],\"dsr\":[68,109,2,2]}'></span>"}]}' data-parsoid='{"fl":[],"src":"-{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-","tSp":[7]}'></span>!</p> |
| 1088 |
!! end |
| 1089 |
|
| 1090 |
!! test |
| 1091 |
HTML markups with conversion syntax in attribs, nested in other conversion blocks |
| 1092 |
!! options |
| 1093 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1094 |
!! wikitext |
| 1095 |
-{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}- |
| 1096 |
!! html/php |
| 1097 |
<p><span title="X">A</span> |
| 1098 |
</p> |
| 1099 |
!! html/parsoid |
| 1100 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"<span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid='{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}' data-mw='{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"src\\\":\\\"-{X}-\\\",\\\"dsr\\\":[34,39,2,2]}&apos;>&lt;/span>\"}]]}'>A</span>"}}' data-parsoid='{"fl":["zh","zh-hans","zh-hant"],"src":"-{zh;zh-hans;zh-hant|<span title=\"-{X}-\">A</span>}-"}'></span></p> |
| 1101 |
!! end |
| 1102 |
|
| 1103 |
!! test |
| 1104 |
HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser) |
| 1105 |
!! options |
| 1106 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1107 |
!! wikitext |
| 1108 |
-{<span title="-{X}-">A</span>}- |
| 1109 |
!! html/php+disabled |
| 1110 |
<p><span title="X">A</span> |
| 1111 |
</p> |
| 1112 |
!! html/parsoid |
| 1113 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid='{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}' data-mw='{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"src\\\":\\\"-{X}-\\\",\\\"dsr\\\":[15,20,2,2]}&apos;>&lt;/span>\"}]]}'>A</span>"}}' data-parsoid='{"fl":[],"src":"-{<span title=\"-{X}-\">A</span>}-"}'></span></p> |
| 1114 |
!! end |
| 1115 |
|
| 1116 |
# Parsoid and PHP disagree on how to parse this example: Parsoid |
| 1117 |
# insists that the content of a language converter element be a valid |
| 1118 |
# DOM fragment or attribute string |
| 1119 |
!! test |
| 1120 |
Language converter markup with block content |
| 1121 |
!! options |
| 1122 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1123 |
!! wikitext |
| 1124 |
<span>a-{b<div>c}-d |
| 1125 |
|
| 1126 |
<span>a-{zh;zh-hans;zh-hant|b<div>c}-d |
| 1127 |
|
| 1128 |
<span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d |
| 1129 |
!! html/php |
| 1130 |
<span>ab<div>cd |
| 1131 |
<span>ab<div>cd |
| 1132 |
<span>ad</span></div></span></div></span> |
| 1133 |
!! html/parsoid |
| 1134 |
<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}'>c</div>"}}'></div>d |
| 1135 |
|
| 1136 |
<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}'>c</div>"}}'></div>d |
| 1137 |
|
| 1138 |
<p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x<span data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}'>y</span>"},{"f":"0","l":"zh-tw","t":"b<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}'>c</div>"}]}'/>d</span></p></span></span> |
| 1139 |
!! end |
| 1140 |
|
| 1141 |
!! test |
| 1142 |
LanguageConverter selser (1) |
| 1143 |
!! options |
| 1144 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1145 |
parsoid={ |
| 1146 |
"modes": ["wt2wt", "selser"], |
| 1147 |
"changes": [ |
| 1148 |
["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"] |
| 1149 |
] |
| 1150 |
} |
| 1151 |
!! wikitext |
| 1152 |
-{raw}- |
| 1153 |
!! wikitext/edited |
| 1154 |
-{edited}- |
| 1155 |
!! end |
| 1156 |
|
| 1157 |
!! test |
| 1158 |
LanguageConverter selser (2) |
| 1159 |
!! options |
| 1160 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1161 |
parsoid={ |
| 1162 |
"modes": ["wt2wt", "selser"], |
| 1163 |
"changes": [ |
| 1164 |
["span[class='x']", "contents", "text", "-{foo}-"], |
| 1165 |
["a", "contents", "text", "-{"], |
| 1166 |
["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"] |
| 1167 |
] |
| 1168 |
} |
| 1169 |
!! wikitext |
| 1170 |
<span class="x">TEXT1</span> |
| 1171 |
[http://example.com TEXT2] |
| 1172 |
[[Foo|TEXT3]] |
| 1173 |
{{1x|TEXT4}} |
| 1174 |
!! wikitext/edited |
| 1175 |
<span class="x"><nowiki>-{foo}-</nowiki></span> |
| 1176 |
[http://example.com -{] |
| 1177 |
[[Foo|<nowiki>-{</nowiki>]] |
| 1178 |
{{1x|<nowiki>-{</nowiki>}} |
| 1179 |
!! end |
| 1180 |
|
| 1181 |
# Tests LanguageVariantText in ConstrainedText |
| 1182 |
!! test |
| 1183 |
LanguageConverter selser (3) |
| 1184 |
!! options |
| 1185 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1186 |
parsoid={ |
| 1187 |
"modes": ["wt2wt", "selser"], |
| 1188 |
"changes": [ |
| 1189 |
["td > span", "attr", "typeof", "mw:LanguageVariant"], |
| 1190 |
["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"] |
| 1191 |
] |
| 1192 |
} |
| 1193 |
!! wikitext |
| 1194 |
{| |
| 1195 |
|- |
| 1196 |
|<span>Foo</span> |
| 1197 |
|} |
| 1198 |
!! wikitext/edited |
| 1199 |
{| |
| 1200 |
|- |
| 1201 |
|<nowiki/>-{edited}- |
| 1202 |
|} |
| 1203 |
!! end |
| 1204 |
|
| 1205 |
# Tests LanguageVariantText._fromSelSer |
| 1206 |
!! test |
| 1207 |
LanguageConverter selser (4) |
| 1208 |
!! options |
| 1209 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1210 |
parsoid={ |
| 1211 |
"modes": ["wt2wt", "selser"], |
| 1212 |
"changes": [ |
| 1213 |
["td > span.x", "remove"] |
| 1214 |
] |
| 1215 |
} |
| 1216 |
!! wikitext |
| 1217 |
{| |
| 1218 |
|- |
| 1219 |
|<span class="x">Foo</span>-{Bar}- |
| 1220 |
||<span class="x">Foo</span>-{Bar}- |
| 1221 |
|} |
| 1222 |
!! wikitext/edited |
| 1223 |
{| |
| 1224 |
|- |
| 1225 |
|<nowiki/>-{Bar}- |
| 1226 |
||-{Bar}- |
| 1227 |
|} |
| 1228 |
!! end |
| 1229 |
|
| 1230 |
# Since Parsoid is starting to emit canonical wikitext for links, |
| 1231 |
# [http://example.com http://example.com] will not RT back to that |
| 1232 |
# form anymore. |
| 1233 |
# Parsoid does not language-convert links (it is done in a |
| 1234 |
# post-processing step) |
| 1235 |
!! test |
| 1236 |
Proper conversion of text in external links |
| 1237 |
!! options |
| 1238 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 1239 |
parsoid=wt2html |
| 1240 |
!! wikitext |
| 1241 |
http://www.google.com |
| 1242 |
gopher://www.google.com |
| 1243 |
[http://www.google.com http://www.google.com] |
| 1244 |
[gopher://www.google.com gopher://www.google.com] |
| 1245 |
[https://www.google.com irc://www.google.com] |
| 1246 |
[ftp://www.google.com www.google.com/ftp://dir] |
| 1247 |
[//www.google.com www.google.com] |
| 1248 |
!! html/php |
| 1249 |
<p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a> |
| 1250 |
<a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a> |
| 1251 |
<a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a> |
| 1252 |
<a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a> |
| 1253 |
<a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a> |
| 1254 |
<a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a> |
| 1255 |
<a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a> |
| 1256 |
</p> |
| 1257 |
!! html/parsoid |
| 1258 |
<p><a rel="mw:ExtLink" href="http://www.google.com" class="external free">http://www.google.com</a> |
| 1259 |
<a rel="mw:ExtLink" href="gopher://www.google.com" class="external free">gopher://www.google.com</a> |
| 1260 |
<a rel="mw:ExtLink" href="http://www.google.com" class="external text">http://www.google.com</a> |
| 1261 |
<a rel="mw:ExtLink" href="gopher://www.google.com" class="external text">gopher://www.google.com</a> |
| 1262 |
<a rel="mw:ExtLink" href="https://www.google.com" class="external text">irc://www.google.com</a> |
| 1263 |
<a rel="mw:ExtLink" href="ftp://www.google.com" class="external text">www.google.com/ftp://dir</a> |
| 1264 |
<a rel="mw:ExtLink" href="//www.google.com" class="external text">www.google.com</a></p> |
| 1265 |
!! end |
| 1266 |
|
| 1267 |
!! test |
| 1268 |
Do not convert roman numbers to language variants |
| 1269 |
!! options |
| 1270 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 1271 |
!! wikitext |
| 1272 |
Fridrih IV je car. |
| 1273 |
!! html/php |
| 1274 |
<p>Фридрих IV је цар. |
| 1275 |
</p> |
| 1276 |
!! html/parsoid |
| 1277 |
<p>Fridrih IV je car.</p> |
| 1278 |
!! end |
| 1279 |
|
| 1280 |
!! test |
| 1281 |
Unclosed language converter markup "-{" |
| 1282 |
!! options |
| 1283 |
language=sr |
| 1284 |
!! wikitext |
| 1285 |
-{T|hello |
| 1286 |
!! html |
| 1287 |
<p>-{T|hello |
| 1288 |
</p> |
| 1289 |
!! end |
| 1290 |
|
| 1291 |
!! test |
| 1292 |
Don't convert raw rule "-{R|=>}-" to "=>" |
| 1293 |
!! options |
| 1294 |
language=sr |
| 1295 |
!! wikitext |
| 1296 |
-{R|=>}- |
| 1297 |
!! html/php |
| 1298 |
<p>=> |
| 1299 |
</p> |
| 1300 |
!! html/parsoid |
| 1301 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"=<span typeof=\"mw:Entity\" data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}'>></span>"}}'></span></p> |
| 1302 |
!!end |
| 1303 |
|
| 1304 |
!! test |
| 1305 |
Don't break link parsing if language converter markup is in the caption. |
| 1306 |
!! options |
| 1307 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 1308 |
!! wikitext |
| 1309 |
[[Main Page|-{R|main page}-]] |
| 1310 |
!! html/php |
| 1311 |
<p><a href="/wiki/Main_Page" title="Маин Паге">main page</a> |
| 1312 |
</p> |
| 1313 |
!! html/parsoid |
| 1314 |
<p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"main page"}}' data-parsoid='{"fl":["R"]}'></span></a></p> |
| 1315 |
!! end |
| 1316 |
|
| 1317 |
!! test |
| 1318 |
T146304: Don't break template parsing if language converter markup is in the parameter. |
| 1319 |
!! options |
| 1320 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 1321 |
!! wikitext |
| 1322 |
{{1x|-{R|foo}-}} |
| 1323 |
!! html/php |
| 1324 |
<p>foo |
| 1325 |
</p> |
| 1326 |
!! html/parsoid |
| 1327 |
<p><span typeof="mw:Transclusion mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo"}}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Шаблон:1x"},"params":{"1":{"wt":"-{R|foo}-"}},"i":0}}]}'></span></p> |
| 1328 |
!! end |
| 1329 |
|
| 1330 |
!! test |
| 1331 |
T153135: Don't break list handling if language converter markup is in the item. |
| 1332 |
!! options |
| 1333 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1334 |
!! wikitext |
| 1335 |
;-{zh-cn:AAA;zh-tw:BBB}- |
| 1336 |
;-{R|foo:bar}- |
| 1337 |
!! html/php |
| 1338 |
<dl><dt>AAA</dt> |
| 1339 |
<dt>foo:bar</dt></dl> |
| 1340 |
!! html/parsoid |
| 1341 |
<dl><dt data-parsoid='{}'><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt> |
| 1342 |
<dt data-parsoid='{}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt> |
| 1343 |
</dl> |
| 1344 |
!! end |
| 1345 |
|
| 1346 |
# Note that parsoid does not protect colons unless language converter |
| 1347 |
# markup is properly nested, because it is a backtracking parser. |
| 1348 |
!! test |
| 1349 |
T153135: Unclosed markup in definition list (code coverage) |
| 1350 |
!! options |
| 1351 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1352 |
!! wikitext |
| 1353 |
;<b>foo:bar |
| 1354 |
;-{zh-cn:AAA |
| 1355 |
!! html/php |
| 1356 |
<dl><dt><b>foo:bar</b></dt><b> |
| 1357 |
<dt>-{zh-cn:AAA</dt></b></dl> |
| 1358 |
!! html/parsoid |
| 1359 |
<dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'> |
| 1360 |
<dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl> |
| 1361 |
!! end |
| 1362 |
|
| 1363 |
!! test |
| 1364 |
T153135: Nested language converter markup in definition list (code coverage) |
| 1365 |
!! options |
| 1366 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1367 |
!! wikitext |
| 1368 |
;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def |
| 1369 |
!! html/php |
| 1370 |
<dl><dt>AAA foo:bar bat:baz</dt> |
| 1371 |
<dd>def</dd></dl> |
| 1372 |
!! html/parsoid |
| 1373 |
<dl><dt data-parsoid='{}'><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}' data-parsoid='{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}'></span> <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\"bat:baz\"}}' data-parsoid='{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}'></span>"}]}'></span></dt> |
| 1374 |
<dd data-parsoid='{"stx":"row"}'>def</dd> |
| 1375 |
</dl> |
| 1376 |
!! end |
| 1377 |
|
| 1378 |
# html2wt mode disabled due to <nowiki> insertion. |
| 1379 |
!! test |
| 1380 |
T153140: Don't break table handling if language converter markup is in the cell. |
| 1381 |
!! options |
| 1382 |
language=sr htmlVariantLanguage=sr-Cyrl |
| 1383 |
parsoid=wt2html,wt2wt,html2html |
| 1384 |
!! wikitext |
| 1385 |
{| |
| 1386 |
|- |
| 1387 |
| -{R|B}- |
| 1388 |
|} |
| 1389 |
!! html/php |
| 1390 |
<table> |
| 1391 |
|
| 1392 |
<tbody><tr> |
| 1393 |
<td>B |
| 1394 |
</td></tr></tbody></table> |
| 1395 |
!! html/parsoid |
| 1396 |
<table> |
| 1397 |
<tbody> |
| 1398 |
<tr> |
| 1399 |
<td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td> |
| 1400 |
</tr> |
| 1401 |
</tbody> |
| 1402 |
</table> |
| 1403 |
!! end |
| 1404 |
|
| 1405 |
!! test |
| 1406 |
Language converter tricky html2wt cases (1) |
| 1407 |
!! options |
| 1408 |
language=sr |
| 1409 |
parsoid=html2wt,wt2wt |
| 1410 |
!! html/parsoid |
| 1411 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p> |
| 1412 |
!! wikitext |
| 1413 |
-{<nowiki>}-</nowiki>}- |
| 1414 |
!! html/php |
| 1415 |
<p>}- |
| 1416 |
</p> |
| 1417 |
!! end |
| 1418 |
|
| 1419 |
!! test |
| 1420 |
Language converter tricky html2wt cases (2) |
| 1421 |
!! options |
| 1422 |
language=sr |
| 1423 |
parsoid=html2wt,wt2wt |
| 1424 |
!! html/parsoid |
| 1425 |
<p>-{foo}-</p> |
| 1426 |
!! wikitext |
| 1427 |
<nowiki>-{foo}-</nowiki> |
| 1428 |
!! html/php |
| 1429 |
<p>-{foo}- |
| 1430 |
</p> |
| 1431 |
!! end |
| 1432 |
|
| 1433 |
!! test |
| 1434 |
Language converter tricky html2wt cases (3) |
| 1435 |
!! options |
| 1436 |
language=sr |
| 1437 |
parsoid=html2wt,wt2wt |
| 1438 |
!! html/parsoid |
| 1439 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p> |
| 1440 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p> |
| 1441 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p> |
| 1442 |
!! wikitext |
| 1443 |
-{R||}- |
| 1444 |
|
| 1445 |
-{R|R|raw}- |
| 1446 |
|
| 1447 |
-{<nowiki>-{foo}-</nowiki>}- |
| 1448 |
!! html/php |
| 1449 |
<p>| |
| 1450 |
</p><p>R|raw |
| 1451 |
</p><p>-{foo}- |
| 1452 |
</p> |
| 1453 |
!! end |
| 1454 |
|
| 1455 |
!! test |
| 1456 |
Language converter tricky html2wt cases (4) |
| 1457 |
!! options |
| 1458 |
language=sr |
| 1459 |
parsoid=html2wt,wt2wt |
| 1460 |
!! html/parsoid |
| 1461 |
<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\":\"hey\"}},\"i\":0}}]}'>hey</span>"}}'></span></p> |
| 1462 |
!! wikitext |
| 1463 |
-{R|{{1x|hey}}}- |
| 1464 |
!! html/php |
| 1465 |
<p>hey |
| 1466 |
</p> |
| 1467 |
!! end |
| 1468 |
|
| 1469 |
# Note that the <nowiki> escaping added by parsoid for source text, |
| 1470 |
# destination text, and language names only works on the PHP side |
| 1471 |
# for *destination text*. (HTML entity escaping wouldn't work |
| 1472 |
# any better.) This is probably a bug, at least for source texts. |
| 1473 |
# (For language names PHP uses a precise regexp based on the languages |
| 1474 |
# it currently knows have variants, which is fragile since this set |
| 1475 |
# can grow/shrink over time.) |
| 1476 |
!! test |
| 1477 |
Language converter tricky html2wt cases (5) |
| 1478 |
!! options |
| 1479 |
language=zh htmlVariantLanguage=zh-Hans-CN |
| 1480 |
!! html/parsoid |
| 1481 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p> |
| 1482 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p> |
| 1483 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p> |
| 1484 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p> |
| 1485 |
<p>a:b=>c xyz</p> |
| 1486 |
!! wikitext |
| 1487 |
-{H|<nowiki>a:b=>c</nowiki>=>zh-cn:<nowiki>x;foo=>zh-cn:boo</nowiki>;bar=>zh-cn:<nowiki>bat;xyz=>zh-cn:abc</nowiki>}-foobar |
| 1488 |
|
| 1489 |
-{H|A=><nowiki>bo:g;us</nowiki>:B}- |
| 1490 |
|
| 1491 |
-{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}- |
| 1492 |
|
| 1493 |
-{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}- |
| 1494 |
|
| 1495 |
a:b=>c xyz |
| 1496 |
!! html/php+disabled |
| 1497 |
<p>foobat;xyz=>zh-cn:abc |
| 1498 |
</p><p>A |
| 1499 |
</p><p>0;zh-tw:bar |
| 1500 |
</p><p>abc |
| 1501 |
</p><p>a:b=>c 0;zh-tw:bar |
| 1502 |
</p> |
| 1503 |
!! end |
| 1504 |
|
| 1505 |
!! test |
| 1506 |
T239806: Trailing garbage in language converter rules (1) |
| 1507 |
!! options |
| 1508 |
language=zh htmlVariantLanguage=zh-Hans |
| 1509 |
parsoid=wt2html,html2html |
| 1510 |
!! wikitext |
| 1511 |
-{H|zh-cn:约翰·塞纳; zh-hk:莊·先拿; zh-tw:約翰·希南; ;}- |
| 1512 |
-{H|zh-cn:泰瑞斯·吉布森; zh-hk:泰列斯·吉遜; zh-tw:泰瑞斯·吉布森; ;}- |
| 1513 |
-{H|zh-cn:金·米尔福特; zh-tw:金·米爾福特; 真·米爾福特;}- |
| 1514 |
!! html/php |
| 1515 |
<p class="mw-empty-elt"> |
| 1516 |
|
| 1517 |
|
| 1518 |
</p> |
| 1519 |
!! html/parsoid |
| 1520 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"约翰·塞纳"},{"l":"zh-hk","t":"莊·先拿"},{"l":"zh-tw","t":"約翰·希南"}]}'/> |
| 1521 |
<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"泰瑞斯·吉布森"},{"l":"zh-hk","t":"泰列斯·吉遜"},{"l":"zh-tw","t":"泰瑞斯·吉布森"}]}'/> |
| 1522 |
<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"金·米尔福特"},{"l":"zh-tw","t":"金·米爾福特"}]}'/></p> |
| 1523 |
!! end |
| 1524 |
|
| 1525 |
!! test |
| 1526 |
T239806: Trailing garbage in language converter rules (2) |
| 1527 |
!! options |
| 1528 |
language=zh htmlVariantLanguage=zh-Hans |
| 1529 |
parsoid=wt2html,html2html |
| 1530 |
!! wikitext |
| 1531 |
-{H|zh-cn:玛格特·罗比; zh-tw:瑪格·羅比; zh-hk:瑪歌·羅比; zh-sg:玛格·罗比; ;}- |
| 1532 |
!! html/php |
| 1533 |
<p class="mw-empty-elt"> |
| 1534 |
</p> |
| 1535 |
!! html/parsoid |
| 1536 |
<p class="mw-empty-elt"><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"玛格特·罗比"},{"l":"zh-tw","t":"瑪格·羅比"},{"l":"zh-hk","t":"瑪歌·羅比"},{"l":"zh-sg","t":"玛格·罗比"}]}'/></p> |
| 1537 |
!! end |
| 1538 |
|
| 1539 |
!! test |
| 1540 |
T179579: Nowiki and lc interaction |
| 1541 |
!! options |
| 1542 |
parsoid=wt2html |
| 1543 |
language=sr |
| 1544 |
!! wikitext |
| 1545 |
-{</nowiki>123}- |
| 1546 |
|
| 1547 |
-{123<nowiki>|</nowiki>456}- |
| 1548 |
!! html/parsoid |
| 1549 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{</nowiki>123}-"}'></span></p> |
| 1550 |
|
| 1551 |
<p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123<span typeof=\"mw:Nowiki\" data-parsoid='{\"dsr\":[23,41,8,9]}'>|</span>456"}}' data-parsoid='{"fl":[],"src":"-{123<nowiki>|</nowiki>456}-"}'></span></p> |
| 1552 |
!! end |
| 1553 |
|
| 1554 |
!! test |
| 1555 |
Balinese language conversion |
| 1556 |
!! options |
| 1557 |
language=ban htmlVariantLanguage=ban-x-palmleaf |
| 1558 |
!! wikitext |
| 1559 |
ᬫᬦ᭄ᬢ᭄ᬭ -{ban-x-palmleaf:AAA;ban:BBB}- |
| 1560 |
!! html/php |
| 1561 |
<p>mantra AAA |
| 1562 |
</p> |
| 1563 |
!! html/parsoid |
| 1564 |
<p>ᬫᬦ᭄ᬢ᭄ᬭ <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"ban-x-palmleaf","t":"AAA"},{"l":"ban","t":"BBB"}]}' data-parsoid='{"fl":[],"src":"-{ban-x-palmleaf:AAA;ban:BBB}-","tSp":[6]}'></span></p> |
| 1565 |
!! end |
| 1566 |
|
| 1567 |
!! test |
| 1568 |
Langconvert tag: crh-latn to crh-cyrl |
| 1569 |
!! wikitext |
| 1570 |
<langconvert from="crh-latn" to="crh-cyrl">test</langconvert> |
| 1571 |
!! html/php |
| 1572 |
<p>тест |
| 1573 |
</p> |
| 1574 |
!! end |
| 1575 |
|
| 1576 |
!! test |
| 1577 |
Langconvert tag: en to en-x-piglatin |
| 1578 |
!! config |
| 1579 |
wgUsePigLatinVariant=true |
| 1580 |
!! wikitext |
| 1581 |
<langconvert from="en" to="en-x-piglatin">test</langconvert> |
| 1582 |
!! html/php |
| 1583 |
<p>esttay |
| 1584 |
</p> |
| 1585 |
!! end |
| 1586 |
|
| 1587 |
!! test |
| 1588 |
Langconvert tag: gan-hans to gan-hant |
| 1589 |
!! wikitext |
| 1590 |
<langconvert from="gan-hans" to="gan-hant">爱</langconvert> |
| 1591 |
!! html/php |
| 1592 |
<p>愛 |
| 1593 |
</p> |
| 1594 |
!! end |
| 1595 |
|
| 1596 |
!! test |
| 1597 |
Langconvert tag: ku-latn to ku-arab |
| 1598 |
!! wikitext |
| 1599 |
<langconvert from="ku-latn" to="ku-arab">test</langconvert> |
| 1600 |
!! html/php |
| 1601 |
<p>تەست |
| 1602 |
</p> |
| 1603 |
!! end |
| 1604 |
|
| 1605 |
!! test |
| 1606 |
Langconvert tag: shi-latn to shi-tfng |
| 1607 |
!! wikitext |
| 1608 |
<langconvert from="shi-latn" to="shi-tfng">test</langconvert> |
| 1609 |
!! html/php |
| 1610 |
<p>ⵜⴻⵙⵜ |
| 1611 |
</p> |
| 1612 |
!! end |
| 1613 |
|
| 1614 |
!! test |
| 1615 |
Langconvert tag: sr-latn to sr-cyrl |
| 1616 |
!! wikitext |
| 1617 |
<langconvert from="sr-latn" to="sr-cyrl">zdravo</langconvert> |
| 1618 |
!! html/php |
| 1619 |
<p>здраво |
| 1620 |
</p> |
| 1621 |
!! end |
| 1622 |
|
| 1623 |
!! test |
| 1624 |
Langconvert tag: sr-el to sr-ec (should fail) |
| 1625 |
!! wikitext |
| 1626 |
<langconvert from="sr-el" to="sr-ec">zdravo</langconvert> |
| 1627 |
!! html/php |
| 1628 |
<p><span class="error"><strong>Error:</strong> Langconvert tag's <code>from</code> and <code>to</code> attributes must not be empty and must contain BCP 47 codes for convertible variants of the same language.</span> |
| 1629 |
</p> |
| 1630 |
!! end |
| 1631 |
|
| 1632 |
!! test |
| 1633 |
Langconvert tag: tg to tg-latn |
| 1634 |
!! wikitext |
| 1635 |
<langconvert from="tg" to="tg-latn">тест</langconvert> |
| 1636 |
!! html/php |
| 1637 |
<p>test |
| 1638 |
</p> |
| 1639 |
!! end |
| 1640 |
|
| 1641 |
!! test |
| 1642 |
Langconvert tag: uz-cyrl to uz-latn |
| 1643 |
!! wikitext |
| 1644 |
<langconvert from="uz-cyrl" to="uz-latn">тест</langconvert> |
| 1645 |
!! html/php |
| 1646 |
<p>test |
| 1647 |
</p> |
| 1648 |
!! end |
| 1649 |
|
| 1650 |
!! test |
| 1651 |
Langconvert tag: zh-hans to zh-hant |
| 1652 |
!! wikitext |
| 1653 |
<langconvert from="zh-hans" to="zh-hant">爱</langconvert> |
| 1654 |
!! html/php |
| 1655 |
<p>愛 |
| 1656 |
</p> |
| 1657 |
!! end |
| 1658 |
|
| 1659 |
!! test |
| 1660 |
Langconvert tag: self-closed |
| 1661 |
!! wikitext |
| 1662 |
x<langconvert from="crh-latn" to="crh-cyrl"/>x |
| 1663 |
!! html/php |
| 1664 |
<p>xx |
| 1665 |
</p> |
| 1666 |
!! end |
| 1667 |
|
| 1668 |
!! test |
| 1669 |
T302678: Serialize empty twoway |
| 1670 |
!! options |
| 1671 |
language=zh |
| 1672 |
parsoid=html2wt |
| 1673 |
!! html/parsoid |
| 1674 |
<p><meta typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[]}'/></p> |
| 1675 |
!! wikitext |
| 1676 |
-{H|}- |
| 1677 |
!! end |
| 1678 |
|
| 1679 |
## Legacy parser inconsistency in the title attribute |
| 1680 |
!! test |
| 1681 |
Nonexistent internal link targets should be resolved using variants (T258856) |
| 1682 |
!! options |
| 1683 |
language=sr variant=sr-ec |
| 1684 |
!! wikitext |
| 1685 |
[[Test]] |
| 1686 |
!! html/php |
| 1687 |
<p><a href="/wiki/%D0%A2%D0%B5%D1%81%D1%82" title="Тест">Тест</a> |
| 1688 |
</p> |
| 1689 |
!! html/parsoid |
| 1690 |
<p><a rel="mw:WikiLink" href="./Тест" title="Тест" data-parsoid='{"stx":"simple","a":{"href":"./Тест","title":"Тест"},"sa":{"href":"Test","title":"Test"}}'>Test</a></p> |
| 1691 |
!! html/parsoid+langconv |
| 1692 |
<p data-mw-variant-lang="sr-el"><a rel="mw:WikiLink" href="./Тест" title="Тест">Тест</a></p> |
| 1693 |
!! end |