| 1 |
!! Version 2 |
| 2 |
|
| 3 |
!! article |
| 4 |
Template:1x |
| 5 |
!! text |
| 6 |
{{{1}}} |
| 7 |
!! endarticle |
| 8 |
|
| 9 |
# TODO: add a test for T295168 when tackling it |
| 10 |
|
| 11 |
!! test |
| 12 |
Continue to serialize the old annotated 2.3.0 html |
| 13 |
!! options |
| 14 |
parsoid=html2wt |
| 15 |
annotations=1 |
| 16 |
!! html/parsoid |
| 17 |
<p><span typeof="mw:Extension/dummyanno" about="#mwt2" data-mw='{"name":"dummyanno","attrs":{},"body":{"extsrc":"foo"}}'>foo</span></p><p> |
| 18 |
|
| 19 |
foo</p><pre typeof="mw:Extension/dummyanno" about="#mwt4" data-mw='{"name":"dummyanno","attrs":{},"body":{"extsrc":"\n bar\n"}}'>bar |
| 20 |
</pre><p>baz</p> |
| 21 |
<p>foo</p> |
| 22 |
<pre>bar</pre> |
| 23 |
<p>baz</p> |
| 24 |
!! wikitext |
| 25 |
<dummyanno>foo</dummyanno> |
| 26 |
|
| 27 |
foo<dummyanno> |
| 28 |
bar |
| 29 |
</dummyanno>baz |
| 30 |
foo |
| 31 |
bar |
| 32 |
baz |
| 33 |
!! end |
| 34 |
|
| 35 |
!! test |
| 36 |
Whole content between dummyanno tags |
| 37 |
!! options |
| 38 |
annotations=1 |
| 39 |
!! wikitext |
| 40 |
<dummyanno> |
| 41 |
==Title== |
| 42 |
|
| 43 |
Let's have some text. |
| 44 |
</dummyanno> |
| 45 |
!! html/parsoid |
| 46 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 47 |
<h2 id="Title" data-parsoid='{"dsr":[12,23,2,2,1,1]}'>Title</h2> |
| 48 |
|
| 49 |
<p data-parsoid='{"dsr":[25,46,0,0]}'>Let's have some text.</p> |
| 50 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[45,57]}'/> |
| 51 |
!! end |
| 52 |
|
| 53 |
!! test |
| 54 |
Inline dummyanno tags |
| 55 |
!! options |
| 56 |
annotations=1 |
| 57 |
!! wikitext |
| 58 |
Some text <dummyanno>with some annotated content</dummyanno> inline. |
| 59 |
!! html/parsoid |
| 60 |
<p>Some text <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[10,21]}' />with some annotated content<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[48,60]}'/> inline.</p> |
| 61 |
!! end |
| 62 |
|
| 63 |
!! test |
| 64 |
Template inside a dummyanno tag should not make a difference on its handling |
| 65 |
!! options |
| 66 |
annotations=1 |
| 67 |
!! wikitext |
| 68 |
<dummyanno>{{1x| |
| 69 |
== Title == |
| 70 |
}} |
| 71 |
|
| 72 |
Let's have some text. |
| 73 |
</dummyanno> |
| 74 |
!! html/parsoid |
| 75 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"\n== Title ==\n"}},"i":0}}]}'> |
| 76 |
</span><h2 about="#mwt1" id="Title">Title</h2><span about="#mwt1"> |
| 77 |
</span> |
| 78 |
|
| 79 |
<p>Let's have some text.</p> |
| 80 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[55,67]}'/> |
| 81 |
!! end |
| 82 |
|
| 83 |
!! test |
| 84 |
Two inline dummyanno tags should have different rangeIds |
| 85 |
!! options |
| 86 |
annotations=1 |
| 87 |
!! wikitext |
| 88 |
Some inline <dummyanno>text</dummyanno> followed by <dummyanno>some more text</dummyanno> inline |
| 89 |
!! html/parsoid |
| 90 |
<p>Some inline <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[12,23]}'/>text<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[27,39]}'/> followed by <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa1","extendedRange":false,"wtOffsets":[52,63]}'/>some more text<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[77,89]}'/> inline</p> |
| 91 |
!! end |
| 92 |
|
| 93 |
!! test |
| 94 |
Two dummyanno tags on new lines should have different rangeIds |
| 95 |
!! options |
| 96 |
annotations=1 |
| 97 |
!! wikitext |
| 98 |
Some |
| 99 |
<dummyanno> |
| 100 |
text |
| 101 |
</dummyanno> |
| 102 |
followed by |
| 103 |
<dummyanno> |
| 104 |
some more text |
| 105 |
</dummyanno> |
| 106 |
to dummyanno |
| 107 |
!! html/parsoid |
| 108 |
<p>Some |
| 109 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[7,18]}'/> |
| 110 |
text |
| 111 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[24,36]}'/> |
| 112 |
followed by |
| 113 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa1","extendedRange":false,"wtOffsets":[51,62]}'/> |
| 114 |
some more text |
| 115 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[78,90]}'/> |
| 116 |
to dummyanno</p> |
| 117 |
!! end |
| 118 |
|
| 119 |
!! test |
| 120 |
Name attribute in ann2 tags should be added to the meta tag |
| 121 |
!! options |
| 122 |
annotations=1 |
| 123 |
!! wikitext |
| 124 |
Some text <dummyanno>with some <ann2 name="plop">undummyannod</ann2> content</dummyanno> inline. |
| 125 |
!! html/parsoid |
| 126 |
<p>Some text <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[10,21]}'/>with some <meta typeof="mw:Annotation/ann2" data-mw='{"attrs":{"name":"plop"},"rangeId":"mwa1","extendedRange":false,"wtOffsets":[31,49]}'/>undummyannod<meta typeof="mw:Annotation/ann2/End" data-mw='{"wtOffsets":[61,68]}'/> content<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[76,88]}'/> inline.</p> |
| 127 |
!! end |
| 128 |
|
| 129 |
!! test |
| 130 |
Annotation wrapping an entire paragraph should be nested inside the paragraph |
| 131 |
!! options |
| 132 |
annotations=1 |
| 133 |
!! wikitext |
| 134 |
foo |
| 135 |
|
| 136 |
<dummyanno>bar</dummyanno> |
| 137 |
|
| 138 |
<dummyanno>baz</dummyanno> |
| 139 |
!! html/parsoid |
| 140 |
<p>foo</p> |
| 141 |
|
| 142 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[5,16]}'/>bar<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[19,31]}'/></p> |
| 143 |
|
| 144 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa1","extendedRange":false,"wtOffsets":[33,44]}'/>baz<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[47,59]}'/></p> |
| 145 |
!! end |
| 146 |
|
| 147 |
!! test |
| 148 |
Two paragraphs between dummyanno tags should roundtrip without duplicating the tags (DSRs are adjusted correctly) |
| 149 |
!! options |
| 150 |
annotations=1 |
| 151 |
!! wikitext |
| 152 |
<dummyanno>plop |
| 153 |
|
| 154 |
Let's have some text.</dummyanno> |
| 155 |
!! html/parsoid |
| 156 |
<meta typeof="mw:Annotation/dummyanno" data-parsoid='{"dsr":[0,11,null,null]}' data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><p data-parsoid='{"dsr":[11,15,0,0]}'>plop</p> |
| 157 |
|
| 158 |
<p data-parsoid='{"dsr":[17,38,0,0]}'>Let's have some text.</p><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"dsr":[38,50,null,null]}' data-mw='{"wtOffsets":[38,50]}'/> |
| 159 |
!! end |
| 160 |
|
| 161 |
!! test |
| 162 |
Start dummyanno tag at the beginning of a paragraph and end within <i> should extend to the end of <i> but not the whole paragraph |
| 163 |
!! options |
| 164 |
parsoid={ |
| 165 |
"modes": ["wt2html", "selser","wt2wt"] |
| 166 |
} |
| 167 |
annotations=1 |
| 168 |
!! wikitext |
| 169 |
<dummyanno>This should ''fail</dummyanno> miserably'' ... let's fix it |
| 170 |
!! html/parsoid here |
| 171 |
<p><span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[0,11]}'/>This should <i>fail miserably</i><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[29,41]}'/></span> ... let's fix it</p> |
| 172 |
!! end |
| 173 |
|
| 174 |
!! test |
| 175 |
End dummyanno tag at the end of a paragraph and beginning within <i> should extend to the end of <i> but not the whole paragraph |
| 176 |
!! options |
| 177 |
parsoid={ |
| 178 |
"modes": ["wt2html", "selser","wt2wt"] |
| 179 |
} |
| 180 |
annotations=1 |
| 181 |
!! wikitext |
| 182 |
This should ''fail <dummyanno>miserably'' ... let's fix it</dummyanno> |
| 183 |
!! html/parsoid here |
| 184 |
<p>This should <span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[19,30]}'/><i>fail miserably</i> ... let's fix it<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[58,70]}'/></span></p> |
| 185 |
!! end |
| 186 |
|
| 187 |
!! test |
| 188 |
Meta merging with annotations/template should not happen |
| 189 |
!! options |
| 190 |
annotations=1 |
| 191 |
!! wikitext |
| 192 |
<dummyanno>{{1x|stuff}}</dummyanno> |
| 193 |
!! html/parsoid |
| 194 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"stuff"}},"i":0}}]}'>stuff</span><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[23,35]}'/></p> |
| 195 |
!! end |
| 196 |
|
| 197 |
!! test |
| 198 |
Meta merging with template/annotation is fine |
| 199 |
!! options |
| 200 |
annotations=1 |
| 201 |
!! wikitext |
| 202 |
{{1x|<dummyanno>stuff</dummyanno>}} |
| 203 |
!! html/parsoid |
| 204 |
<p><meta typeof="mw:Transclusion mw:Annotation/dummyanno" about="#mwt1" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<dummyanno>stuff</dummyanno>"}},"i":0}}],"rangeId":"mwa0"}'/><span about="#mwt1">stuff</span><meta typeof="mw:Annotation/dummyanno/End" about="#mwt1" data-mw='{"rangeId":"mwa0"}'/></p> |
| 205 |
!! end |
| 206 |
|
| 207 |
!! test |
| 208 |
Attributes without value should be transferred to and back from the meta tag |
| 209 |
!! options |
| 210 |
annotations=1 |
| 211 |
!! wikitext |
| 212 |
<dummyanno nowrap>some stuff</dummyanno> |
| 213 |
!! html/parsoid |
| 214 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"attrs":{"nowrap":""},"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,18]}'/>some stuff<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[28,40]}'/></p> |
| 215 |
!! end |
| 216 |
|
| 217 |
!! test |
| 218 |
Annotation open tag in fosterable position should expand the range to the entire table |
| 219 |
!! options |
| 220 |
parsoid={ |
| 221 |
"modes": ["wt2html", "selser","wt2wt"] |
| 222 |
} |
| 223 |
annotations=1 |
| 224 |
!! wikitext |
| 225 |
{| |
| 226 |
|table |
| 227 |
|with |
| 228 |
|- |
| 229 |
<dummyanno> |
| 230 |
|some |
| 231 |
|content</dummyanno> |
| 232 |
|- |
| 233 |
|dummyanno |
| 234 |
|one line |
| 235 |
|} |
| 236 |
!! html/parsoid |
| 237 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[19,30]}'/> |
| 238 |
<table> |
| 239 |
<tbody><tr><td>table</td> |
| 240 |
<td data-parsoid>with</td></tr> |
| 241 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 242 |
<td>some</td> |
| 243 |
<td>content</td></tr> |
| 244 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 245 |
<td>dummyanno</td> |
| 246 |
<td>one line</td></tr> |
| 247 |
</tbody></table> |
| 248 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[45,57]}' /></div> |
| 249 |
!! end |
| 250 |
|
| 251 |
!! test |
| 252 |
dummyanno in the middle of fostered content should extend to the whole range, including fostered content |
| 253 |
!! options |
| 254 |
parsoid={ |
| 255 |
"modes": ["wt2html", "selser","wt2wt"] |
| 256 |
} |
| 257 |
annotations=1 |
| 258 |
!! wikitext |
| 259 |
{| |
| 260 |
foo |
| 261 |
<dummyanno>bar</dummyanno> |
| 262 |
|- |
| 263 |
|baz |
| 264 |
|} |
| 265 |
!! html/parsoid |
| 266 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[7,18]}'/><p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> |
| 267 |
foo</p> |
| 268 |
<p>bar</p><table> |
| 269 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'> |
| 270 |
<td>baz |
| 271 |
</td></tr></tbody></table><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[21,33]}'/></div> |
| 272 |
!!end |
| 273 |
|
| 274 |
# This test explicitly tests that template continuity is not broken by top-level annotation markers. Observe that the |
| 275 |
# end annotation marker is rendered before the table and not after it as one would expect. This is due to the fact that |
| 276 |
# the table itself is transclusion content, which prevents the creation of the FosterBox. Hence, the end annotation is |
| 277 |
# not detected as being fostered. This is fine because the transclusion prevents block-level DOM editing of the content, |
| 278 |
# which will avoid round-tripping issues. |
| 279 |
!!test |
| 280 |
dummyanno getting roped to template top-level because of fostering should get the about attribute of the template |
| 281 |
!! options |
| 282 |
parsoid={ |
| 283 |
"modes": ["wt2html", "selser","wt2wt"] |
| 284 |
} |
| 285 |
annotations=1 |
| 286 |
!! wikitext |
| 287 |
{{1x|Some text! |
| 288 |
<table> |
| 289 |
<p>first fostered</p> |
| 290 |
<tr> |
| 291 |
<td>table</td></tr>}} |
| 292 |
<dummyanno><tr> |
| 293 |
<td>stuff</td> |
| 294 |
</tr></dummyanno><p>last fostered</p> |
| 295 |
</table> |
| 296 |
!! html/parsoid |
| 297 |
<p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"Some text!\n<table>\n<p>first fostered</p>\n<tr>\n<td>table</td></tr>"}},"i":0}},"\n<dummyanno><tr>\n<td>stuff</td>\n</tr></dummyanno><p>last fostered</p>\n</table>"]}'>Some text!</p><span about="#mwt1"> |
| 298 |
</span><p about="#mwt1">first fostered</p><meta typeof="mw:Annotation/dummyanno" about="#mwt1" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[73,84]}'/><meta typeof="mw:Annotation/dummyanno/End" about="#mwt1" data-mw='{"wtOffsets":[109,121]}'/><p about="#mwt1">last fostered</p><table about="#mwt1" data-parsoid='{"stx":"html"}'> |
| 299 |
|
| 300 |
<tbody><tr data-parsoid='{"stx":"html"}'> |
| 301 |
<td>table</td></tr> |
| 302 |
<tr> |
| 303 |
<td>stuff</td> |
| 304 |
</tr> |
| 305 |
</tbody></table> |
| 306 |
!!end |
| 307 |
|
| 308 |
# As opposed to the previous test, the transclusion is now in fostered content directly. The annotation markers are |
| 309 |
# entered in the foster box, and then treated as such. The whole content is wrapped in ExtendedAnnRange div and in the |
| 310 |
# transclusion (both annotation tags get the transclusion about tag). |
| 311 |
!! test |
| 312 |
Annotations and templates in the fosterbox |
| 313 |
!! options |
| 314 |
parsoid={ |
| 315 |
"modes": ["wt2html", "selser","wt2wt"] |
| 316 |
} |
| 317 |
annotations=1 |
| 318 |
!! wikitext |
| 319 |
<table> |
| 320 |
<tr> |
| 321 |
<td>hello</td> |
| 322 |
<p>{{1x|world}}</p><dummyanno><p>plop</p></dummyanno> |
| 323 |
</tr> |
| 324 |
</table> |
| 325 |
!! html/parsoid |
| 326 |
<div typeof="mw:ExtendedAnnRange" about="#mwt2" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Transclusion mw:Annotation/dummyanno" about="#mwt2" data-parsoid='{"fostered":true,"wasMoved":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["<table>\n<tr>\n<td>hello</td>\n<p>",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"world"}},"i":0}},"</p><dummyanno><p>plop</p></dummyanno>\n</tr>\n</table>"],"rangeId":"mwa0","extendedRange":true,"wtOffsets":[47,58]}'/><p about="#mwt2">world</p><p about="#mwt2">plop</p><table about="#mwt2"> |
| 327 |
<tbody><tr> |
| 328 |
<td>hello</td> |
| 329 |
|
| 330 |
</tr> |
| 331 |
</tbody></table><meta typeof="mw:Annotation/dummyanno/End" about="#mwt2" data-mw='{"wtOffsets":[69,81]}'/></div> |
| 332 |
!! end |
| 333 |
|
| 334 |
!! test |
| 335 |
Fostering of nested annotation ranges |
| 336 |
!! options |
| 337 |
parsoid={ |
| 338 |
"modes": ["wt2html"] |
| 339 |
} |
| 340 |
annotations=1 |
| 341 |
!! wikitext |
| 342 |
<table> |
| 343 |
<tr> |
| 344 |
<dummyanno><ann2>plop</ann2></dummyanno> |
| 345 |
<td>cell</td> |
| 346 |
</tr> |
| 347 |
</table> |
| 348 |
!! html/parsoid |
| 349 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"rangeId":"mwa1","extendedRange":true,"wtOffsets":[13,24]}'/><div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/ann2" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[24,30]}'/><p data-parsoid='{"fostered":true,"autoInsertedStart":true}'>plop</p><table data-parsoid='{"stx":"html"}'> |
| 350 |
<tbody><tr data-parsoid='{"stx":"html"}'> |
| 351 |
|
| 352 |
<td data-parsoid='{"stx":"html"}'>cell</td> |
| 353 |
</tr> |
| 354 |
</tbody></table><meta typeof="mw:Annotation/ann2/End" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"wtOffsets":[34,41]}'/></div><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"wtOffsets":[41,53]}'/></div> |
| 355 |
!! end |
| 356 |
|
| 357 |
!! test |
| 358 |
Fostering of contiguous annotation ranges |
| 359 |
!! options |
| 360 |
parsoid={ |
| 361 |
"modes": ["wt2html"] |
| 362 |
} |
| 363 |
annotations=1 |
| 364 |
!! wikitext |
| 365 |
<table> |
| 366 |
<tr> |
| 367 |
<dummyanno>plop</dummyanno><ann2>replop</ann2> |
| 368 |
<td>cell</td> |
| 369 |
</tr> |
| 370 |
</table> |
| 371 |
!! html/parsoid |
| 372 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/ann2" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[40,46]}'/><div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"fostered":true}' data-mw='{"rangeId":"mwa1","extendedRange":true,"wtOffsets":[13,24]}'/><p data-parsoid='{"fostered":true,"autoInsertedStart":true}'>plop</p><p data-parsoid='{"fostered":true,"autoInsertedStart":true}'>replop</p><table data-parsoid='{"stx":"html"}'> |
| 373 |
<tbody><tr data-parsoid='{"stx":"html"}'> |
| 374 |
|
| 375 |
<td data-parsoid='{"stx":"html"}'>cell</td> |
| 376 |
</tr> |
| 377 |
</tbody></table><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"wtOffsets":[28,40]}'/></div><meta typeof="mw:Annotation/ann2/End" data-parsoid='{"fostered":true,"wasMoved":true}' data-mw='{"wtOffsets":[52,59]}'/></div> |
| 378 |
!! end |
| 379 |
|
| 380 |
!! test |
| 381 |
dummyanno tags around <pre> area with new lines |
| 382 |
!! options |
| 383 |
annotations=1 |
| 384 |
!! wikitext |
| 385 |
<dummyanno> |
| 386 |
foo |
| 387 |
</dummyanno> |
| 388 |
!! html/parsoid |
| 389 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 390 |
<pre>foo</pre> |
| 391 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[17,29]}'/> |
| 392 |
!! end |
| 393 |
|
| 394 |
!! test |
| 395 |
Newlines should be inserted between annotation tags and pre |
| 396 |
!! options |
| 397 |
parsoid={ |
| 398 |
"modes": ["html2wt"] |
| 399 |
} |
| 400 |
annotations=1 |
| 401 |
!! html/parsoid |
| 402 |
foo<meta typeof="mw:Annotation/dummyanno" /><pre>bar</pre><meta typeof="mw:Annotation/dummyanno/End"/>baz |
| 403 |
foo<pre>bar</pre>baz |
| 404 |
!! wikitext |
| 405 |
foo<dummyanno> |
| 406 |
bar |
| 407 |
</dummyanno>baz |
| 408 |
foo |
| 409 |
bar |
| 410 |
baz |
| 411 |
!! end |
| 412 |
|
| 413 |
!! test |
| 414 |
dummyanno tags in list items |
| 415 |
!! options |
| 416 |
annotations=1 |
| 417 |
!! wikitext |
| 418 |
*<dummyanno>List item!</dummyanno> |
| 419 |
!! html/parsoid |
| 420 |
<ul data-parsoid='{"dsr":[0,35,0,0]}'><li data-parsoid='{"dsr":[0,35,1,0,1,0]}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"dsr":[1,12,null,null]}' data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[1,12]}'/>List item!<meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"dsr":[22,34,null,null]}' data-mw='{"wtOffsets":[22,34]}'/></li></ul> |
| 421 |
!! end |
| 422 |
|
| 423 |
|
| 424 |
### Tests from annotation spec |
| 425 |
!! test |
| 426 |
1/ Whole content contained in annotation tags |
| 427 |
!! options |
| 428 |
annotations=1 |
| 429 |
!! wikitext |
| 430 |
<dummyanno> |
| 431 |
One paragraph. |
| 432 |
|
| 433 |
And another. |
| 434 |
</dummyanno> |
| 435 |
!! html/parsoid |
| 436 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 437 |
<p>One paragraph.</p> |
| 438 |
|
| 439 |
<p>And another.</p> |
| 440 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[41,53]}'/> |
| 441 |
!! end |
| 442 |
|
| 443 |
!! test |
| 444 |
2/ Extended annotation range |
| 445 |
!! options |
| 446 |
parsoid={ |
| 447 |
"modes": ["wt2html", "selser","wt2wt"] |
| 448 |
} |
| 449 |
annotations=1 |
| 450 |
!! wikitext |
| 451 |
This is ''an <dummyanno>artificial'' '''example</dummyanno> of''' extension. |
| 452 |
!! html/parsoid |
| 453 |
<p>This is <span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[13,24]}'/><i>an artificial</i> <b>example of</b><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[47,59]}'/></span> extension.</p> |
| 454 |
!! end |
| 455 |
|
| 456 |
!! test |
| 457 |
3/ Two types of annotation, nested; annotation attributes |
| 458 |
!! options |
| 459 |
annotations=1 |
| 460 |
!! wikitext |
| 461 |
<dummyanno>Some text <ann2 name="myvar">with a variable</ann2> in the middle</dummyanno> |
| 462 |
!! html/parsoid |
| 463 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/>Some text <meta typeof="mw:Annotation/ann2" data-mw='{"attrs":{"name":"myvar"},"rangeId":"mwa1","extendedRange":false,"wtOffsets":[21,40]}'/>with a variable<meta typeof="mw:Annotation/ann2/End" data-mw='{"wtOffsets":[55,62]}'/> in the middle<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[76,88]}'/></p> |
| 464 |
!! end |
| 465 |
|
| 466 |
!! test |
| 467 |
4/ Template (fully enclosed) in annotation range |
| 468 |
!! options |
| 469 |
annotations=1 |
| 470 |
!! wikitext |
| 471 |
aa <dummyanno>bb {{1x|some content}} bb</dummyanno> aa |
| 472 |
!! html/parsoid |
| 473 |
<p>aa <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[3,14]}'/>bb <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"some content"}},"i":0}}]}'>some content</span> bb<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[39,51]}'/> aa</p> |
| 474 |
!! end |
| 475 |
|
| 476 |
!! test |
| 477 |
5/ annotation (fully enclosed) in template |
| 478 |
!! options |
| 479 |
annotations=1 |
| 480 |
!! wikitext |
| 481 |
{{1x|bb <dummyanno>some content</dummyanno> bb}} aa |
| 482 |
!! html/parsoid |
| 483 |
<p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"bb <dummyanno>some content</dummyanno> bb"}},"i":0}}]}'>bb </span><meta typeof="mw:Annotation/dummyanno" about="#mwt1" data-mw='{"rangeId":"mwa0"}'/><span about="#mwt1">some content</span><meta typeof="mw:Annotation/dummyanno/End" about="#mwt1" data-mw='{"rangeId":"mwa0"}'/><span about="#mwt1"> bb</span> aa</p> |
| 484 |
!! end |
| 485 |
|
| 486 |
!! test |
| 487 |
7/ attributes in annotations |
| 488 |
!! options |
| 489 |
annotations=1 |
| 490 |
!! wikitext |
| 491 |
{| |
| 492 |
|- |
| 493 |
| style="background: <dummyanno>red</dummyanno>; color: white;" |abc |
| 494 |
|jkl |
| 495 |
|} |
| 496 |
!! html/parsoid |
| 497 |
<table> |
| 498 |
<tbody> |
| 499 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 500 |
<td style="background: red; color: white;" about="#mwt1" typeof="mw:ExpandedAttrs mw:Annotation/dummyanno" data-parsoid='{"a":{"style":"background: red; color: white;"},"sa":{"style":"background: <dummyanno>red</dummyanno>; color: white;"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"background: <meta typeof=\"mw:Annotation/dummyanno\" data-parsoid='{\"dsr\":[27,38,null,null]}' data-mw='{\"rangeId\":\"mwa0\",\"extendedRange\":false,\"wtOffsets\":[27,38]}'/>red<meta typeof=\"mw:Annotation/dummyanno/End\" data-parsoid='{\"dsr\":[41,53,null,null]}' data-mw='{\"wtOffsets\":[41,53]}'/>; color: white;"}]]}'>abc</td> |
| 501 |
<td>jkl</td></tr> |
| 502 |
</tbody></table> |
| 503 |
!! end |
| 504 |
|
| 505 |
!! test |
| 506 |
8/ fostered annotation markers |
| 507 |
!! options |
| 508 |
parsoid={ |
| 509 |
"modes": ["wt2html", "selser", "wt2wt"] |
| 510 |
} |
| 511 |
annotations=1 |
| 512 |
!! wikitext |
| 513 |
{| |
| 514 |
|table |
| 515 |
|with |
| 516 |
|- |
| 517 |
<dummyanno> |
| 518 |
|some |
| 519 |
|content |
| 520 |
</dummyanno> |
| 521 |
|- |
| 522 |
|dummyanno |
| 523 |
|one line |
| 524 |
|} |
| 525 |
!! html/parsoid |
| 526 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[19,30]}'/><table> |
| 527 |
<tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>table</td> |
| 528 |
<td>with</td></tr> |
| 529 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 530 |
|
| 531 |
<td>some</td> |
| 532 |
<td>content |
| 533 |
</td></tr> |
| 534 |
<tr data-parsoid='{"startTagSrc":"|-"}'> |
| 535 |
<td>dummyanno</td> |
| 536 |
<td>one line</td></tr> |
| 537 |
</tbody></table><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[46,58]}'/></div> |
| 538 |
!!end |
| 539 |
|
| 540 |
!! test |
| 541 |
Selser: add a paragraph at the end of the content should not make the </dummyanno> tag disappear |
| 542 |
!! options |
| 543 |
parsoid={ |
| 544 |
"modes": ["selser"], |
| 545 |
"changes": [ |
| 546 |
["p", "after", "<p>plop</p>"] |
| 547 |
] |
| 548 |
} |
| 549 |
annotations=1 |
| 550 |
!! wikitext |
| 551 |
<dummyanno> |
| 552 |
==plop== |
| 553 |
|
| 554 |
Add another paragraph. |
| 555 |
</dummyanno> |
| 556 |
!! wikitext/edited |
| 557 |
<dummyanno> |
| 558 |
==plop== |
| 559 |
|
| 560 |
Add another paragraph. |
| 561 |
|
| 562 |
plop |
| 563 |
</dummyanno> |
| 564 |
!!end |
| 565 |
|
| 566 |
!! test |
| 567 |
Selser: add content at the end of a paragraph with badly nested content with annotation |
| 568 |
!! options |
| 569 |
parsoid={ |
| 570 |
"modes": ["selser"], |
| 571 |
"changes": [ |
| 572 |
["p", "append", "something"] |
| 573 |
] |
| 574 |
} |
| 575 |
annotations=1 |
| 576 |
!! wikitext |
| 577 |
Some ''stuff <dummyanno>and '''also some'' more</dummyanno> stuff''' than that. |
| 578 |
!! wikitext/edited |
| 579 |
Some ''stuff <dummyanno>and '''also some'' more</dummyanno> stuff''' than that.something |
| 580 |
!! end |
| 581 |
|
| 582 |
!! test |
| 583 |
Selser: add content at the end of a paragraph with badly nested content without annotation |
| 584 |
!! options |
| 585 |
annotations=1 |
| 586 |
!! wikitext |
| 587 |
Some ''stuff and '''also some'' more stuff''' than that. |
| 588 |
!! html/parsoid |
| 589 |
<p>Some <i>stuff and <b>also some</b></i><b> more stuff</b> than that.</p> |
| 590 |
!! end |
| 591 |
|
| 592 |
!! test |
| 593 |
Selser: add content before and after <dummyanno> and </dummyanno> tags should keep paragraphs |
| 594 |
!! options |
| 595 |
parsoid={ |
| 596 |
"modes": ["selser"], |
| 597 |
"changes": [ |
| 598 |
["meta", "before", "<p>plop</p>"], |
| 599 |
["meta", "after", "<p>plop2</p>"] |
| 600 |
] |
| 601 |
} |
| 602 |
annotations=1 |
| 603 |
!! wikitext |
| 604 |
<dummyanno> |
| 605 |
hello |
| 606 |
</dummyanno> |
| 607 |
!! wikitext/edited |
| 608 |
plop |
| 609 |
|
| 610 |
<dummyanno> |
| 611 |
plop2 |
| 612 |
|
| 613 |
hello |
| 614 |
|
| 615 |
plop |
| 616 |
</dummyanno> |
| 617 |
|
| 618 |
plop2 |
| 619 |
!! end |
| 620 |
|
| 621 |
!! test |
| 622 |
Selser: add content before <dummyanno> and </dummyanno> tags should keep paragraphs |
| 623 |
!! options |
| 624 |
parsoid={ |
| 625 |
"modes": ["selser"], |
| 626 |
"changes": [ |
| 627 |
["meta", "before", "<p>plop</p>"] |
| 628 |
] |
| 629 |
} |
| 630 |
annotations=1 |
| 631 |
!! wikitext |
| 632 |
<dummyanno> |
| 633 |
hello |
| 634 |
</dummyanno> |
| 635 |
!! wikitext/edited |
| 636 |
plop |
| 637 |
|
| 638 |
<dummyanno> |
| 639 |
hello |
| 640 |
|
| 641 |
plop |
| 642 |
</dummyanno> |
| 643 |
!! end |
| 644 |
|
| 645 |
!! test |
| 646 |
Selser: add content after <dummyanno> and </dummyanno> tags should keep paragraphs |
| 647 |
!! options |
| 648 |
parsoid={ |
| 649 |
"modes": ["selser"], |
| 650 |
"changes": [ |
| 651 |
["meta", "after", "<p>plop2</p>"] |
| 652 |
] |
| 653 |
} |
| 654 |
annotations=1 |
| 655 |
!! wikitext |
| 656 |
<dummyanno> |
| 657 |
hello |
| 658 |
</dummyanno> |
| 659 |
!! wikitext/edited |
| 660 |
<dummyanno> |
| 661 |
plop2 |
| 662 |
|
| 663 |
hello |
| 664 |
</dummyanno> |
| 665 |
|
| 666 |
plop2 |
| 667 |
!! end |
| 668 |
|
| 669 |
!! test |
| 670 |
Selser: add headings after <dummyanno> and </dummyanno> tags should yield the right amount of new lines |
| 671 |
!!options |
| 672 |
parsoid={ |
| 673 |
"modes": ["selser"], |
| 674 |
"changes": [ |
| 675 |
["meta", "after", "<h2>plop</h2>"] |
| 676 |
] |
| 677 |
} |
| 678 |
annotations=1 |
| 679 |
!! wikitext |
| 680 |
==title== |
| 681 |
some paragraph |
| 682 |
|
| 683 |
<dummyanno> |
| 684 |
hello |
| 685 |
</dummyanno> |
| 686 |
|
| 687 |
some other paragraph |
| 688 |
!! wikitext/edited |
| 689 |
==title== |
| 690 |
some paragraph |
| 691 |
|
| 692 |
<dummyanno> |
| 693 |
== plop == |
| 694 |
hello |
| 695 |
</dummyanno> |
| 696 |
|
| 697 |
== plop == |
| 698 |
|
| 699 |
some other paragraph |
| 700 |
!! end |
| 701 |
|
| 702 |
!! test |
| 703 |
Selser: add headings before <dummyanno> and </dummyanno> tags should yield the right amount of new lines |
| 704 |
!!options |
| 705 |
parsoid={ |
| 706 |
"modes": ["selser","wt2wt"], |
| 707 |
"changes": [ |
| 708 |
["meta", "before", "<h2>plop</h2>"] |
| 709 |
] |
| 710 |
} |
| 711 |
annotations=1 |
| 712 |
!!wikitext |
| 713 |
==title== |
| 714 |
some paragraph |
| 715 |
|
| 716 |
<dummyanno> |
| 717 |
hello |
| 718 |
</dummyanno> |
| 719 |
|
| 720 |
some other paragraph |
| 721 |
!!wikitext/edited |
| 722 |
==title== |
| 723 |
some paragraph |
| 724 |
|
| 725 |
== plop == |
| 726 |
|
| 727 |
<dummyanno> |
| 728 |
hello |
| 729 |
|
| 730 |
== plop == |
| 731 |
</dummyanno> |
| 732 |
|
| 733 |
some other paragraph |
| 734 |
!! end |
| 735 |
|
| 736 |
!! test |
| 737 |
Selser: add lists before <dummyanno> and </dummyanno> tags should yield the right amount of new lines |
| 738 |
!! options |
| 739 |
parsoid={ |
| 740 |
"modes": ["selser"], |
| 741 |
"changes": [ |
| 742 |
["meta", "before", "<ul><li>plop</li></ul>"] |
| 743 |
] |
| 744 |
} |
| 745 |
annotations=1 |
| 746 |
!! wikitext |
| 747 |
==title== |
| 748 |
some paragraph |
| 749 |
|
| 750 |
<dummyanno> |
| 751 |
hello |
| 752 |
</dummyanno> |
| 753 |
|
| 754 |
some other paragraph |
| 755 |
!!wikitext/edited |
| 756 |
==title== |
| 757 |
some paragraph |
| 758 |
|
| 759 |
* plop |
| 760 |
|
| 761 |
<dummyanno> |
| 762 |
hello |
| 763 |
|
| 764 |
* plop |
| 765 |
</dummyanno> |
| 766 |
|
| 767 |
some other paragraph |
| 768 |
!! end |
| 769 |
|
| 770 |
!! test |
| 771 |
Selser: add lists after <dummyanno> and </dummyanno> tags should yield the right amount of new lines |
| 772 |
!!options |
| 773 |
parsoid={ |
| 774 |
"modes": ["selser"], |
| 775 |
"changes": [ |
| 776 |
["meta", "after", "<ul><li>plop</li></ul>"] |
| 777 |
] |
| 778 |
} |
| 779 |
annotations=1 |
| 780 |
!! wikitext |
| 781 |
==title== |
| 782 |
some paragraph |
| 783 |
|
| 784 |
<dummyanno> |
| 785 |
hello |
| 786 |
</dummyanno> |
| 787 |
|
| 788 |
some other paragraph |
| 789 |
!!wikitext/edited |
| 790 |
==title== |
| 791 |
some paragraph |
| 792 |
|
| 793 |
<dummyanno> |
| 794 |
* plop |
| 795 |
|
| 796 |
hello |
| 797 |
</dummyanno> |
| 798 |
|
| 799 |
* plop |
| 800 |
|
| 801 |
some other paragraph |
| 802 |
!! end |
| 803 |
|
| 804 |
!! test |
| 805 |
T295330 - dsr computation should allow proper selser |
| 806 |
!! options |
| 807 |
annotations=1 |
| 808 |
!! wikitext |
| 809 |
<dummyanno> |
| 810 |
<!--T:1--> |
| 811 |
'''The quick brown fox jumps over the lazy dog.''' |
| 812 |
</dummyanno> |
| 813 |
|
| 814 |
[[Category:Foo]] |
| 815 |
!! html/parsoid |
| 816 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 817 |
<!--T:1--> |
| 818 |
<p><b>The quick brown fox jumps over the lazy dog.</b></p> |
| 819 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[74,86]}'/> |
| 820 |
|
| 821 |
<link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/> |
| 822 |
!! end |
| 823 |
|
| 824 |
## FIXME: This is currently awkward where only the start of the dummyanno is pulled into the template range. |
| 825 |
## This doesn't affect correctness because the ranges are all marked extended (because of bad nesting). |
| 826 |
## But, the bad nesting is an artefact of how the paragraph wrapper leaves the opening and closing meta |
| 827 |
## tags of the annotation range in different paragraphs, and one of those paragraphs happen to be from |
| 828 |
## a template. If the p-wrapper can be tweaked to be smarter about this, this will get cleaned up better. |
| 829 |
## But, for now, the focus is on not breaking selser. |
| 830 |
!! test |
| 831 |
Top-level metas should not be migrated into paragraphs, nor pulled in the template |
| 832 |
!! options |
| 833 |
parsoid=wt2html,selser,wt2wt |
| 834 |
annotations=1 |
| 835 |
!! wikitext |
| 836 |
{{1x|<div>a</div> b}} |
| 837 |
<dummyanno> |
| 838 |
c |
| 839 |
</dummyanno> |
| 840 |
!! html/parsoid |
| 841 |
<div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"<div>a</div> b"}},"i":0}}]}'>a</div><p about="#mwt1"> b</p> |
| 842 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[22,33]}'/> |
| 843 |
<p>c</p> |
| 844 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[36,48]}'/> |
| 845 |
!! end |
| 846 |
|
| 847 |
!! test |
| 848 |
Annotations should not be hoisted out of headers |
| 849 |
!! wikitext |
| 850 |
==<dummyanno><!--T:19--> Organizational and Planning Projects</dummyanno>== |
| 851 |
!! options |
| 852 |
annotations=1 |
| 853 |
!! html/parsoid |
| 854 |
<h2 id="Organizational_and_Planning_Projects"><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[2,13]}'/><!--T:19--> Organizational and Planning Projects<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[61,73]}'/></h2> |
| 855 |
!! end |
| 856 |
|
| 857 |
# Fixing T296169 in an imperfect way - see AnnotationDOMRangeBuilder.php#removeNestedRanges for details |
| 858 |
# This test purposefully fails on wt2wt, but we want to keep the output as part of the tests results. |
| 859 |
# Selser failures are also due to the wt2wt discrepancy. |
| 860 |
!! test |
| 861 |
T296169: Nested annotations should be dropped in HTML output |
| 862 |
!! options |
| 863 |
parsoid={ |
| 864 |
"modes": ["wt2html", "selser", "wt2wt"] |
| 865 |
} |
| 866 |
annotations=1 |
| 867 |
!! wikitext |
| 868 |
<dummyanno><dummyanno>t1</dummyanno></dummyanno> <dummyanno>t2</dummyanno> <dummyanno><ann2 name="plop">t3</ann2></dummyanno> |
| 869 |
!! html/parsoid |
| 870 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/>t1<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[36,48]}'/> <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa2","extendedRange":false,"wtOffsets":[49,60]}'/>t2<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[62,74]}'/> <meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa3","extendedRange":false,"wtOffsets":[75,86]}'/><meta typeof="mw:Annotation/ann2" data-mw='{"attrs":{"name":"plop"},"rangeId":"mwa4","extendedRange":false,"wtOffsets":[86,104]}'/>t3<meta typeof="mw:Annotation/ann2/End" data-mw='{"wtOffsets":[106,113]}'/><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[113,125]}'/></p> |
| 871 |
!! end |
| 872 |
|
| 873 |
# T296169 |
| 874 |
!! test |
| 875 |
T296169: Extended annotations that yield a nested annotation should not nest said annotation |
| 876 |
!! options |
| 877 |
parsoid={ |
| 878 |
"modes": ["wt2html", "selser", "wt2wt"] |
| 879 |
} |
| 880 |
annotations=1 |
| 881 |
!! wikitext |
| 882 |
a ''<dummyanno>b'' c ''d </dummyanno> e <dummyanno>f</dummyanno>'' g |
| 883 |
!! html/parsoid |
| 884 |
<p>a <span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[4,15]}'/><i>b</i> c <i>d e f</i><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[25,37]}'/></span> g</p> |
| 885 |
!! end |
| 886 |
|
| 887 |
!! test |
| 888 |
# This is not correct yet because the template is not expanded in the HTML - the template is considered as a raw string |
| 889 |
# instead. Follow-up as T299523. |
| 890 |
Annotations with templated annotation attribute shouldn't emit a warning and should round-trip |
| 891 |
!! options |
| 892 |
annotations=1 |
| 893 |
!! wikitext |
| 894 |
<dummyanno> |
| 895 |
<ann2 {{1x|1="name=hello other=plop nowrap"}}>test</ann2> |
| 896 |
</dummyanno> |
| 897 |
!! html/parsoid |
| 898 |
<meta typeof="mw:Annotation/dummyanno" data-parsoid='{"dsr":[0,11,null,null]}' data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 899 |
<p data-parsoid='{"dsr":[12,69,0,0]}'><meta typeof="mw:Annotation/ann2" data-parsoid='{"dsr":[12,58,null,null]}' data-mw='{"attrs":{"{{1x|1=\"name=hello other=plop nowrap\"}}":""},"rangeId":"mwa1","extendedRange":false,"wtOffsets":[12,58]}'/>test<meta typeof="mw:Annotation/ann2/End" data-parsoid='{"dsr":[62,69,null,null]}' data-mw='{"wtOffsets":[62,69]}'/></p> |
| 900 |
<meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"dsr":[70,82,null,null]}' data-mw='{"wtOffsets":[70,82]}'/> |
| 901 |
!! end |
| 902 |
|
| 903 |
!! test |
| 904 |
Annotations with templated annotation attribute name shouldn't emit a warning and should round-trip |
| 905 |
!! options |
| 906 |
annotations=1 |
| 907 |
!! wikitext |
| 908 |
<dummyanno> |
| 909 |
<ann2 {{1x|name}}="hello">test</ann2> |
| 910 |
</dummyanno> |
| 911 |
!! html/parsoid |
| 912 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 913 |
<p><meta typeof="mw:Annotation/ann2" data-mw='{"attrs":{"{{1x|name}}":"hello"},"rangeId":"mwa1","extendedRange":false,"wtOffsets":[12,38]}'/>test<meta typeof="mw:Annotation/ann2/End" data-mw='{"wtOffsets":[42,49]}'/></p> |
| 914 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[50,62]}'/> |
| 915 |
!! end |
| 916 |
|
| 917 |
!! test |
| 918 |
Annotations with templated annotation attribute value shouldn't emit a warning and should round-trip |
| 919 |
!! options |
| 920 |
annotations=1 |
| 921 |
!! wikitext |
| 922 |
<dummyanno> |
| 923 |
<ann2 name="{{1x|hello}}">test</ann2> |
| 924 |
</dummyanno> |
| 925 |
!! html/parsoid |
| 926 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/> |
| 927 |
<p><meta typeof="mw:Annotation/ann2" data-mw='{"attrs":{"name":"{{1x|hello}}"},"rangeId":"mwa1","extendedRange":false,"wtOffsets":[12,38]}'/>test<meta typeof="mw:Annotation/ann2/End" data-mw='{"wtOffsets":[42,49]}'/></p> |
| 928 |
<meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[50,62]}'/> |
| 929 |
!! end |
| 930 |
|
| 931 |
!! test |
| 932 |
Annotation around a heading should not break the heading |
| 933 |
!! options |
| 934 |
annotations=1 |
| 935 |
!! wikitext |
| 936 |
<dummyanno>==plop==</dummyanno> |
| 937 |
!! html/parsoid |
| 938 |
<meta typeof="mw:Annotation/dummyanno" data-parsoid='{"dsr":[0,11,null,null]}' data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><h2 id="plop" data-parsoid='{"dsr":[11,19,2,2]}'>plop</h2><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"dsr":[19,31,null,null]}' data-mw='{"wtOffsets":[19,31]}'/> |
| 939 |
!! end |
| 940 |
|
| 941 |
!! test |
| 942 |
New lines around table-spanning annotation range extension should be maintained in selser |
| 943 |
!! options |
| 944 |
annotations=1 |
| 945 |
parsoid=wt2html,wt2wt,selser |
| 946 |
!! wikitext |
| 947 |
txt1 |
| 948 |
{| |
| 949 |
|- |
| 950 |
<dummyanno>txt2</dummyanno> |
| 951 |
|text3 |
| 952 |
|} |
| 953 |
txt4 |
| 954 |
!! html/parsoid |
| 955 |
<p>txt1</p> |
| 956 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[11,22]}'/><p data-parsoid='{"fostered":true,"autoInsertedStart":true}'>txt2</p><table> |
| 957 |
<tbody><tr data-parsoid='{"startTagSrc":"|-"}'> |
| 958 |
|
| 959 |
<td>text3 |
| 960 |
</td></tr></tbody></table><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[26,38]}'/></div> |
| 961 |
<p>txt4</p> |
| 962 |
!! end |
| 963 |
|
| 964 |
!! test |
| 965 |
Extended ranges should not result in bad nesting (T306186) |
| 966 |
!! options |
| 967 |
annotations=1 |
| 968 |
parsoid=wt2html,selser |
| 969 |
!! wikitext |
| 970 |
<dummyanno> |
| 971 |
text</dummyanno> <dummyanno> |
| 972 |
by someone |
| 973 |
|
| 974 |
Highway of Montenegro.</dummyanno> <dummyanno> |
| 975 |
by Albin Olsson, CC BY-SA 4.0. |
| 976 |
|
| 977 |
Greta Salóme, singing for Iceland.</dummyanno> <dummyanno> |
| 978 |
by Albin Olsson, CC BY-SA 4.0. |
| 979 |
|
| 980 |
Nina Kraljić, representing Croatia.</dummyanno> |
| 981 |
!! html/parsoid |
| 982 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[0,11]}'/> |
| 983 |
<p>text |
| 984 |
by someone</p> |
| 985 |
|
| 986 |
<p>Highway of Montenegro. |
| 987 |
by Albin Olsson, CC BY-SA 4.0.</p> |
| 988 |
|
| 989 |
<p>Greta Salóme, singing for Iceland. |
| 990 |
by Albin Olsson, CC BY-SA 4.0.</p> |
| 991 |
|
| 992 |
<p>Nina Kraljić, representing Croatia.</p><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[260,272]}'/></div> |
| 993 |
!! end |
| 994 |
|
| 995 |
# Looks like the comment, and the whitespace before 'Purge' are all needed. |
| 996 |
# Also, adding anything before the {{{1|..}} also leads to the test passing |
| 997 |
# without the T307172 fix. |
| 998 |
# So, this is a narrow edge case specific to this wikitext form. |
| 999 |
!! test |
| 1000 |
T307172 Regression test |
| 1001 |
!! options |
| 1002 |
annotations=1 |
| 1003 |
parsoid=wt2html |
| 1004 |
!! wikitext |
| 1005 |
{{{1|<dummyanno><!--T:2--> Purge</dummyanno>}}} |
| 1006 |
!! html/parsoid |
| 1007 |
<meta typeof="mw:Param mw:Annotation/dummyanno" about="#mwt1" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"<dummyanno><!--T:2--> Purge</dummyanno>"}},"i":0}}],"rangeId":"mwa0","extendedRange":false,"wtOffsets":[5,16]}'/><span about="#mwt1"><!--T:2--></span><pre about="#mwt1">Purge</pre><meta typeof="mw:Annotation/dummyanno/End" about="#mwt1" data-mw='{"wtOffsets":[32,44]}'/> |
| 1008 |
!! end |
| 1009 |
|
| 1010 |
!! test |
| 1011 |
Should handle poorly nested range - T325575 |
| 1012 |
!! options |
| 1013 |
annotations=1 |
| 1014 |
parsoid=wt2html |
| 1015 |
!! wikitext |
| 1016 |
<dummyanno><ann2><code>hello</ann2></dummyanno></code> |
| 1017 |
!! html/parsoid |
| 1018 |
<p><span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[0,11]}'/><span typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/ann2" data-mw='{"rangeId":"mwa1","extendedRange":true,"wtOffsets":[11,17]}'/><code data-parsoid='{"stx":"html"}'>hello</code><meta typeof="mw:Annotation/ann2/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[28,35]}'/></span><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[35,47]}'/></span></p> |
| 1019 |
!! end |
| 1020 |
|
| 1021 |
!! test |
| 1022 |
Fostering in div - "end" tag should be after the "start" tag |
| 1023 |
!! options |
| 1024 |
annotations=1 |
| 1025 |
parsoid=wt2html |
| 1026 |
!! wikitext |
| 1027 |
<table> |
| 1028 |
<tr> |
| 1029 |
<td><dummyanno>some <ann2>stuff</td> |
| 1030 |
</tr> |
| 1031 |
<div>hello</ann2></dummyanno></div> |
| 1032 |
<tr><td>hello</td></tr> |
| 1033 |
</table> |
| 1034 |
!! html/parsoid |
| 1035 |
<div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[17,28]}'/><div typeof="mw:ExtendedAnnRange" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/ann2" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa1","extendedRange":true,"wtOffsets":[33,39]}'/><div data-parsoid='{"stx":"html","fostered":true}'>hello</div><table data-parsoid='{"stx":"html"}'> |
| 1036 |
<tbody><tr data-parsoid='{"stx":"html"}'> |
| 1037 |
<td data-parsoid='{"stx":"html"}'>some stuff</td> |
| 1038 |
</tr> |
| 1039 |
|
| 1040 |
<tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hello</td></tr> |
| 1041 |
</tbody></table><meta typeof="mw:Annotation/ann2/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[66,73]}'/></div><meta typeof="mw:Annotation/dummyanno/End" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[73,85]}'/></div> |
| 1042 |
!! end |
| 1043 |
|
| 1044 |
# The wt2wt test here is failing because of the start tags (which displays another issue, but which is independent from fostering). |
| 1045 |
# But this way we can test that the end tags get included in the transclusion as they should, at least. |
| 1046 |
!! test |
| 1047 |
Fostering in div with fostered transclusion should extend the transclusion on the end annotation tag |
| 1048 |
!! options |
| 1049 |
annotations=1 |
| 1050 |
parsoid=wt2html,wt2wt |
| 1051 |
!! wikitext |
| 1052 |
<table> |
| 1053 |
<tr> |
| 1054 |
<td><dummyanno>some <ann2>stuff</td> |
| 1055 |
</tr> |
| 1056 |
{{1x|transclusion}} |
| 1057 |
<div>hello</ann2></dummyanno></div> |
| 1058 |
<tr><td>hello</td></tr> |
| 1059 |
</table> |
| 1060 |
!! html/parsoid |
| 1061 |
<div typeof="mw:ExtendedAnnRange" about="#mwt2" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/dummyanno" about="#mwt2" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa0","extendedRange":true,"wtOffsets":[17,28]}'/><div typeof="mw:ExtendedAnnRange" about="#mwt2" data-parsoid='{"autoInsertedStart":true,"autoInsertedEnd":true}'><meta typeof="mw:Annotation/ann2" about="#mwt2" data-parsoid='{"wasMoved":true}' data-mw='{"rangeId":"mwa1","extendedRange":true,"wtOffsets":[33,39]}'/><p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["<table>\n<tr>\n<td><dummyanno>some <ann2>stuff</td>\n</tr>\n",{"template":{"target":{"wt":"1x","href":"./Template:1x"},"params":{"1":{"wt":"transclusion"}},"i":0}},"\n<div>hello</ann2></dummyanno></div>\n<tr><td>hello</td></tr>\n</table>"]}'>transclusion</p><div about="#mwt2">hello</div><table about="#mwt2"> |
| 1062 |
<tbody><tr> |
| 1063 |
<td>some stuff</td> |
| 1064 |
</tr> |
| 1065 |
|
| 1066 |
|
| 1067 |
<tr><td>hello</td></tr> |
| 1068 |
</tbody></table><meta typeof="mw:Annotation/ann2/End" about="#mwt2" data-mw='{"wtOffsets":[86,93]}'/></div><meta typeof="mw:Annotation/dummyanno/End" about="#mwt2" data-parsoid='{"wasMoved":true}' data-mw='{"wtOffsets":[93,105]}'/></div> |
| 1069 |
!! end |
| 1070 |
|
| 1071 |
!! test |
| 1072 |
Doubly-closed ranges should be processed with the following end tags ignored |
| 1073 |
!! options |
| 1074 |
annotations=1 |
| 1075 |
parsoid=wt2html |
| 1076 |
!! wikitext |
| 1077 |
<dummyanno></dummyanno></dummyanno> |
| 1078 |
!! html/parsoid |
| 1079 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[11,23]}'/></dummyanno> |
| 1080 |
!! end |
| 1081 |
|
| 1082 |
!! test |
| 1083 |
Triply-closed ranges should be processed with the following end tags ignored |
| 1084 |
!! options |
| 1085 |
annotations=1 |
| 1086 |
parsoid=wt2html |
| 1087 |
!! wikitext |
| 1088 |
<dummyanno></dummyanno></dummyanno></dummyanno> |
| 1089 |
!! html/parsoid |
| 1090 |
<meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa0","extendedRange":false,"wtOffsets":[0,11]}'/><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[11,23]}'/></dummyanno></dummyanno> |
| 1091 |
!! end |
| 1092 |
|
| 1093 |
!! test |
| 1094 |
Annotation in template target |
| 1095 |
!! options |
| 1096 |
annotations=1 |
| 1097 |
!! wikitext |
| 1098 |
{{<dummyanno>1x|hello</dummyanno> stuff}} |
| 1099 |
!! html/parsoid |
| 1100 |
<p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"<dummyanno>1x","href":"./Template:1x"},"params":{"1":{"wt":"hello</dummyanno> stuff"}},"i":0}}]}'>hello</span></dummyanno><span about="#mwt1"> stuff</span></p> |
| 1101 |
!! end |
| 1102 |
|
| 1103 |
# Note that mw:Extension isn't registered as a 'real' interwiki link in |
| 1104 |
# the parser test runner, but it was the necessary prefix to trigger |
| 1105 |
# T373374 |
| 1106 |
!! test |
| 1107 |
T373374: Annotation with interwiki links |
| 1108 |
!! options |
| 1109 |
annotations=1 |
| 1110 |
parsoid=wt2html |
| 1111 |
!! wikitext |
| 1112 |
<dummyanno>[[<ann2>wikipedia:Talk:Foo</ann2>|Bar]]</dummyanno> |
| 1113 |
|
| 1114 |
<dummyanno>[[<ann2>mw:Extension:Foo</ann2>|Bar]]</dummyanno> |
| 1115 |
!! html/parsoid |
| 1116 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa2","extendedRange":false,"wtOffsets":[0,11]}'/><a typeof="mw:ExpandedAttrs mw:Annotation/ann2" rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Talk:Foo" title="wikipedia:Talk:Foo" class="extiw" data-mw='{"attribs":[[{"txt":"href"},{"html":"<meta typeof=\"mw:Annotation/ann2\" data-mw='{\"rangeId\":\"mwa0\",\"extendedRange\":false,\"wtOffsets\":[13,19]}'/>wikipedia:Talk:Foo<meta typeof=\"mw:Annotation/ann2/End\" data-mw='{\"wtOffsets\":[37,44]}'/>"}]]}'>Bar</a><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[50,62]}'/></p> |
| 1117 |
<p><meta typeof="mw:Annotation/dummyanno" data-mw='{"rangeId":"mwa3","extendedRange":false,"wtOffsets":[64,75]}'/><a typeof="mw:ExpandedAttrs mw:Annotation/ann2 mw:LocalizedAttrs" rel="mw:WikiLink" href="./Mw:Extension:Foo?action=edit&redlink=1" title="Mw:Extension:Foo" class="new" data-mw='{"attribs":[[{"txt":"href"},{"html":"<meta typeof=\"mw:Annotation/ann2\" data-mw='{\"rangeId\":\"mwa1\",\"extendedRange\":false,\"wtOffsets\":[77,83]}'/>mw:Extension:Foo<meta typeof=\"mw:Annotation/ann2/End\" data-mw='{\"wtOffsets\":[99,106]}'/>"}]]}' data-mw-i18n='{"title":{"lang":"x-page","key":"red-link-title","params":["Mw:Extension:Foo"]}}'>Bar</a><meta typeof="mw:Annotation/dummyanno/End" data-mw='{"wtOffsets":[112,124]}'/></p> |
| 1118 |
!! end |