/*! * VisualEditor DataModel MediaWiki-specific example data sets. * * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * @class * @singleton * @ignore */ ve.dm.mwExample = {}; ve.dm.mwExample.createExampleDocument = function ( name, store ) { return ve.dm.example.createExampleDocumentFromObject( name, store, ve.dm.mwExample ); }; ve.dm.mwExample.MWTransclusion = { blockOpen: '
' + '
', blockOpenModified: '
' + '
', blockOpenFromData: '' + '', blockOpenClipboard: '
' + ' ' + '
', blockOpenFromDataModified: '' + '', blockOpenModifiedClipboard: '' + ' ' + '', blockContent: '

Hello, world!

', blockContentClipboard: '

Hello, world!

', inlineOpen: '', inlineOpenModified: '', inlineOpenFromData: '', inlineOpenClipboard: '', inlineOpenFromDataModified: '', inlineOpenModifiedClipboard: '' + ' ', inlineContent: '$1,234.00', inlineClose: '', mixed: '' + 'Foo', mixedFromData: '', mixedClipboard: ' ' + 'Foo', pairOne: '

foo

', pairTwo: '

foo

', pairFromData: '', pairClipboard: '

foo

', meta: '' + '\n' + '', metaFromData: '', metaClipboard: ' ' }; ve.dm.mwExample.MWTransclusion.blockData = { type: 'mwTransclusionBlock', attributes: { mw: { parts: [ { template: { target: { wt: 'Test', href: './Template:Test' }, params: { 1: { wt: 'Hello, world!' } }, i: 0 } } ] }, originalMw: '{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}', originalIndex: 0 } }; ve.dm.mwExample.MWTransclusion.inlineData = { type: 'mwTransclusionInline', attributes: { mw: { parts: [ { template: { target: { wt: 'Inline', href: './Template:Inline' }, params: { 1: { wt: '1,234' } }, i: 0 } } ] }, originalMw: '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}', originalIndex: 0 } }; ve.dm.mwExample.MWTransclusion.mixedDataOpen = { type: 'mwTransclusionInline', attributes: { mw: { parts: [ { template: { target: { wt: 'Inline', href: './Template:Inline' }, params: { 1: { wt: '5,678' } }, i: 0 } } ] }, originalMw: '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}', originalIndex: 0 } }; ve.dm.mwExample.MWTransclusion.mixedDataClose = { type: '/mwTransclusionInline' }; ve.dm.mwExample.MWTransclusion.blockParamsHash = OO.getHash( [ ve.dm.MWTransclusionNode.static.getHashObject( ve.dm.mwExample.MWTransclusion.blockData ), undefined ] ); ve.dm.mwExample.MWTransclusion.blockStoreItems = { hash: ve.dm.mwExample.MWTransclusion.blockParamsHash, value: $( ve.dm.mwExample.MWTransclusion.blockOpen + ve.dm.mwExample.MWTransclusion.blockContent ).toArray() }; ve.dm.mwExample.MWTransclusion.inlineParamsHash = OO.getHash( [ ve.dm.MWTransclusionNode.static.getHashObject( ve.dm.mwExample.MWTransclusion.inlineData ), undefined ] ); ve.dm.mwExample.MWTransclusion.inlineStoreItems = { hash: ve.dm.mwExample.MWTransclusion.inlineParamsHash, value: $( ve.dm.mwExample.MWTransclusion.inlineOpen + ve.dm.mwExample.MWTransclusion.inlineContent + ve.dm.mwExample.MWTransclusion.inlineClose ).toArray() }; ve.dm.mwExample.MWTransclusion.mixedParamsHash = OO.getHash( [ ve.dm.MWTransclusionNode.static.getHashObject( ve.dm.mwExample.MWTransclusion.mixedDataOpen ), undefined ] ); ve.dm.mwExample.MWTransclusion.mixedStoreItems = { hash: ve.dm.mwExample.MWTransclusion.mixedParamsHash, value: $( ve.dm.mwExample.MWTransclusion.mixed ).toArray() }; ve.dm.mwExample.MWInternalLink = { absoluteHref: ve.resolveUrl( '/wiki/Foo/Bar', ve.dm.example.base ) }; ve.dm.mwExample.MWInternalLink.absoluteOpen = ''; ve.dm.mwExample.MWInternalLink.absoluteData = { type: 'link/mwInternal', attributes: { title: 'Foo/Bar', origTitle: 'Foo/Bar', normalizedTitle: 'Foo/Bar', lookupTitle: 'Foo/Bar', hrefPrefix: '' } }; ve.dm.mwExample.MWInternalSectionLink = { absoluteHref: ve.resolveUrl( '/wiki/Foo#Bar', ve.dm.example.base ) }; ve.dm.mwExample.MWInternalSectionLink.absoluteOpen = ''; ve.dm.mwExample.MWInternalSectionLink.absoluteData = { type: 'link/mwInternal', attributes: { title: 'Foo#Bar', origTitle: 'Foo#Bar', normalizedTitle: 'Foo#Bar', lookupTitle: 'Foo', hrefPrefix: '' } }; ve.dm.mwExample.MWBlockImage = { html: '
' + '' + '
abc
' + '
', data: [ { type: 'mwBlockImage', attributes: { type: 'thumb', align: 'right', href: 'Foo', src: 'Bar', width: 1, height: 2, resource: 'FooBar', originalClasses: 'mw-halign-right foobar', unrecognizedClasses: [ 'foobar' ] } }, { type: 'mwImageCaption' }, { type: 'paragraph', internal: { generated: 'wrapper' } }, 'a', 'b', 'c', { type: '/paragraph' }, { type: '/mwImageCaption' }, { type: '/mwBlockImage' } ], storeItems: [ { hash: '[{"height":2,"resource":"FooBar","type":"mwBlockImage","width":1},null]', value: 'Bar' } ] }; ve.dm.mwExample.MWInlineImage = { html: '' + '' + '' + '' + '', data: { type: 'mwInlineImage', attributes: { src: 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png', href: './File:Wiki.png', width: 135, height: 155, isLinked: true, valign: 'text-top', resource: './File:Wiki.png', type: 'none', originalClasses: 'foo mw-valign-text-top', unrecognizedClasses: [ 'foo' ] } }, storeItems: [ { hash: '[{"height":155,"resource":"./File:Wiki.png","type":"mwInlineImage","width":135},null]', value: 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png' } ] }; ve.dm.mwExample.mwNowikiAnnotation = { type: 'mwNowiki' }; ve.dm.mwExample.mwNowiki = [ { type: 'paragraph' }, 'F', 'o', 'o', [ '[', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ '[', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ 'B', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ 'a', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ 'r', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ ']', [ ve.dm.mwExample.mwNowikiAnnotation ] ], [ ']', [ ve.dm.mwExample.mwNowikiAnnotation ] ], 'B', 'a', 'z', { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ]; ve.dm.mwExample.mwNowikiHtml = '

Foo[[Bar]]Baz

'; ve.dm.mwExample.mwNowikiHtmlFromData = '

Foo[[Bar]]Baz

'; ve.dm.mwExample.withMeta = [ { type: 'paragraph', internal: { generated: 'wrapper' } }, { type: 'comment', attributes: { text: ' No content conversion ' } }, { type: '/comment' }, { type: '/paragraph' }, { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() }, { type: '/mwAlienMeta' }, { type: 'paragraph' }, 'F', 'o', 'o', { type: 'mwCategory', attributes: { hrefPrefix: './', category: 'Category:Bar', origCategory: 'Category:Bar', sortkey: '', origSortkey: '' } }, { type: '/mwCategory' }, 'B', 'a', 'r', { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() }, { type: '/mwAlienMeta' }, 'B', 'a', { type: 'comment', attributes: { text: ' inline ' } }, { type: '/comment' }, 'z', { type: '/paragraph' }, { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() }, { type: '/mwAlienMeta' }, { type: 'paragraph', internal: { generated: 'wrapper' } }, { type: 'comment', attributes: { text: 'barbaz' } }, { type: '/comment' }, { type: '/paragraph' }, { type: 'mwCategory', attributes: { hrefPrefix: './', category: 'Category:Foo foo', origCategory: 'Category:Foo_foo', sortkey: 'Bar baz#quux', origSortkey: 'Bar baz%23quux' } }, { type: '/mwCategory' }, { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() }, { type: '/mwAlienMeta' }, { type: 'internalList' }, { type: '/internalList' } ]; ve.dm.mwExample.withMetaPlainData = [ { type: 'paragraph' }, 'F', 'o', 'o', 'B', 'a', 'r', 'B', 'a', 'z', { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ]; ve.dm.mwExample.withMetaMetaData = [ [ { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() } ], undefined, undefined, undefined, [ { type: 'mwCategory', attributes: { hrefPrefix: './', category: 'Category:Bar', origCategory: 'Category:Bar', sortkey: '', origSortkey: '' } } ], undefined, undefined, [ { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() } ], undefined, [ { type: 'alienMeta', originalDomElements: $( '' ).toArray() } ], undefined, [ { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() }, { type: 'comment', attributes: { text: 'barbaz' } }, { type: 'mwCategory', attributes: { hrefPrefix: './', category: 'Category:Foo foo', origCategory: 'Category:Foo_foo', sortkey: 'Bar baz#quux', origSortkey: 'Bar baz%23quux' } }, { type: 'mwAlienMeta', originalDomElements: $( '' ).toArray() } ], undefined, undefined ]; ve.dm.mwExample.references = [ { type: 'paragraph' }, { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/', listIndex: 0, listKey: 'auto/0', mw: { attrs: {}, body: { html: 'No name 1' }, name: 'ref' }, originalMw: '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}', refGroup: '' } }, { type: '/mwReference' }, { type: '/paragraph' }, { type: 'paragraph' }, 'F', 'o', 'o', { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/', listIndex: 1, listKey: 'literal/bar', mw: { attrs: { name: 'bar' }, body: { html: 'Bar' }, name: 'ref' }, originalMw: '{"body":{"html":""},"attrs":{"name":"bar"}}', refGroup: '' } }, { type: '/mwReference' }, ' ', 'B', 'a', 'z', { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/', listIndex: 2, listKey: 'literal/:3', mw: { attrs: { name: ':3' }, body: { html: 'Quux' }, name: 'ref' }, originalMw: '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":":3"}}', refGroup: '' } }, { type: '/mwReference' }, ' ', 'W', 'h', 'e', 'e', { type: 'mwReference', attributes: { contentsUsed: false, listGroup: 'mwReference/', listIndex: 1, listKey: 'literal/bar', mw: { attrs: { name: 'bar' }, name: 'ref' }, originalMw: '{"body":{"html":""},"attrs":{"name":"bar"}}', refGroup: '' } }, { type: '/mwReference' }, ' ', 'Y', 'a', 'y', { type: '/paragraph' }, { type: 'paragraph' }, { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/', listIndex: 3, listKey: 'auto/1', mw: { attrs: {}, body: { html: 'No name 2' }, name: 'ref' }, originalMw: '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}', refGroup: '' } }, { type: '/mwReference' }, { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/foo', listIndex: 4, listKey: 'auto/2', mw: { attrs: { group: 'foo' }, body: { html: 'No name 3' }, name: 'ref' }, originalMw: '{"name":"ref","body":{"html":"No name 3"},"attrs":{"group":"foo"}}', refGroup: 'foo' } }, { type: '/mwReference' }, { type: '/paragraph' }, { type: 'mwReferencesList', // orginalDomElements: HTML, attributes: { mw: { name: 'references', attrs: { group: 'g1' } }, originalMw: '{"name":"references","attrs":{"group":"g1"}"}', listGroup: 'mwReference/', refGroup: '' } }, { type: '/mwReferencesList' }, { type: 'internalList' }, { type: 'internalItem' }, { type: 'paragraph' }, 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '1', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem' }, { type: 'paragraph' }, 'B', 'a', 'r', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem' }, { type: 'paragraph' }, 'Q', 'u', 'u', 'x', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem' }, { type: 'paragraph' }, 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '2', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem' }, { type: 'paragraph' }, 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '3', { type: '/paragraph' }, { type: '/internalItem' }, { type: '/internalList' } ]; ve.dm.mwExample.complexInternalData = [ // 0 { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, { type: 'paragraph' }, 'F', [ 'o', [ ve.dm.example.bold ] ], [ 'o', [ ve.dm.example.italic ] ], // 4 { type: 'mwReference', attributes: { mw: {}, about: '#mwt1', listIndex: 0, listGroup: 'mwReference/', listKey: 'auto/0', refGroup: '', contentsUsed: true } }, // 5 { type: '/mwReference' }, // 6 { type: '/paragraph' }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, // 7 { type: 'internalList' }, // 8 { type: 'internalItem' }, // 9 { type: 'paragraph', internal: { generated: 'wrapper' } }, 'R', [ 'e', [ ve.dm.example.bold ] ], 'f', // 13 { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, 'e', [ 'r', [ ve.dm.example.italic ] ], [ 'e', [ ve.dm.example.italic ] ], // 16 { type: 'mwReference', attributes: { mw: {}, about: '#mwt2', listIndex: 1, listGroup: 'mwReference/', listKey: 'foo', refGroup: '', contentsUsed: true } }, // 17 { type: '/mwReference' }, 'n', 'c', 'e', // 21 { type: '/paragraph' }, // 22 { type: '/internalItem' }, // 23 { type: 'internalItem' }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, // 24 { type: 'preformatted' }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, // 25 { type: 'mwEntity', attributes: { character: '€' } }, // 26 { type: '/mwEntity' }, '2', '5', '0', { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, // 30 { type: '/preformatted' }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, // 31 { type: '/internalItem' }, // 32 { type: '/internalList' } // 33 ]; ve.dm.mwExample.complexInternalData.internalItems = [ { group: 'mwReference', key: null, body: 'First reference' }, { group: 'mwReference', key: 'foo', body: 'Table in ref:
because I can
' } ]; ve.dm.mwExample.complexInternalData.internalListNextUniqueNumber = 1; ve.dm.mwExample.domToDataCases = { 'adjacent annotations': { body: 'abcd ' + 'ab ' + 'abc', data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, [ 'a', [ ve.dm.example.bold ] ], [ 'b', [ { type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ], [ 'c', [ ve.dm.example.bold ] ], [ 'd', [ { type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ], ' ', [ 'a', [ ve.dm.example.bold ] ], [ 'b', [ ve.dm.example.bold ] ], ' ', [ 'a', [ { type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ], [ 'b', [ { type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ], [ 'c', [ { type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: 'abcd ' + 'ab ' + 'abc', fromDataBody: 'abcd ab abc' }, mwImage: { body: '

' + ve.dm.mwExample.MWInlineImage.html + '

', data: [ { type: 'paragraph' }, ve.dm.mwExample.MWInlineImage.data, { type: '/mwInlineImage' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'mwHeading and mwPreformatted nodes': { body: '

Foo

Bar
', data: [ { type: 'mwHeading', attributes: { level: 2 } }, 'F', 'o', 'o', { type: '/mwHeading' }, { type: 'mwPreformatted' }, 'B', 'a', 'r', { type: '/mwPreformatted' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'mwTable with duplicate class attributes': { body: '
Foo
', data: [ { type: 'mwTable', attributes: { wikitable: true, sortable: true, originalClasses: 'wikitable sortable wikitable', unrecognizedClasses: [] } }, { type: 'tableSection', attributes: { style: 'body' } }, { type: 'tableRow' }, { type: 'tableCell', attributes: { style: 'data' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, 'F', 'o', 'o', { type: '/paragraph' }, { type: '/tableCell' }, { type: '/tableRow' }, { type: '/tableSection' }, { type: '/mwTable' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'mw:Transclusion (block level)': { body: ve.dm.mwExample.MWTransclusion.blockOpen + ve.dm.mwExample.MWTransclusion.blockContent, data: [ ve.dm.mwExample.MWTransclusion.blockData, { type: '/mwTransclusionBlock' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ ve.dm.mwExample.MWTransclusion.blockStoreItems ], normalizedBody: ve.dm.mwExample.MWTransclusion.blockOpen + ve.dm.mwExample.MWTransclusion.blockContent, fromDataBody: ve.dm.mwExample.MWTransclusion.blockOpenFromData, clipboardBody: ve.dm.mwExample.MWTransclusion.blockOpenClipboard + ve.dm.mwExample.MWTransclusion.blockContentClipboard }, 'mw:Transclusion (block level - modified)': { body: ve.dm.mwExample.MWTransclusion.blockOpen + ve.dm.mwExample.MWTransclusion.blockContent, data: [ ve.dm.mwExample.MWTransclusion.blockData, { type: '/mwTransclusionBlock' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ ve.dm.mwExample.MWTransclusion.blockStoreItems ], modify: function ( model ) { model.data.data[ 0 ].attributes.mw.parts[ 0 ].template.params[ '1' ].wt = 'Hello, globe!'; }, normalizedBody: ve.dm.mwExample.MWTransclusion.blockOpenModified, fromDataBody: ve.dm.mwExample.MWTransclusion.blockOpenFromDataModified, clipboardBody: ve.dm.mwExample.MWTransclusion.blockOpenModifiedClipboard }, 'mw:Transclusion (inline)': { body: ve.dm.mwExample.MWTransclusion.inlineOpen + ve.dm.mwExample.MWTransclusion.inlineContent + ve.dm.mwExample.MWTransclusion.inlineClose, data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, ve.dm.mwExample.MWTransclusion.inlineData, { type: '/mwTransclusionInline' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ ve.dm.mwExample.MWTransclusion.inlineStoreItems ], normalizedBody: ve.dm.mwExample.MWTransclusion.inlineOpen + ve.dm.mwExample.MWTransclusion.inlineContent + ve.dm.mwExample.MWTransclusion.inlineClose, fromDataBody: ve.dm.mwExample.MWTransclusion.inlineOpenFromData + ve.dm.mwExample.MWTransclusion.inlineClose, clipboardBody: ve.dm.mwExample.MWTransclusion.inlineOpenClipboard + ve.dm.mwExample.MWTransclusion.inlineContent + ve.dm.mwExample.MWTransclusion.inlineClose }, 'mw:Transclusion (inline - modified)': { body: ve.dm.mwExample.MWTransclusion.inlineOpen + ve.dm.mwExample.MWTransclusion.inlineContent + ve.dm.mwExample.MWTransclusion.inlineClose, data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, ve.dm.mwExample.MWTransclusion.inlineData, { type: '/mwTransclusionInline' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ ve.dm.mwExample.MWTransclusion.inlineStoreItems ], modify: function ( model ) { model.data.data[ 1 ].attributes.mw.parts[ 0 ].template.params[ '1' ].wt = '5,678'; }, normalizedBody: ve.dm.mwExample.MWTransclusion.inlineOpenModified + ve.dm.mwExample.MWTransclusion.inlineClose, fromDataBody: ve.dm.mwExample.MWTransclusion.inlineOpenFromDataModified + ve.dm.mwExample.MWTransclusion.inlineClose, clipboardBody: ve.dm.mwExample.MWTransclusion.inlineOpenModifiedClipboard + ve.dm.mwExample.MWTransclusion.inlineClose }, 'two mw:Transclusion nodes with identical params but different htmlAttributes': { body: ve.dm.mwExample.MWTransclusion.pairOne + ve.dm.mwExample.MWTransclusion.pairTwo, fromDataBody: ve.dm.mwExample.MWTransclusion.pairFromData + ve.dm.mwExample.MWTransclusion.pairFromData, clipboardBody: ve.dm.mwExample.MWTransclusion.pairClipboard + ve.dm.mwExample.MWTransclusion.pairClipboard, data: [ { type: 'mwTransclusionBlock', attributes: { mw: { parts: [ { template: { target: { wt: 'echo', href: './Template:Echo' }, params: { 1: { wt: 'foo' } }, i: 0 } } ] }, originalMw: '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}', originalIndex: 0 } }, { type: '/mwTransclusionBlock' }, { type: 'mwTransclusionBlock', attributes: { mw: { parts: [ { template: { target: { wt: 'echo', href: './Template:Echo' }, params: { 1: { wt: 'foo' } }, i: 0 } } ] }, originalMw: '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}', originalIndex: 0 } }, { type: '/mwTransclusionBlock' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ { hash: '[{"mw":{"parts":[{"template":{"i":0,"params":{"1":{"wt":"foo"}},"target":{"href":"./Template:Echo","wt":"echo"}}}]},"type":"mwTransclusionBlock"},null]', value: $( '

