Debian Codegraph @

extensions/Cite/tests/qunit/ve-cite/ve.dm.citeExample.js

raw symbols SCIP
1 'use strict';
2
3 /*!
4 * VisualEditor DataModel Cite-specific example data sets.
5 *
6 * @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
7 * @license MIT
8 */
9
10 ve.dm.citeExample = {};
11
12 ve.dm.citeExample.baseUri = 'http://example.com/wiki/';
13
14 ve.dm.citeExample.createExampleDocument = function ( name, store, base ) {
15 return ve.dm.example.createExampleDocumentFromObject(
16 name, store, ve.dm.citeExample, base || ve.dm.citeExample.baseUri );
17 };
18
19 ve.dm.citeExample.refListItemClipboard = function ( text ) {
20 return ve.dm.example.singleLine`
21 <span class="reference-text">
22 <div class="mw-content-ltr ve-ui-previewElement ve-ui-mwPreviewElement mw-body-content mw-parser-output">
23 <span class="ve-ce-branchNode ve-ce-internalItemNode">
24 <p class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode ve-ce-generated-wrapper">
25 ${ text }
26 </p>
27 </span>
28 </div>
29 </span>
30 `;
31 };
32
33 ve.dm.citeExample.domToDataCases = {
34 'mw:Reference': {
35 // Wikitext:
36 // Foo<ref name="bar" /> Baz<ref group="g1" name=":0">Quux</ref> Whee<ref name="bar">[[Bar]]
37 // </ref> Yay<ref group="g1">No name</ref> Quux<ref name="bar">Different content</ref> Foo
38 // <ref group="g1" name="foo" />
39 //
40 // <references group="g1"><ref group="g1" name="foo">Ref in refs</ref></references>
41 body: ve.dm.example.singleLine`
42 <p>
43 Foo
44 <sup about="#mwt1" class="mw-ref reference" data-mw='{"name":"ref","attrs":{"name":"bar"}}' id="cite_ref-bar-1-0" rel="dc:references" typeof="mw:Extension/ref">
45 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
46 </sup>
47 Baz
48 <sup about="#mwt2" class="mw-ref reference" data-mw='{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}' id="cite_ref-quux-2-0" rel="dc:references" typeof="mw:Extension/ref">
49 <a href="#cite_note-.3A0-2"><span class="cite-bracket">[</span>g1 1<span class="cite-bracket">]</span></a>
50 </sup>
51 Whee
52 <sup about="#mwt3" class="mw-ref reference" data-mw='{"name":"ref","body":{"html":"
53 <a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar
54 </a>"},"attrs":{"name":"bar"}}' id="cite_ref-bar-1-1" rel="dc:references" typeof="mw:Extension/ref">
55 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
56 </sup>
57 Yay
58 ${ /* This reference has .body.id instead of .body.html */'' }
59 <sup about="#mwt4" class="mw-ref reference" data-mw='{"name":"ref","body":{"id":"mw-cite-3"},"attrs":{"group":"g1"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref">
60 <a href="#cite_note-3"><span class="cite-bracket">[</span>g1 2<span class="cite-bracket">]</span></a>
61 </sup>
62 Quux
63 <sup about="#mwt5" class="mw-ref reference" data-mw='{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' id="cite_ref-bar-1-2" rel="dc:references" typeof="mw:Extension/ref">
64 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
65 </sup>
66 Foo
67 <sup about="#mwt6" class="mw-ref reference" data-mw='{"name":"ref","attrs":{"group":"g1","name":"foo"}}'
68 id="cite_ref-foo-4" rel="dc:references" typeof="mw:Extension/ref">
69 <a href="#cite_ref-foo-4"><span class="cite-bracket">[</span>g1 3<span class="cite-bracket">]</span></a>
70 </sup>
71 </p>
72 ${ /* The HTML below is enriched to wrap reference contents in <span id="mw-cite-[...]"> */'' }
73 ${ /* which Parsoid doesn't do yet, but T88290 asks for */'' }
74 <ol class="references" typeof="mw:Extension/references" about="#mwt7"
75 data-mw='{"name":"references","body":{
76 "html":"<sup about=\\"#mwt8\\" class=\\"mw-ref reference\\"
77 data-mw=&apos;{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;Ref in refs&amp;quot;},
78 &amp;quot;attrs&amp;quot;:{&amp;quot;group&amp;quot;:&amp;quot;g1&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;foo&amp;quot;}}&apos;
79 rel=\\"dc:references\\" typeof=\\"mw:Extension/ref\\">
80 <a href=\\"#cite_note-foo-3\\">[3]</a></sup>"},"attrs":{"group":"g1"}}'>
81 <li about="#cite_note-.3A0-2" id="cite_note-.3A0-2"><span rel="mw:referencedBy"><a href="#cite_ref-.3A0_2-0">↑</a></span> <span id="mw-cite-:0">Quux</span></li>
82 <li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> <span id="mw-cite-3">No name</span></li>
83 <li about="#cite_note-foo-4" id="cite_note-foo-4"><span rel="mw:referencedBy"><a href="#cite_ref-foo_4-0">↑</a></span> <span id="mw-cite-foo">Ref in refs</span></li>
84 </ol>
85 `,
86 fromDataBody: ve.dm.example.singleLine`
87 <p>
88 Foo
89 <sup data-mw='{"name":"ref","attrs":{"name":"bar"}}' typeof="mw:Extension/ref">
90 </sup>
91 Baz
92 <sup data-mw='{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}' typeof="mw:Extension/ref">
93 </sup>
94 Whee
95 <sup data-mw='{"name":"ref","body":{"html":"
96 <a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar
97 </a>"},"attrs":{"name":"bar"}}' typeof="mw:Extension/ref">
98 </sup>
99 Yay
100 <sup data-mw='{"name":"ref","body":{"id":"mw-cite-3"},"attrs":{"group":"g1"}}' typeof="mw:Extension/ref">
101 </sup>
102 Quux
103 <sup data-mw='{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' typeof="mw:Extension/ref">
104 </sup>
105 Foo
106 <sup data-mw='{"name":"ref","attrs":{"group":"g1","name":"foo"}}'
107 typeof="mw:Extension/ref">
108 </sup>
109 </p>
110 <div typeof="mw:Extension/references"
111 data-mw='{"name":"references","attrs":{"group":"g1"},"body":{
112 "html":"<sup typeof=\\"mw:Extension/ref\\"
113 data-mw=&apos;{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;Ref in refs&amp;quot;},
114 &amp;quot;attrs&amp;quot;:{&amp;quot;group&amp;quot;:&amp;quot;g1&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;foo&amp;quot;}}&apos;>
115 </sup>"}}'>
116 </div>
117 `,
118 clipboardBody: ve.dm.example.singleLine`
119 <p>
120 Foo
121 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"bar"}}' class="mw-ref reference">
122 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
123 </sup>
124 Baz
125 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}' class="mw-ref reference">
126 <a data-mw-group="g1"><span class="mw-reflink-text"><span class="cite-bracket">[</span>g1 1<span class="cite-bracket">]</span></span></a>
127 </sup>
128 Whee
129 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"
130 <a href=\\"./Bar\\" rel=\\"mw:WikiLink\\">Bar
131 </a>"},"attrs":{"name":"bar"}}' class="mw-ref reference">
132 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
133 </sup>
134 Yay
135 ${ /* This reference has .body.id instead of .body.html */'' }
136 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-cite-3","html":"No name"},"attrs":{"group":"g1"}}' class="mw-ref reference">
137 <a data-mw-group="g1"><span class="mw-reflink-text"><span class="cite-bracket">[</span>g1 2<span class="cite-bracket">]</span></span></a>
138 </sup>
139 Quux
140 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' class="mw-ref reference">
141 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
142 </sup>
143 Foo
144 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"g1","name":"foo"}}' class="mw-ref reference">
145 <a data-mw-group="g1"><span class="mw-reflink-text"><span class="cite-bracket">[</span>g1 3<span class="cite-bracket">]</span></span></a>
146 </sup>
147 </p>
148 ${ /* The HTML below is enriched to wrap reference contents in <span id="mw-cite-[...]"> */'' }
149 ${ /* which Parsoid doesn't do yet, but T88290 asks for */'' }
150 <div typeof="mw:Extension/references"
151 data-mw='{"name":"references","attrs":{"group":"g1"},"body":{
152 "html":"<sup typeof=\\"mw:Extension/ref\\"
153 data-mw=&apos;{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;attrs&amp;quot;:{&amp;quot;group&amp;quot;:&amp;quot;g1&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;Ref in refs&amp;quot;}}
154 &apos; class=\\"mw-ref reference\\"><a data-mw-group=\\"g1\\"><span class=\\"mw-reflink-text\\"><span class=\\"cite-bracket\\">[</span>g1 3<span class=\\"cite-bracket\\">]</span></span></a></sup>"}}'>
155 <ol class="mw-references references" data-mw-group="g1">
156 <li style='--footnote-number: "1.";'>
157 <a rel="mw:referencedBy" data-mw-group="g1"><span class="mw-linkback-text">↑ </span></a>
158 ${ ve.dm.citeExample.refListItemClipboard( 'Quux' ) }
159 </li>
160 <li style='--footnote-number: "2.";'>
161 <a rel="mw:referencedBy" data-mw-group="g1"><span class="mw-linkback-text">↑ </span></a>
162 ${ ve.dm.citeExample.refListItemClipboard( 'No name' ) }
163 </li>
164 <li style='--footnote-number: "3.";'>
165 <a rel="mw:referencedBy" data-mw-group="g1"><span class="mw-linkback-text">↑ </span></a>
166 ${ ve.dm.citeExample.refListItemClipboard( 'Ref in refs' ) }
167 </li>
168 </ol>
169 </div>
170 `,
171 data: [
172 { type: 'paragraph' },
173 'F', 'o', 'o',
174 {
175 type: 'mwReference',
176 attributes: {
177 listIndex: 0,
178 listGroup: 'mwReference/',
179 listKey: 'literal/bar',
180 refGroup: '',
181 mw: { name: 'ref', attrs: { name: 'bar' } },
182 originalMw: '{"name":"ref","attrs":{"name":"bar"}}',
183 contentsUsed: false
184 }
185 },
186 { type: '/mwReference' },
187 ' ', 'B', 'a', 'z',
188 {
189 type: 'mwReference',
190 attributes: {
191 listIndex: 1,
192 listGroup: 'mwReference/g1',
193 listKey: 'literal/:0',
194 refGroup: 'g1',
195 mw: { name: 'ref', body: { html: 'Quux' }, attrs: { group: 'g1', name: ':0' } },
196 originalMw: '{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}',
197 contentsUsed: true
198 }
199 },
200 { type: '/mwReference' },
201 ' ', 'W', 'h', 'e', 'e',
202 {
203 type: 'mwReference',
204 attributes: {
205 listIndex: 0,
206 listGroup: 'mwReference/',
207 listKey: 'literal/bar',
208 refGroup: '',
209 mw: { name: 'ref', body: { html: '<a rel="mw:WikiLink" href="./Bar">Bar</a>' }, attrs: { name: 'bar' } },
210 originalMw: '{"name":"ref","body":{"html":"<a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar</a>"},"attrs":{"name":"bar"}}',
211 contentsUsed: true
212 }
213 },
214 { type: '/mwReference' },
215 ' ', 'Y', 'a', 'y',
216 {
217 type: 'mwReference',
218 attributes: {
219 listIndex: 2,
220 listGroup: 'mwReference/g1',
221 listKey: 'auto/0',
222 refGroup: 'g1',
223 mw: { name: 'ref', body: { id: 'mw-cite-3' }, attrs: { group: 'g1' } },
224 originalMw: '{"name":"ref","body":{"id":"mw-cite-3"},"attrs":{"group":"g1"}}',
225 contentsUsed: true,
226 refListItemId: 'mw-cite-3'
227 }
228 },
229 { type: '/mwReference' },
230 ' ', 'Q', 'u', 'u', 'x',
231 {
232 type: 'mwReference',
233 attributes: {
234 listIndex: 0,
235 listGroup: 'mwReference/',
236 listKey: 'literal/bar',
237 refGroup: '',
238 mw: { name: 'ref', body: { html: 'Different content' }, attrs: { name: 'bar' } },
239 originalMw: '{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}',
240 contentsUsed: false
241 }
242 },
243 { type: '/mwReference' },
244 ' ', 'F', 'o', 'o',
245 {
246 type: 'mwReference',
247 attributes: {
248 listGroup: 'mwReference/g1',
249 listIndex: 3,
250 listKey: 'literal/foo',
251 refGroup: 'g1',
252 mw: { name: 'ref', attrs: { group: 'g1', name: 'foo' } },
253 originalMw: '{"name":"ref","attrs":{"group":"g1","name":"foo"}}',
254 contentsUsed: false
255 }
256 },
257 { type: '/mwReference' },
258 { type: '/paragraph' },
259 {
260 type: 'mwReferencesList',
261 attributes: {
262 mw: {
263 name: 'references',
264 attrs: { group: 'g1' },
265 body: {
266 html: ve.dm.example.singleLine`
267 <sup about="#mwt8" class="mw-ref reference" data-mw='{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;Ref in refs&quot;},&quot;attrs&quot;:{&quot;group&quot;:&quot;g1&quot;,&quot;name&quot;:&quot;foo&quot;}}' rel="dc:references" typeof="mw:Extension/ref">
268 <a href="#cite_note-foo-3">[3]</a>
269 </sup>
270 `
271 }
272 },
273 originalMw: '{"name":"references","body":{"html":"<sup about=\\"#mwt8\\" class=\\"mw-ref reference\\" data-mw=\'{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;Ref in refs&quot;},&quot;attrs&quot;:{&quot;group&quot;:&quot;g1&quot;,&quot;name&quot;:&quot;foo&quot;}}\' rel=\\"dc:references\\" typeof=\\"mw:Extension/ref\\"><a href=\\"#cite_note-foo-3\\">[3]</a></sup>"},"attrs":{"group":"g1"}}',
274 listGroup: 'mwReference/g1',
275 refGroup: 'g1',
276 isResponsive: true,
277 templateGenerated: false
278 }
279 },
280 { type: 'paragraph', internal: { generated: 'wrapper' } },
281 {
282 type: 'mwReference',
283 attributes: {
284 contentsUsed: true,
285 listGroup: 'mwReference/g1',
286 listIndex: 3,
287 listKey: 'literal/foo',
288 mw: { name: 'ref', attrs: { group: 'g1', name: 'foo' }, body: { html: 'Ref in refs' } },
289 originalMw: '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"group":"g1","name":"foo"}}',
290 refGroup: 'g1'
291 }
292 },
293 { type: '/mwReference' },
294 { type: '/paragraph' },
295 { type: '/mwReferencesList' },
296 { type: 'internalList' },
297 { type: 'internalItem', attributes: { originalHtml: '<a rel="mw:WikiLink" href="./Bar">Bar</a>' } },
298 { type: 'paragraph', internal: { generated: 'wrapper' } },
299 [
300 'B',
301 [ {
302 type: 'link/mwInternal',
303 attributes: {
304 title: 'Bar',
305 normalizedTitle: 'Bar',
306 lookupTitle: 'Bar'
307 }
308 } ]
309 ],
310 [
311 'a',
312 [ {
313 type: 'link/mwInternal',
314 attributes: {
315 title: 'Bar',
316 normalizedTitle: 'Bar',
317 lookupTitle: 'Bar'
318 }
319 } ]
320 ],
321 [
322 'r',
323 [ {
324 type: 'link/mwInternal',
325 attributes: {
326 title: 'Bar',
327 normalizedTitle: 'Bar',
328 lookupTitle: 'Bar'
329 }
330 } ]
331 ],
332 { type: '/paragraph' },
333 { type: '/internalItem' },
334 { type: 'internalItem', attributes: { originalHtml: 'Quux' } },
335 { type: 'paragraph', internal: { generated: 'wrapper' } },
336 'Q', 'u', 'u', 'x',
337 { type: '/paragraph' },
338 { type: '/internalItem' },
339 { type: 'internalItem', attributes: { originalHtml: 'No name' } },
340 { type: 'paragraph', internal: { generated: 'wrapper' } },
341 'N', 'o', ' ', 'n', 'a', 'm', 'e',
342 { type: '/paragraph' },
343 { type: '/internalItem' },
344 { type: 'internalItem', attributes: { originalHtml: 'Ref in refs' } },
345 { type: 'paragraph', internal: { generated: 'wrapper' } },
346 'R', 'e', 'f', ' ', 'i', 'n', ' ', 'r', 'e', 'f', 's',
347 { type: '/paragraph' },
348 { type: '/internalItem' },
349 { type: '/internalList' }
350 ]
351 },
352 'mw:Reference: Simple reference re-use (T296044)': {
353 // Wikitext:
354 // Foo<ref name="bar">[[Bar]]</ref> Baz<ref name="bar" />
355 body: ve.dm.example.singleLine`
356 <p>
357 Foo
358 <sup about="#mwt1" class="mw-ref reference" data-mw='{"name":"ref","body":{"html":"
359 <a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar
360 </a>"},"attrs":{"name":"bar"}}' id="cite_ref-bar-1-1" rel="dc:references" typeof="mw:Extension/ref">
361 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
362 </sup>
363 Baz
364 <sup about="#mwt2" class="mw-ref reference" data-mw='{"name":"ref","attrs":{"name":"bar"}}' id="cite_ref-bar-1-3" rel="dc:references" typeof="mw:Extension/ref">
365 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
366 </sup>
367 </p>
368 `,
369 fromDataBody: ve.dm.example.singleLine`
370 <p>
371 Foo
372 <sup data-mw='{"name":"ref","body":{"html":"
373 <a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar
374 </a>"},"attrs":{"name":"bar"}}' typeof="mw:Extension/ref">
375 </sup>
376 Baz
377 <sup data-mw='{"name":"ref","attrs":{"name":"bar"}}' typeof="mw:Extension/ref">
378 </sup>
379 </p>
380 `,
381 clipboardBody: ve.dm.example.singleLine`
382 <p>
383 Foo
384 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"
385 <a href=\\"./Bar\\" rel=\\"mw:WikiLink\\">Bar
386 </a>"},"attrs":{"name":"bar"}}' class="mw-ref reference">
387 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
388 </sup>
389 Baz
390 <sup typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"bar"}}' class="mw-ref reference">
391 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
392 </sup>
393 </p>
394 `,
395 data: [
396 { type: 'paragraph' },
397 'F', 'o', 'o',
398 {
399 type: 'mwReference',
400 attributes: {
401 listIndex: 0,
402 listGroup: 'mwReference/',
403 listKey: 'literal/bar',
404 refGroup: '',
405 mw: { name: 'ref', body: { html: '<a rel="mw:WikiLink" href="./Bar">Bar</a>' }, attrs: { name: 'bar' } },
406 originalMw: '{"name":"ref","body":{"html":"<a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar</a>"},"attrs":{"name":"bar"}}',
407 contentsUsed: true
408 }
409 },
410 { type: '/mwReference' },
411 ' ', 'B', 'a', 'z',
412 {
413 type: 'mwReference',
414 attributes: {
415 listIndex: 0,
416 listGroup: 'mwReference/',
417 listKey: 'literal/bar',
418 refGroup: '',
419 mw: { name: 'ref', attrs: { name: 'bar' } },
420 originalMw: '{"name":"ref","attrs":{"name":"bar"}}',
421 contentsUsed: false
422 }
423 },
424 { type: '/mwReference' },
425 { type: '/paragraph' },
426 { type: 'internalList' },
427 { type: 'internalItem', attributes: { originalHtml: '<a rel="mw:WikiLink" href="./Bar">Bar</a>' } },
428 { type: 'paragraph', internal: { generated: 'wrapper' } },
429 [
430 'B',
431 [ {
432 type: 'link/mwInternal',
433 attributes: {
434 title: 'Bar',
435 normalizedTitle: 'Bar',
436 lookupTitle: 'Bar'
437 }
438 } ]
439 ],
440 [
441 'a',
442 [ {
443 type: 'link/mwInternal',
444 attributes: {
445 title: 'Bar',
446 normalizedTitle: 'Bar',
447 lookupTitle: 'Bar'
448 }
449 } ]
450 ],
451 [
452 'r',
453 [ {
454 type: 'link/mwInternal',
455 attributes: {
456 title: 'Bar',
457 normalizedTitle: 'Bar',
458 lookupTitle: 'Bar'
459 }
460 } ]
461 ],
462 { type: '/paragraph' },
463 { type: '/internalItem' },
464 { type: '/internalList' }
465 ]
466 },
467 'mw:Reference with comment': {
468 body: ve.dm.example.singleLine`
469 <p>
470 <sup about="#mwt2" class="mw-ref reference"
471 data-mw='{"name":"ref","body":
472 {"html":"Foo<!-- bar -->"},"attrs":{}}'
473 id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref">
474 <a href="#cite_note-bar-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a>
475 </sup>
476 </p>
477 `,
478 fromDataBody: ve.dm.example.singleLine`
479 <p>
480 <sup
481 data-mw='{"name":"ref","body":
482 {"html":"Foo<!-- bar -->"},"attrs":{}}'
483 typeof="mw:Extension/ref"></sup>
484 </p>
485 `,
486 clipboardBody: ve.dm.example.singleLine`
487 <p>
488 <sup typeof="mw:Extension/ref"
489 data-mw='{"attrs":{},"body":
490 {"html":"Foo<span rel=\\"ve:Comment\\" data-ve-comment=\\" bar \\">&amp;nbsp;</span>"},"name":"ref"}'
491 class="mw-ref reference">
492 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
493 </sup>
494 </p>
495 `,
496 previewBody: ve.dm.example.singleLine`
497 <p>
498 <sup typeof="mw:Extension/ref"
499 data-mw='{"attrs":{},"body":
500 {"html":"Foo<!-- bar -->"},"name":"ref"}'
501 class="mw-ref reference">
502 <a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a>
503 </sup>
504 </p>
505 `,
506 data: [
507 { type: 'paragraph' },
508 {
509 type: 'mwReference',
510 attributes: {
511 contentsUsed: true,
512 listGroup: 'mwReference/',
513 listIndex: 0,
514 listKey: 'auto/0',
515 mw: {
516 attrs: {},
517 body: {
518 html: 'Foo<!-- bar -->'
519 },
520 name: 'ref'
521 },
522 originalMw: '{"name":"ref","body":{"html":"Foo<!-- bar -->"},"attrs":{}}',
523 refGroup: ''
524 }
525 },
526 { type: '/mwReference' },
527 { type: '/paragraph' },
528 { type: 'internalList' },
529 { type: 'internalItem', attributes: { originalHtml: 'Foo<!-- bar -->' } },
530 {
531 internal: {
532 generated: 'wrapper'
533 },
534 type: 'paragraph'
535 },
536 'F', 'o', 'o',
537 {
538 type: 'comment',
539 attributes: {
540 text: ' bar '
541 }
542 },
543 { type: '/comment' },
544 { type: '/paragraph' },
545 { type: '/internalItem' },
546 { type: '/internalList' }
547 ]
548 },
549 'Template generated reflist': {
550 body: ve.dm.example.singleLine`
551 <p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"notes"}}'><a href="./Main_Page#cite_note-1" data-mw-group="notes"><span class="mw-reflink-text"><span class="cite-bracket">[</span>notes 1<span class="cite-bracket">]</span></span></a></sup></p>
552 <div class="mw-references-wrap" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references group=\\"notes\\" />"}},"i":0}}]}'>
553 <ol class="mw-references references" data-mw-group="notes">
554 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" data-mw-group="notes" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
555 </ol>
556 </div>
557 `,
558 fromDataBody: ve.dm.example.singleLine`
559 <p><sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"notes"}}'></sup></p>
560 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references group=\\"notes\\" />"}},"i":0}}]}'></span>
561 `,
562 clipboardBody: ve.dm.example.singleLine`
563 <p><sup typeof="mw:Extension/ref" data-mw='{"attrs":{"group":"notes"},"body":{"id":"mw-reference-text-cite_note-1","html":"Foo"},"name":"ref"}' class="mw-ref reference"><a data-mw-group="notes"><span class="mw-reflink-text"><span class="cite-bracket">[</span>notes 1<span class="cite-bracket">]</span></span></a></sup></p>
564 <div typeof="mw:Extension/references" data-mw='{"parts":[{"template":{"params":{"1":{"wt":"<references group=\\"notes\\" />"}},"target":{"wt":"echo","href":"./Template:Echo"},"i":0}}],"name":"references"}'>
565 ${ /* TODO: This should list should get populated on copy */'' }
566 <ol class="mw-references references"></ol>
567 </div>
568 `,
569 previewBody: false,
570 data: [
571 { type: 'paragraph' },
572 {
573 type: 'mwReference',
574 attributes: {
575 contentsUsed: true,
576 listGroup: 'mwReference/notes',
577 listIndex: 0,
578 listKey: 'auto/0',
579 mw: {
580 attrs: {
581 group: 'notes'
582 },
583 body: {
584 id: 'mw-reference-text-cite_note-1'
585 },
586 name: 'ref'
587 },
588 originalMw: '{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"notes"}}',
589 refGroup: 'notes',
590 refListItemId: 'mw-reference-text-cite_note-1'
591 }
592 },
593 { type: '/mwReference' },
594 { type: '/paragraph' },
595 {
596 type: 'mwReferencesList',
597 attributes: {
598 mw: {
599 parts: [ {
600 template: {
601 params: {
602 1: { wt: '<references group="notes" />' }
603 },
604 target: { wt: 'echo', href: './Template:Echo' },
605 i: 0
606 }
607 } ]
608 },
609 originalMw: '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references group=\\"notes\\" />"}},"i":0}}]}',
610 refGroup: '',
611 listGroup: 'mwReference/',
612 isResponsive: true,
613 templateGenerated: true
614 }
615 },
616 { type: '/mwReferencesList' },
617 { type: 'internalList' },
618 { type: 'internalItem', attributes: { originalHtml: 'Foo' } },
619 {
620 internal: {
621 generated: 'wrapper'
622 },
623 type: 'paragraph'
624 },
625 'F', 'o', 'o',
626 { type: '/paragraph' },
627 { type: '/internalItem' },
628 { type: '/internalList' }
629 ]
630 },
631 'Template generated reflist (div wrapped)': {
632 body: ve.dm.example.singleLine`
633 <p><sup about="#mwt2" class="mw-ref reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a></sup></p>
634 <div about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"reflist","href":"./Template:Reflist"},"params":{},"i":0}}]}'>
635 <div typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
636 <ol class="mw-references references">
637 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
638 </ol>
639 </div>
640 </div>
641 `,
642 fromDataBody: ve.dm.example.singleLine`
643 <p><sup typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'></sup></p>
644 <span typeof="mw:Transclusion" data-mw='{"name":"references","attrs":{}}'></span>
645 `,
646 clipboardBody: ve.dm.example.singleLine`
647 <p><sup typeof="mw:Extension/ref" data-mw='{"attrs":{},"body":{"id":"mw-reference-text-cite_note-1","html":"Foo"},"name":"ref"}' class="mw-ref reference"><a><span class="mw-reflink-text"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></span></a></sup></p>
648 <div typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
649 <ol class="mw-references references">
650 <li style='--footnote-number: "1.";'>
651 <a rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a>
652 ${ ve.dm.citeExample.refListItemClipboard( 'Foo' ) }
653 </li>
654 </ol>
655 </div>
656 `,
657 previewBody: false,
658 data: [
659 { type: 'paragraph' },
660 {
661 type: 'mwReference',
662 attributes: {
663 contentsUsed: true,
664 listGroup: 'mwReference/',
665 listIndex: 0,
666 listKey: 'auto/0',
667 mw: {
668 attrs: {},
669 body: {
670 id: 'mw-reference-text-cite_note-1'
671 },
672 name: 'ref'
673 },
674 originalMw: '{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}',
675 refGroup: '',
676 refListItemId: 'mw-reference-text-cite_note-1'
677 }
678 },
679 { type: '/mwReference' },
680 { type: '/paragraph' },
681 {
682 type: 'mwReferencesList',
683 attributes: {
684 mw: {
685 name: 'references',
686 attrs: {}
687 },
688 originalMw: '{"name":"references","attrs":{}}',
689 refGroup: '',
690 listGroup: 'mwReference/',
691 isResponsive: true,
692 templateGenerated: true
693 }
694 },
695 { type: '/mwReferencesList' },
696 { type: 'internalList' },
697 { type: 'internalItem', attributes: { originalHtml: 'Foo' } },
698 {
699 internal: {
700 generated: 'wrapper'
701 },
702 type: 'paragraph'
703 },
704 'F', 'o', 'o',
705 { type: '/paragraph' },
706 { type: '/internalItem' },
707 { type: '/internalList' }
708 ]
709 },
710 'Extend reference': {
711 body: ve.dm.example.singleLine`
712 <p>
713 <sup typeof="mw:Extension/ref" class="mw-ref reference"
714 data-mw='{"name":"ref","body":{"html":"Bar"},"attrs":{"extends":"foo"}}'>
715 </sup>
716 </p>
717 `,
718 fromDataBody: ve.dm.example.singleLine`
719 <p>
720 <sup typeof="mw:Extension/ref"
721 data-mw='{"name":"ref","body":{"html":"Bar"},"attrs":{"extends":"foo"}}'>
722 </sup>
723 </p>
724 `,
725 clipboardBody: ve.dm.example.singleLine`
726 <p>
727 <sup typeof="mw:Extension/ref"
728 data-mw='{"name":"ref","body":{"html":"Bar"},"attrs":{"extends":"foo"}}'
729 class="mw-ref reference">
730 <a>
731 <span class="mw-reflink-text"><span class="cite-bracket">[</span>1.1<span class="cite-bracket">]</span></span>
732 </a>
733 </sup>
734 </p>
735 `,
736 data: [
737 { type: 'paragraph' },
738 {
739 type: 'mwReference',
740 attributes: {
741 contentsUsed: true,
742 extendsRef: 'literal/foo',
743 listGroup: 'mwReference/',
744 listIndex: 0,
745 listKey: 'auto/0',
746 mw: {
747 attrs: { extends: 'foo' },
748 body: { html: 'Bar' },
749 name: 'ref'
750 },
751 originalMw: '{"name":"ref","body":{"html":"Bar"},"attrs":{"extends":"foo"}}',
752 refGroup: ''
753 }
754 },
755 { type: '/mwReference' },
756 { type: '/paragraph' },
757 { type: 'internalList' },
758 {
759 attributes: { originalHtml: 'Bar' },
760 type: 'internalItem'
761 },
762 {
763 internal: { generated: 'wrapper' },
764 type: 'paragraph'
765 },
766 'B', 'a', 'r',
767 { type: '/paragraph' },
768 { type: '/internalItem' },
769 { type: '/internalList' }
770 ]
771 }
772 };
773
774 ve.dm.citeExample.references = [
775 { type: 'paragraph' },
776 {
777 type: 'mwReference',
778 attributes: {
779 contentsUsed: true,
780 listGroup: 'mwReference/',
781 listIndex: 0,
782 listKey: 'auto/0',
783 mw: {
784 attrs: {},
785 body: { html: 'No name 1' },
786 name: 'ref'
787 },
788 originalMw: '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}',
789 refGroup: ''
790 }
791 },
792 { type: '/mwReference' },
793 { type: '/paragraph' },
794 { type: 'paragraph' },
795 'F', 'o', 'o',
796 {
797 type: 'mwReference',
798 attributes: {
799 contentsUsed: true,
800 listGroup: 'mwReference/',
801 listIndex: 1,
802 listKey: 'literal/bar',
803 mw: {
804 attrs: { name: 'bar' },
805 body: { html: 'Bar' },
806 name: 'ref'
807 },
808 originalMw: '{"body":{"html":""},"attrs":{"name":"bar"}}',
809 refGroup: ''
810 }
811 },
812 { type: '/mwReference' },
813 ' ', 'B', 'a', 'z',
814 {
815 type: 'mwReference',
816 attributes: {
817 contentsUsed: true,
818 listGroup: 'mwReference/',
819 listIndex: 2,
820 listKey: 'literal/:3',
821 mw: {
822 attrs: { name: ':3' },
823 body: { html: 'Quux' },
824 name: 'ref'
825 },
826 originalMw: '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":":3"}}',
827 refGroup: ''
828 }
829 },
830 { type: '/mwReference' },
831 ' ', 'W', 'h', 'e', 'e',
832 {
833 type: 'mwReference',
834 attributes: {
835 contentsUsed: false,
836 listGroup: 'mwReference/',
837 listIndex: 1,
838 listKey: 'literal/bar',
839 mw: {
840 attrs: { name: 'bar' },
841 name: 'ref'
842 },
843 originalMw: '{"body":{"html":""},"attrs":{"name":"bar"}}',
844 refGroup: ''
845 }
846 },
847 { type: '/mwReference' },
848 ' ', 'Y', 'a', 'y',
849 { type: '/paragraph' },
850 { type: 'paragraph' },
851 {
852 type: 'mwReference',
853 attributes: {
854 contentsUsed: true,
855 listGroup: 'mwReference/',
856 listIndex: 3,
857 listKey: 'auto/1',
858 mw: {
859 attrs: {},
860 body: { html: 'No name 2' },
861 name: 'ref'
862 },
863 originalMw: '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}',
864 refGroup: ''
865 }
866 },
867 { type: '/mwReference' },
868 {
869 type: 'mwReference',
870 attributes: {
871 contentsUsed: true,
872 listGroup: 'mwReference/foo',
873 listIndex: 4,
874 listKey: 'auto/2',
875 mw: {
876 attrs: { group: 'foo' },
877 body: { html: 'No name 3' },
878 name: 'ref'
879 },
880 originalMw: '{"name":"ref","body":{"html":"No name 3"},"attrs":{"group":"foo"}}',
881 refGroup: 'foo'
882 }
883 },
884 { type: '/mwReference' },
885 { type: '/paragraph' },
886 {
887 type: 'mwReferencesList',
888 // originalDomElements: HTML,
889 attributes: {
890 mw: {
891 name: 'references',
892 attrs: { group: 'g1' }
893 },
894 originalMw: '{"name":"references","attrs":{"group":"g1"}"}',
895 listGroup: 'mwReference/',
896 refGroup: '',
897 isResponsive: true,
898 templateGenerated: false
899 }
900 },
901 { type: '/mwReferencesList' },
902 { type: 'internalList' },
903 { type: 'internalItem' },
904 { type: 'paragraph' },
905 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '1',
906 { type: '/paragraph' },
907 { type: '/internalItem' },
908 { type: 'internalItem' },
909 { type: 'paragraph' },
910 'B', 'a', 'r',
911 { type: '/paragraph' },
912 { type: '/internalItem' },
913 { type: 'internalItem' },
914 { type: 'paragraph' },
915 'Q', 'u', 'u', 'x',
916 { type: '/paragraph' },
917 { type: '/internalItem' },
918 { type: 'internalItem' },
919 { type: 'paragraph' },
920 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '2',
921 { type: '/paragraph' },
922 { type: '/internalItem' },
923 { type: 'internalItem' },
924 { type: 'paragraph' },
925 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '3',
926 { type: '/paragraph' },
927 { type: '/internalItem' },
928 { type: '/internalList' }
929 ];
930
931 ve.dm.citeExample.complexInternalData = [
932 // 0
933 { type: 'paragraph' },
934 'F', [ 'o', [ ve.dm.example.bold ] ], [ 'o', [ ve.dm.example.italic ] ],
935 // 4
936 { type: 'mwReference', attributes: {
937 about: '#mwt1',
938 listIndex: 0,
939 listGroup: 'mwReference/',
940 listKey: 'auto/0',
941 refGroup: ''
942 } },
943 // 5
944 { type: '/mwReference' },
945 // 6
946 { type: '/paragraph' },
947 // 7
948 { type: 'internalList' },
949 // 8
950 { type: 'internalItem' },
951 // 9
952 { type: 'paragraph', internal: { generated: 'wrapper' } },
953 'R', [ 'e', [ ve.dm.example.bold ] ], 'f',
954 // 13
955 'e', [ 'r', [ ve.dm.example.italic ] ], [ 'e', [ ve.dm.example.italic ] ],
956 // 16
957 { type: 'mwReference', attributes: {
958 mw: {},
959 about: '#mwt2',
960 listIndex: 1,
961 listGroup: 'mwReference/',
962 listKey: 'foo',
963 refGroup: '',
964 contentsUsed: true
965 } },
966 // 17
967 { type: '/mwReference' },
968 'n', 'c', 'e',
969 // 21
970 { type: '/paragraph' },
971 // 22
972 { type: '/internalItem' },
973 // 23
974 { type: 'internalItem' },
975 // 24
976 { type: 'preformatted' },
977 // 25
978 { type: 'mwEntity', attributes: { character: '€' } },
979 // 26
980 { type: '/mwEntity' },
981 '2', '5', '0',
982 // 30
983 { type: '/preformatted' },
984 // 31
985 { type: '/internalItem' },
986 // 32
987 { type: '/internalList' }
988 // 33
989 ];
990
991 ve.dm.citeExample.complexInternalData.internalItems = [
992 { group: 'mwReference', key: null, body: 'First reference' },
993 { group: 'mwReference', key: 'foo', body: 'Table in ref: <table><tr><td>because I can</td></tr></table>' }
994 ];
995
996 ve.dm.citeExample.complexInternalData.internalListNextUniqueNumber = 1;
997
998 ve.dm.citeExample.extends = [
999 { type: 'paragraph' },
1000 { type: 'mwReference', attributes: {
1001 extendsRef: 'literal/ldr',
1002 listIndex: 0,
1003 listGroup: 'mwReference/',
1004 listKey: 'auto/0',
1005 refGroup: ''
1006 } },
1007 { type: '/mwReference' },
1008 { type: 'mwReference', attributes: {
1009 listIndex: 1,
1010 listGroup: 'mwReference/',
1011 listKey: 'auto/1',
1012 refGroup: ''
1013 } },
1014 { type: '/mwReference' },
1015 { type: 'mwReference', attributes: {
1016 extendsRef: 'literal/nonexistent',
1017 listIndex: 2,
1018 listGroup: 'mwReference/',
1019 listKey: 'literal/orphaned',
1020 refGroup: ''
1021 } },
1022 { type: '/mwReference' },
1023 { type: '/paragraph' },
1024 { type: 'mwReferencesList', attributes: {
1025 listGroup: 'mwReference/',
1026 refGroup: ''
1027 } },
1028 { type: 'paragraph' },
1029 { type: 'mwReference', attributes: {
1030 listIndex: 3,
1031 listGroup: 'mwReference/',
1032 listKey: 'literal/ldr',
1033 refGroup: ''
1034 } },
1035 { type: '/mwReference' },
1036 { type: '/paragraph' },
1037 { type: '/mwReferencesList' },
1038 { type: 'internalList' },
1039 { type: 'internalItem' },
1040 { type: 'paragraph' },
1041 'S', 'u', 'b', 'r', 'e', 'f',
1042 { type: '/paragraph' },
1043 { type: '/internalItem' },
1044 { type: 'internalItem' },
1045 { type: 'paragraph' },
1046 'O', 't', 'h', 'e', 'r',
1047 { type: '/paragraph' },
1048 { type: '/internalItem' },
1049 { type: 'internalItem' },
1050 { type: 'paragraph' },
1051 'L', 'i', 's', 't', '-', 'd', 'e', 'f', 'i', 'n', 'e', 'd',
1052 { type: '/paragraph' },
1053 { type: '/internalItem' },
1054 { type: '/internalList' }
1055 ];