foo

' ).toArray() } ] }, 'mw:Transclusion containing only meta data': { body: ve.dm.mwExample.MWTransclusion.meta, fromDataBody: ve.dm.mwExample.MWTransclusion.metaFromData, clipboardBody: ve.dm.mwExample.MWTransclusion.metaClipboard, data: [ { internal: { generated: 'wrapper' }, type: 'paragraph' }, { type: 'mwTransclusionInline', attributes: { mw: { parts: [ { template: { target: { wt: 'Template:Echo', href: './Template:Echo' }, params: { 1: { wt: '[[Category:Page]]\n[[Category:Book]]' } }, i: 0 } } ] }, originalIndex: 0, originalMw: '{\"parts\":[{\"template\":{\"target\":{\"wt\":\"Template:Echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"[[Category:Page]]\\n[[Category:Book]]\"}},\"i\":0}}]}' } }, { type: '/mwTransclusionInline' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'mw:Transclusion which is also a language annotation': { body: 'content', data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, { type: 'mwTransclusionInline', attributes: { mw: {}, originalIndex: 0, originalMw: '{}' }, originalDomElements: $( 'content' ).toArray() }, { type: '/mwTransclusionInline' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], clipboardBody: 'content' }, 'mw:AlienBlockExtension': { body: '
' + '
Rendering
' + '
', normalizedBody: '
' + '
', data: [ { type: 'mwAlienBlockExtension', attributes: { mw: { name: 'syntaxhighlight', attrs: { lang: 'php' }, body: { extsrc: '\n$foo = bar;\n' } }, originalIndex: 0, originalMw: '{"name":"syntaxhighlight","attrs":{"lang":"php"},"body":{"extsrc":"\\n$foo = bar;\\n"}}' }, originalDomElements: $( '
' ).toArray() }, { type: '/mwAlienBlockExtension' }, { type: 'internalList' }, { type: '/internalList' } ], modify: function ( model ) { model.data.data[ 0 ].attributes.mw.attrs.lang = 'php5'; } }, 'mw:AlienInlineExtension': { body: '

' + 'Bar' + '

', normalizedBody: '

' + '' + '

', data: [ { type: 'paragraph' }, { type: 'mwAlienInlineExtension', attributes: { mw: { name: 'score', attrs: {}, body: { extsrc: '\\relative c\' { e d c d e e e }' } }, originalIndex: 0, originalMw: '{"name":"score","attrs":{},"body":{"extsrc":"\\\\relative c\' { e d c d e e e }"}}' }, originalDomElements: $( 'Bar' ).toArray() }, { type: '/mwAlienInlineExtension' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], modify: function ( model ) { model.data.data[ 1 ].attributes.mw.body.extsrc = '\\relative c\' { d d d e e e }'; } }, 'mw:Reference': { // Wikitext: // Foo BazQuux Whee[[Bar]] YayNo name QuuxDifferent content Foo // Ref in refs body: '

Foo' + '' + '[1]' + '' + ' Baz' + '' + '[g1 1]' + '' + ' Whee' + '' + '[1]' + '' + ' Yay' + // This reference has .body.id instead of .body.html '' + '[g1 2]' + '' + ' Quux' + '' + '[1]' + '' + ' Foo' + '' + '[g1 3]' + '' + '

' + // The HTML below is enriched to wrap reference contents in // which Parsoid doesn't do yet, but T88290 asks for '
    ' + '
  1. Quux
  2. ' + '
  3. No name
  4. ' + '
  5. Ref in refs
  6. ' + '
', fromDataBody: '

Foo' + '' + '' + ' Baz' + '' + '' + ' Whee' + '' + '' + ' Yay' + '' + '' + ' Quux' + '' + '' + ' Foo' + '' + '' + '

' + '
' + '
', clipboardBody: '

Foo' + '' + '[1]' + '' + ' Baz' + '' + '[g1 1]' + '' + ' Whee' + '' + '[1]' + '' + ' Yay' + // This reference has .body.id instead of .body.html '' + '[g1 2]' + '' + ' Quux' + '' + '[1]' + '' + ' Foo' + '' + '[g1 3]' + '' + '

' + // The HTML below is enriched to wrap reference contents in // which Parsoid doesn't do yet, but T88290 asks for '
' + '
', head: '', data: [ { type: 'paragraph' }, 'F', 'o', 'o', { type: 'mwReference', attributes: { listIndex: 0, listGroup: 'mwReference/', listKey: 'literal/bar', refGroup: '', mw: { name: 'ref', attrs: { name: 'bar' } }, originalMw: '{"name":"ref","attrs":{"name":"bar"}}', contentsUsed: false } }, { type: '/mwReference' }, ' ', 'B', 'a', 'z', { type: 'mwReference', attributes: { listIndex: 1, listGroup: 'mwReference/g1', listKey: 'literal/:0', refGroup: 'g1', mw: { name: 'ref', body: { html: 'Quux' }, attrs: { group: 'g1', name: ':0' } }, originalMw: '{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}', contentsUsed: true } }, { type: '/mwReference' }, ' ', 'W', 'h', 'e', 'e', { type: 'mwReference', attributes: { listIndex: 0, listGroup: 'mwReference/', listKey: 'literal/bar', refGroup: '', mw: { name: 'ref', body: { html: 'Bar' }, attrs: { name: 'bar' } }, originalMw: '{"name":"ref","body":{"html":"Bar"},"attrs":{"name":"bar"}}', contentsUsed: true } }, { type: '/mwReference' }, ' ', 'Y', 'a', 'y', { type: 'mwReference', attributes: { listIndex: 2, listGroup: 'mwReference/g1', listKey: 'auto/0', refGroup: 'g1', mw: { name: 'ref', body: { id: 'mw-cite-3' }, attrs: { group: 'g1' } }, originalMw: '{"name":"ref","body":{"id":"mw-cite-3"},"attrs":{"group":"g1"}}', contentsUsed: true, refListItemId: 'mw-cite-3' } }, { type: '/mwReference' }, ' ', 'Q', 'u', 'u', 'x', { type: 'mwReference', attributes: { listIndex: 0, listGroup: 'mwReference/', listKey: 'literal/bar', refGroup: '', mw: { name: 'ref', body: { html: 'Different content' }, attrs: { name: 'bar' } }, originalMw: '{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}', contentsUsed: false } }, { type: '/mwReference' }, ' ', 'F', 'o', 'o', { type: 'mwReference', attributes: { listGroup: 'mwReference/g1', listIndex: 3, listKey: 'literal/foo', refGroup: 'g1', mw: { name: 'ref', attrs: { group: 'g1', name: 'foo' } }, originalMw: '{"name":"ref","attrs":{"group":"g1","name":"foo"}}', contentsUsed: false } }, { type: '/mwReference' }, { type: '/paragraph' }, { type: 'mwReferencesList', attributes: { mw: { name: 'references', attrs: { group: 'g1' }, body: { html: '[3]' } }, originalMw: '{"name":"references","body":{"html":"[3]"},"attrs":{"group":"g1"}}', listGroup: 'mwReference/g1', refGroup: 'g1' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/g1', listIndex: 3, listKey: 'literal/foo', mw: { name: 'ref', attrs: { group: 'g1', name: 'foo' }, body: { html: 'Ref in refs' } }, originalMw: '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"group":"g1","name":"foo"}}', refGroup: 'g1' } }, { type: '/mwReference' }, { type: '/paragraph' }, { type: '/mwReferencesList' }, { type: 'internalList' }, { type: 'internalItem', attributes: { originalHtml: 'Bar' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, [ 'B', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], [ 'a', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], [ 'r', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem', attributes: { originalHtml: 'Quux' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, 'Q', 'u', 'u', 'x', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem', attributes: { originalHtml: 'No name' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, 'N', 'o', ' ', 'n', 'a', 'm', 'e', { type: '/paragraph' }, { type: '/internalItem' }, { type: 'internalItem', attributes: { originalHtml: 'Ref in refs' } }, { type: 'paragraph', internal: { generated: 'wrapper' } }, 'R', 'e', 'f', ' ', 'i', 'n', ' ', 'r', 'e', 'f', 's', { type: '/paragraph' }, { type: '/internalItem' }, { type: '/internalList' } ] }, 'mw:Reference with metadata': { body: '

' + '[1]

', fromDataBody: '

', clipboardBody: '

' + '[1]

', head: '', data: [ { type: 'paragraph' }, { type: 'mwReference', attributes: { contentsUsed: true, listGroup: 'mwReference/', listIndex: 0, listKey: 'auto/0', mw: { attrs: {}, body: { html: 'Foo' }, name: 'ref' }, originalMw: '{"name":"ref","body":{"html":"Foo"},"attrs":{}}', refGroup: '' } }, { type: '/mwReference' }, { type: '/paragraph' }, { type: 'internalList' }, { type: 'internalItem', attributes: { originalHtml: 'Foo' } }, { internal: { generated: 'wrapper' }, type: 'paragraph' }, 'F', 'o', 'o', { type: 'comment', attributes: { text: ' bar ' } }, { type: '/comment' }, { type: '/paragraph' }, { type: '/internalItem' }, { type: '/internalList' } ] }, 'internal link with ./ and ../': { body: '

Foo

', head: '', data: [ { type: 'paragraph' }, [ 'F', [ { type: 'link/mwInternal', attributes: { title: 'Foo/Bar', origTitle: 'Foo/Bar', normalizedTitle: 'Foo/Bar', lookupTitle: 'Foo/Bar', hrefPrefix: './../../../' } } ] ], [ 'o', [ { type: 'link/mwInternal', attributes: { title: 'Foo/Bar', origTitle: 'Foo/Bar', normalizedTitle: 'Foo/Bar', lookupTitle: 'Foo/Bar', hrefPrefix: './../../../' } } ] ], [ 'o', [ { type: 'link/mwInternal', attributes: { title: 'Foo/Bar', origTitle: 'Foo/Bar', normalizedTitle: 'Foo/Bar', lookupTitle: 'Foo/Bar', hrefPrefix: './../../../' } } ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'internal link with absolute path': { body: '

' + ve.dm.mwExample.MWInternalLink.absoluteOpen + 'Foo

', data: [ { type: 'paragraph' }, [ 'F', [ ve.dm.mwExample.MWInternalLink.absoluteData ] ], [ 'o', [ ve.dm.mwExample.MWInternalLink.absoluteData ] ], [ 'o', [ ve.dm.mwExample.MWInternalLink.absoluteData ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: '

Foo

', mwConfig: { wgArticlePath: '/wiki/$1' } }, 'internal link with absolute path and section': { body: '

' + ve.dm.mwExample.MWInternalSectionLink.absoluteOpen + 'Foo

', data: [ { type: 'paragraph' }, [ 'F', [ ve.dm.mwExample.MWInternalSectionLink.absoluteData ] ], [ 'o', [ ve.dm.mwExample.MWInternalSectionLink.absoluteData ] ], [ 'o', [ ve.dm.mwExample.MWInternalSectionLink.absoluteData ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: '

Foo

', mwConfig: { wgArticlePath: '/wiki/$1' } }, 'internal link with href set to ./': { body: '

x

', head: '', data: [ { type: 'paragraph' }, [ 'x', [ { type: 'link/mwInternal', attributes: { title: '', origTitle: '', normalizedTitle: '', lookupTitle: '', hrefPrefix: './' } } ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'numbered external link (empty mw:Extlink)': { body: '

FooBar

', data: [ { type: 'paragraph' }, 'F', 'o', 'o', { type: 'link/mwNumberedExternal', attributes: { href: 'http://www.example.com' } }, { type: '/link/mwNumberedExternal' }, 'B', 'a', 'r', { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'URL link': { body: '

mw

', data: [ { type: 'paragraph' }, [ 'm', [ { type: 'link/mwExternal', attributes: { href: 'http://www.mediawiki.org/', rel: 'mw:ExtLink' } } ] ], [ 'w', [ { type: 'link/mwExternal', attributes: { href: 'http://www.mediawiki.org/', rel: 'mw:ExtLink' } } ] ], { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'whitespace preservation with wrapped comments and language links': { body: 'Foo\n' + '\n' + '', data: [ { type: 'paragraph', internal: { generated: 'wrapper', whitespace: [ undefined, undefined, undefined, '\n' ] } }, 'F', 'o', 'o', { type: '/paragraph' }, { type: 'mwLanguage', attributes: { href: 'http://de.wikipedia.org/wiki/Foo' }, internal: { whitespace: [ '\n', undefined, undefined, '\n' ] } }, { type: '/mwLanguage' }, { type: 'mwLanguage', attributes: { href: 'http://fr.wikipedia.org/wiki/Foo' }, internal: { whitespace: [ '\n' ] } }, { type: '/mwLanguage' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'document with meta elements': { body: '

Foo' + 'Bar' + 'Baz

' + '' + '' + '', clipboardBody: ' 

Foo' + 'Bar' + 'Ba z

' + ' ' + '' + '', head: '', data: ve.dm.mwExample.withMeta }, 'RDFa types spread across two attributes, about grouping is forced': { body: ve.dm.mwExample.MWTransclusion.mixed, fromDataBody: ve.dm.mwExample.MWTransclusion.mixedFromData, clipboardBody: ve.dm.mwExample.MWTransclusion.mixedClipboard, data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, ve.dm.mwExample.MWTransclusion.mixedDataOpen, ve.dm.mwExample.MWTransclusion.mixedDataClose, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ], storeItems: [ ve.dm.mwExample.MWTransclusion.mixedStoreItems ] }, 'mw:Entity': { body: '

a¢b¥

', data: [ { type: 'paragraph' }, 'a', { type: 'mwEntity', attributes: { character: '¢' } }, { type: '/mwEntity' }, 'b', { type: 'mwEntity', attributes: { character: '¥' } }, { type: '/mwEntity' }, { type: 'mwEntity', attributes: { character: '™' } }, { type: '/mwEntity' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'wrapping with mw:Entity': { body: 'a¢b¥', data: [ { type: 'paragraph', internal: { generated: 'wrapper' } }, 'a', { type: 'mwEntity', attributes: { character: '¢' } }, { type: '/mwEntity' }, 'b', { type: 'mwEntity', attributes: { character: '¥' } }, { type: '/mwEntity' }, { type: 'mwEntity', attributes: { character: '™' } }, { type: '/mwEntity' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'whitespace preservation with mw:Entity': { body: '

a b ¥\t

', data: [ { type: 'paragraph', internal: { whitespace: [ undefined, ' ' ] } }, 'a', ' ', ' ', { type: 'mwEntity', attributes: { character: ' ' } }, { type: '/mwEntity' }, ' ', ' ', ' ', 'b', ' ', ' ', ' ', ' ', { type: 'mwEntity', attributes: { character: '¥' } }, { type: '/mwEntity' }, '\t', { type: 'mwEntity', attributes: { character: '™' } }, { type: '/mwEntity' }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'category default sort key': { body: '', data: [ { type: 'mwDefaultSort', attributes: { content: 'foo' } }, { type: '/mwDefaultSort' }, { type: 'paragraph', internal: { generated: 'empty' } }, { type: '/paragraph' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'thumb image': { body: ve.dm.mwExample.MWBlockImage.html, data: ve.dm.mwExample.MWBlockImage.data.concat( [ { type: 'internalList' }, { type: '/internalList' } ] ) }, 'attribute preservation does not crash due to text node split': { body: '
' + '' + '' + '' + '
' + ' foo bar baz' + '
' + '
', fromDataBody: '
' + '' + '' + '' + '
' + ' foo bar baz' + '
' + '
', head: '', data: [ { type: 'mwBlockImage', attributes: { type: 'thumb', align: 'default', href: 'Foo', src: 'Bar', width: 1, height: 2, resource: 'FooBar' } }, { type: 'mwImageCaption', internal: { whitespace: [ undefined, ' ' ] } }, { type: 'paragraph', internal: { generated: 'wrapper', whitespace: [ ' ' ] } }, 'f', 'o', 'o', ' ', [ 'b', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], [ 'a', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], [ 'r', [ { type: 'link/mwInternal', attributes: { title: 'Bar', origTitle: 'Bar', normalizedTitle: 'Bar', lookupTitle: 'Bar', hrefPrefix: './' } } ] ], ' ', 'b', 'a', 'z', { type: '/paragraph' }, { type: '/mwImageCaption' }, { type: '/mwBlockImage' }, { type: 'internalList' }, { type: '/internalList' } ] }, 'mw:Nowiki': { body: ve.dm.mwExample.mwNowikiHtml, data: ve.dm.mwExample.mwNowiki, fromDataBody: ve.dm.mwExample.mwNowikiHtmlFromData }, 'mw:Nowiki unwraps when text modified': { data: ve.dm.mwExample.mwNowiki, modify: function ( model ) { model.data.data[ 7 ][ 0 ] = 'z'; }, normalizedBody: '

Foo[[Bzr]]Baz

' }, 'mw:Nowiki unwraps when annotations modified': { data: ve.dm.mwExample.mwNowiki, modify: function ( model ) { model.data.data[ 7 ][ 1 ].push( model.getStore().index( ve.dm.example.createAnnotation( ve.dm.example.bold ) ) ); }, normalizedBody: '

Foo[[Bar]]Baz

' }, 'mwHeading with no content': { data: [ { type: 'mwHeading', attributes: { level: 1 } }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: '

' }, 'mwHeading with whitespace content': { data: [ { type: 'mwHeading', attributes: { level: 2 } }, ' ', ' ', '\t', ' ', { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: '

\t

' }, 'mwHeading containing metadata': { data: [ { type: 'mwHeading', attributes: { level: 3 } }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], normalizedBody: '

' }, 'mwHeading containing alienated text': { data: [ { type: 'mwHeading', attributes: { level: 4 } }, { type: 'alienInline', originalDomElements: $( 'Alien' ).toArray() }, { type: '/alienInline' }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], body: '

Alien

' }, 'existing empty mwHeading is not converted to paragraph': { data: [ { type: 'mwHeading', attributes: { level: 5, noconvert: true } }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], body: '
' }, 'adding whitespace to existing empty mwHeading does not convert to paragraph': { data: [ { type: 'mwHeading', attributes: { level: 6, noconvert: true } }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], modify: function ( doc ) { doc.data.data.splice( 1, 0, ' ' ); }, body: '
', normalizedBody: '
' }, 'emptying existing meta-only mwHeading does not convert to paragraph': { data: [ { type: 'mwHeading', attributes: { level: 1, noconvert: true } }, { type: 'alienMeta', originalDomElements: $( '' ).toArray() }, { type: '/alienMeta' }, { type: '/mwHeading' }, { type: 'internalList' }, { type: '/internalList' } ], modify: function ( doc ) { doc.metadata.data[ 1 ].splice( 0, 1 ); }, normalizedBody: '

' } };