2013-06-26 21:18:39 +00:00
/ * !
* VisualEditor DataModel MediaWiki example data sets .
*
* @ copyright 2011 - 2013 VisualEditor Team and others ; see AUTHORS . txt
* @ license The MIT License ( MIT ) ; see LICENSE . txt
* /
/ * *
* @ class
* @ singleton
* @ ignore
* /
ve . dm . mwExample = { } ;
2013-07-03 01:30:10 +00:00
ve . dm . mwExample . createExampleDocument = function ( name , store ) {
return ve . dm . example . createExampleDocumentFromObject ( name , store , ve . dm . mwExample ) ;
} ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion = {
2013-07-11 02:05:28 +00:00
'blockOpen' : '<div about="#mwt1" typeof="mw:Transclusion" data-mw="{"target":{"wt":"Test"},"params":{"1":{"wt":"Hello, world!"}},"id":"mwt1"}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></div>' ,
'blockOpenModified' : '<div about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Test"},"params":{"1":{"wt":"Hello, globe!"}}}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></div>' ,
2013-06-26 21:18:39 +00:00
'blockContent' : '<p about="#mwt1" data-parsoid="{}">Hello, world!</p>' ,
'inlineOpen' : '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"1,234"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">' ,
'inlineOpenModified' : '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">' ,
'inlineContent' : '$1,234.00' ,
'inlineClose' : '</span>' ,
'mixed' : '<link about="#mwt1" rel="mw:WikiLink/Category" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}"><span about="#mwt1">Foo</span>' ,
'pairOne' : '<p about="#mwt1" typeof="mw:Transclusion" data-mw="{"params":{"1":{"wt":"foo"}}}" data-parsoid="1">foo</p>' ,
2013-07-23 13:35:26 +00:00
'pairTwo' : '<p about="#mwt2" typeof="mw:Transclusion" data-mw="{"params":{"1":{"wt":"foo"}}}" data-parsoid="2">foo</p>' ,
'meta' :
'<link rel="mw:WikiLink/Category" href="./Category:Page" about="#mwt1" typeof="mw:Transclusion" ' +
'data-mw="{"target":{"wt":"Template:Echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Page]]\\n[[Category:Book]]"}},"i":0}">' +
'<span about="#mwt1" data-parsoid="{}">\n</span>' +
'<link rel="mw:WikiLink/Category" href="./Category:Book" about="#mwt1">'
2013-06-26 21:18:39 +00:00
} ;
ve . dm . mwExample . MWTransclusion . blockData = {
'type' : 'mwTransclusionBlock' ,
'attributes' : {
'mw' : {
'id' : 'mwt1' ,
'target' : { 'wt' : 'Test' } ,
'params' : {
'1' : { 'wt' : 'Hello, world!' }
}
} ,
2013-07-11 02:05:28 +00:00
'originalDomElements' : $ ( ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ) . toArray ( ) ,
2013-06-26 21:18:39 +00:00
'originalMw' : '{\"target\":{\"wt\":\"Test\"},\"params\":{\"1\":{\"wt\":\"Hello, world!\"}},\"id\":\"mwt1\"}' ,
'originalIndex' : 0
} ,
'htmlAttributes' : [
{ 'values' : {
'about' : '#mwt1' ,
'data-mw' : '{\"target\":{\"wt\":\"Test\"},\"params\":{\"1\":{\"wt\":\"Hello, world!\"}},\"id\":\"mwt1\"}' ,
'data-parsoid' : '{\"tsr\":[18,40],\"src\":\"{{Test|Hello, world!}}\",\"dsr\":[18,40,null,null]}' ,
'typeof' : 'mw:Transclusion'
} } ,
{ 'values' : {
'about' : '#mwt1' ,
'data-parsoid' : '{}'
} }
]
} ;
ve . dm . mwExample . MWTransclusion . inlineData = {
'type' : 'mwTransclusionInline' ,
'attributes' : {
'mw' : {
'id' : 'mwt1' ,
'target' : { 'wt' : 'Inline' } ,
'params' : {
'1' : { 'wt' : '1,234' }
}
} ,
'originalDomElements' : $ ( ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ) . toArray ( ) ,
'originalMw' : '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"1,234\"}}}' ,
'originalIndex' : 0
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt1' ,
'data-mw' : '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"1,234\"}}}' ,
'data-parsoid' : '{\"tsr\":[18,34],\"src\":\"{{Inline|1,234}}\",\"dsr\":[18,34,null,null]}' ,
'typeof' : 'mw:Transclusion'
} } ]
} ;
ve . dm . mwExample . MWTransclusion . mixedDataOpen = {
'type' : 'mwTransclusionInline' ,
'attributes' : {
'mw' : {
'id' : 'mwt1' ,
'target' : { 'wt' : 'Inline' } ,
'params' : {
'1' : { 'wt' : '5,678' }
}
} ,
'originalDomElements' : $ ( ve . dm . mwExample . MWTransclusion . mixed ) . toArray ( ) ,
'originalMw' : '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"5,678\"}}}' ,
'originalIndex' : 0
} ,
'htmlAttributes' : [
{ 'values' : {
'about' : '#mwt1' ,
'rel' : 'mw:WikiLink/Category' ,
'typeof' : 'mw:Transclusion' ,
'data-mw' : '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"5,678\"}}}'
} } ,
{ 'values' : { 'about' : '#mwt1' } }
]
} ;
ve . dm . mwExample . MWTransclusion . mixedDataClose = { 'type' : '/mwTransclusionInline' } ;
2013-10-15 19:59:14 +00:00
ve . dm . mwExample . MWTransclusion . blockParamsHash = OO . getHash ( [ ve . dm . MWTransclusionNode . static . getHashObject ( ve . dm . mwExample . MWTransclusion . blockData ) , undefined ] ) ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . blockStoreItems = {
'hash' : ve . dm . mwExample . MWTransclusion . blockParamsHash ,
2013-07-11 02:05:28 +00:00
'value' : $ ( ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ) . toArray ( )
2013-06-26 21:18:39 +00:00
} ;
2013-10-15 19:59:14 +00:00
ve . dm . mwExample . MWTransclusion . inlineParamsHash = OO . getHash ( [ ve . dm . MWTransclusionNode . static . getHashObject ( ve . dm . mwExample . MWTransclusion . inlineData ) , undefined ] ) ;
2013-06-26 21:18:39 +00:00
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 ( )
} ;
2013-10-15 19:59:14 +00:00
ve . dm . mwExample . MWTransclusion . mixedParamsHash = OO . getHash ( [ ve . dm . MWTransclusionNode . static . getHashObject ( ve . dm . mwExample . MWTransclusion . mixedDataOpen ) , undefined ] ) ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . mixedStoreItems = {
'hash' : ve . dm . mwExample . MWTransclusion . mixedParamsHash ,
'value' : $ ( ve . dm . mwExample . MWTransclusion . mixed ) . toArray ( )
} ;
2013-10-05 10:27:39 +00:00
ve . dm . mwExample . MWBlockImage = {
'html' :
'<figure typeof="mw:Image/Thumb" class="mw-halign-right foobar">' +
'<a href="Foo"><img src="Bar" width="1" height="2" resource="FooBar"></a>' +
'<figcaption>abc</figcaption>' +
'</figure>' ,
'data' : [
{
'type' : 'mwBlockImage' ,
'attributes' : {
'type' : 'thumb' ,
'align' : 'right' ,
'href' : 'Foo' ,
'src' : 'Bar' ,
2013-10-15 16:50:01 +00:00
'width' : 1 ,
'height' : 2 ,
2013-10-05 10:27:39 +00:00
'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' }
2013-10-15 12:18:11 +00:00
] ,
'storeItems' : [
{
'hash' : '[{"height":2,"resource":"FooBar","type":"mwBlockImage","width":1},null]' ,
'value' : 'Bar'
}
2013-10-05 10:27:39 +00:00
]
} ;
2013-10-15 16:50:01 +00:00
ve . dm . mwExample . MWInlineImage = {
'html' :
'<span typeof="mw:Image" class="foo mw-valign-text-top">' +
'<a href="./File:Wiki.png">' +
'<img resource="./File:Wiki.png" src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" height="155" width="135">' +
'</a>' +
'</span>' ,
'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' : 'inline' ,
'originalClasses' : 'foo mw-valign-text-top' ,
'unrecognizedClasses' : [ 'foo' ]
} ,
2013-10-15 12:18:11 +00:00
} ,
'storeItems' : [
{
'hash' : '[{"height":155,"resource":"./File:Wiki.png","type":"mwInlineImage","width":135},null]' ,
'value' : 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
}
]
2013-10-15 16:50:01 +00:00
} ;
2013-10-05 10:27:39 +00:00
2013-07-25 17:11:50 +00:00
ve . dm . mwExample . MWReference = {
'referenceList' :
'<ol class="references" typeof="mw:Extension/references" about="#mwt7" data-parsoid="{}"' +
'data-mw="{"name":"references","body":{' +
'"extsrc":"<ref name=\\"foo\\">Ref in refs</ref>' +
'","html":"<span about=\\"#mwt8\\" class=\\"reference\\" ' +
'data-mw=\\"{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;Ref in refs&quot;},' +
'&quot;attrs&quot;:{&quot;name&quot;:&quot;foo&quot;}}\\" ' +
'rel=\\"dc:references\\" typeof=\\"mw:Extension/ref\\">' +
'<a href=\\"#cite_note-foo-3\\">[3]</a></span>"},"attrs":{}}"></ol>'
} ;
2013-07-17 01:22:22 +00:00
ve . dm . mwExample . mwNowikiAnnotation = {
'type' : 'mwNowiki' ,
'attributes' : {
'originalDomElements' : $ ( '<span typeof="mw:Nowiki">[[Bar]]</span>' ) . toArray ( )
} ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Nowiki' } } ]
} ;
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 = '<body><p>Foo<span typeof="mw:Nowiki">[[Bar]]</span>Baz</p></body>' ;
2013-07-03 01:30:10 +00:00
ve . dm . mwExample . withMeta = [
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!-- No content conversion -->' ) . toArray ( )
}
} ,
{ 'type' : '/alienMeta' } ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:PageProp/nocc" />' ) . toArray ( )
}
} ,
{ 'type' : '/mwAlienMeta' } ,
{ 'type' : 'paragraph' } ,
'F' ,
'o' ,
'o' ,
{
'type' : 'mwCategory' ,
'attributes' : {
'hrefPrefix' : './' ,
'category' : 'Category:Bar' ,
'origCategory' : 'Category:Bar' ,
'sortkey' : '' ,
2013-10-17 13:48:37 +00:00
'origSortkey' : '' ,
'origRel' : 'mw:PageProp/Category'
2013-07-03 01:30:10 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'rel' : 'mw:PageProp/Category' ,
'href' : './Category:Bar'
} ,
'computed' : {
'href' : 'http://example.com/Category:Bar'
}
}
]
2013-07-03 01:30:10 +00:00
} ,
{ 'type' : '/mwCategory' } ,
'B' ,
'a' ,
'r' ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:foo" content="bar" />' ) . toArray ( )
}
} ,
{ 'type' : '/mwAlienMeta' } ,
'B' ,
'a' ,
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!-- inline -->' ) . toArray ( )
}
} ,
{ 'type' : '/alienMeta' } ,
'z' ,
{ 'type' : '/paragraph' } ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:bar" content="baz" />' ) . toArray ( )
}
} ,
{ 'type' : '/mwAlienMeta' } ,
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!--barbaz-->' ) . toArray ( )
}
} ,
{ 'type' : '/alienMeta' } ,
{
'type' : 'mwCategory' ,
'attributes' : {
'hrefPrefix' : './' ,
'category' : 'Category:Foo foo' ,
'origCategory' : 'Category:Foo_foo' ,
'sortkey' : 'Bar baz#quux' ,
2013-10-17 13:48:37 +00:00
'origSortkey' : 'Bar baz%23quux' ,
'origRel' : 'mw:PageProp/Category'
2013-07-03 01:30:10 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'rel' : 'mw:PageProp/Category' ,
'href' : './Category:Foo_foo#Bar baz%23quux'
} ,
'computed' : {
'href' : 'http://example.com/Category:Foo_foo#Bar baz%23quux'
}
}
]
2013-07-03 01:30:10 +00:00
} ,
{ 'type' : '/mwCategory' } ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ) . 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' ,
'attributes' : {
'domElements' : $ ( '<!-- No content conversion -->' ) . toArray ( )
}
} ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:PageProp/nocc" />' ) . toArray ( )
}
}
] ,
undefined ,
undefined ,
undefined ,
[
{
'type' : 'mwCategory' ,
'attributes' : {
'hrefPrefix' : './' ,
'category' : 'Category:Bar' ,
'origCategory' : 'Category:Bar' ,
'sortkey' : '' ,
'origSortkey' : ''
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'rel' : 'mw:WikiLink/Category' ,
'href' : './Category:Bar'
} ,
'computed' : {
'href' : 'http://example.com/Category:Bar'
}
}
]
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
undefined ,
[
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:foo" content="bar" />' ) . toArray ( )
}
}
] ,
undefined ,
[
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!-- inline -->' ) . toArray ( )
}
}
] ,
undefined ,
[
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta property="mw:bar" content="baz" />' ) . toArray ( )
}
} ,
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!--barbaz-->' ) . toArray ( )
}
} ,
{
'type' : 'mwCategory' ,
'attributes' : {
'hrefPrefix' : './' ,
'category' : 'Category:Foo foo' ,
'origCategory' : 'Category:Foo_foo' ,
'sortkey' : 'Bar baz#quux' ,
'origSortkey' : 'Bar baz%23quux'
} ,
'htmlAttributes' : [ { 'values' : {
'rel' : 'mw:WikiLink/Category' ,
'href' : './Category:Foo_foo#Bar baz%23quux'
} } ]
} ,
{
'type' : 'mwAlienMeta' ,
'attributes' : {
'domElements' : $ ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ) . toArray ( )
}
}
] ,
undefined ,
undefined
] ;
ve . dm . mwExample . references = [
{ 'type' : 'paragraph' } ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 0 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'auto/0' ,
2013-07-03 01:30:10 +00:00
'mw' : {
'attrs' : { } ,
'body' : { 'html' : 'No name 1' } ,
'name' : 'ref'
} ,
'originalMw' : '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}' ,
'refGroup' : ''
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt2' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 1</ref>","dsr":[0,20,5,6]}' ,
'id' : 'cite_ref-1-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'paragraph' , 'htmlAttributes' : [ { 'values' : { 'data-parsoid' : '{"dsr":[22,108,0,0]}' } } ] } ,
'F' , 'o' , 'o' ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 1 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/bar' ,
2013-07-03 01:30:10 +00:00
'mw' : {
'attrs' : { 'name' : 'bar' } ,
'body' : { 'html' : 'Bar' } ,
'name' : 'ref'
} ,
'originalMw' : '{"body":{"html":""},"attrs":{"name":"bar"}}' ,
'refGroup' : ''
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt6' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"Bar"},"attrs":{"name":"bar"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"bar\\">Bar</ref>","dsr":[25,50,16,6]}' ,
'id' : 'cite_ref-bar-2-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'B' , 'a' , 'z' ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 2 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/:3' ,
2013-07-03 01:30:10 +00:00
'mw' : {
2013-09-19 22:57:08 +00:00
'attrs' : { 'name' : ':3' } ,
2013-07-03 01:30:10 +00:00
'body' : { 'html' : 'Quux' } ,
'name' : 'ref'
} ,
2013-09-19 22:57:08 +00:00
'originalMw' : '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":":3"}}' ,
2013-07-03 01:30:10 +00:00
'refGroup' : ''
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt7' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":"quux"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"quux\\">Quux</ref>","dsr":[54,81,17,6]}' ,
'id' : 'cite_ref-quux-3-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'W' , 'h' , 'e' , 'e' ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : false ,
'listGroup' : 'mwReference/' ,
'listIndex' : 1 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/bar' ,
2013-07-03 01:30:10 +00:00
'mw' : {
'attrs' : { 'name' : 'bar' } ,
'name' : 'ref'
} ,
'originalMw' : '{"body":{"html":""},"attrs":{"name":"bar"}}' ,
'refGroup' : ''
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt8' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","attrs":{"name":"bar"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"bar\\" />","dsr":[86,104,18,0]}' ,
'id' : 'cite_ref-bar-2-1' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'Y' , 'a' , 'y' ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'paragraph' } ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 3 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'auto/1' ,
2013-07-03 01:30:10 +00:00
'mw' : {
'attrs' : { } ,
'body' : { 'html' : 'No name 2' } ,
'name' : 'ref'
} ,
'originalMw' : '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}' ,
'refGroup' : ''
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt11' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 2</ref>","dsr":[110,130,5,6]}' ,
'id' : 'cite_ref-4-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
2013-09-19 22:57:08 +00:00
'listGroup' : 'mwReference/foo' ,
2013-07-03 01:30:10 +00:00
'listIndex' : 4 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'auto/2' ,
2013-07-03 01:30:10 +00:00
'mw' : {
2013-09-19 22:57:08 +00:00
'attrs' : { 'group' : 'foo' } ,
2013-07-03 01:30:10 +00:00
'body' : { 'html' : 'No name 3' } ,
'name' : 'ref'
} ,
2013-09-19 22:57:08 +00:00
'originalMw' : '{"name":"ref","body":{"html":"No name 3"},"attrs":{"group":"foo"}}' ,
'refGroup' : 'foo'
2013-07-03 01:30:10 +00:00
} ,
'htmlAttributes' : [ { 'values' : {
'about' : '#mwt12' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"No name 3"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 3</ref>"' ,
'id' : 'cite_ref-5-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} } ]
} ,
{ 'type' : '/mwReference' } ,
{ 'type' : '/paragraph' } ,
{
'type' : 'mwReferenceList' ,
'attributes' : {
'mw' : {
'name' : 'references' ,
'attrs' : { }
} ,
'originalMw' : '{"name":"references","attrs":{}"}' ,
//'domElements': HTML,
'listGroup' : 'mwReference/' ,
'refGroup' : ''
}
} ,
{ 'type' : '/mwReferenceList' } ,
{ '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' }
] ;
2013-06-26 21:18:39 +00:00
Introduce newFromDocumentReplace() transaction builder
Replaces newFromNodeReplacement(). newFromNodeReplacement was very
simplistic and didn't support metadata or internal list items, so
if you had comments or references inside of the data you were editing
(reference contents or an image caption), they'd get mangled.
With this, you can do:
newDoc = doc.getDocumentSlice( node );
// Edit newDoc
tx = ve.dm.Transaction.newFromDocumentReplace( doc, node, newDoc );
surface.change( newDoc );
and that takes care of metadata, internal list items, and things like
references that reference internal list items.
ve.dm.Document.js:
* In getDocumentSlice(), store a reference to the original document
and the number of items in its InternalList at the time of slicing
in the created slice. This is used for reconciliation when the
modified slice is injected back into the parent document with
newFromDocumentReplace().
ve.dm.InternalList.js:
* Add a method for merging in another InternalList. This provides a
mapping from old to new InternalList indexes so the linear model data
being injected by newFromDocumentReplace() can have its InternalList
indexes remapped.
ve.dm.Transaction.js:
* Replace newFromNodeReplacement() with newFromDocumentReplace()
ve.ui.MWMediaEditDialog.js, ve.ui.MWReferenceDialog.js:
* Use getDocumentSlice/newFromDocumentReplace for editing captions/refs
* Change insertion code path to insert an empty internalItem/caption, then
newFromDocumentReplace into that
* Add empty internalList to new mini-documents
ve/test/dm/ve.dm.Transaction.test.js:
* Replace newFromNodeReplacement tests with newFromDocumentReplace tests
ve-mw/test/dm/ve.dm.Transaction.test.js (new):
* Add tests for newFromDocumentReplace with mwReference nodes
ve.dm.mwExample.js:
* Add data for newFromDocumentReplace with mwReference tests
VisualEditor.hooks.php:
* Add new test file
Bug: 52102
Change-Id: I4aa980780114b391924f04df588e81c990c32983
2013-09-05 01:05:07 +00:00
ve . dm . mwExample . complexInternalData = [
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- before -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : 'paragraph' } ,
'F' , [ 'o' , [ ve . dm . example . bold ] ] , [ 'o' , [ ve . dm . example . italic ] ] ,
{ 'type' : 'mwReference' , 'attributes' : {
'mw' : { } ,
'about' : '#mwt1' ,
'listIndex' : 0 ,
'listGroup' : 'mwReference/' ,
'listKey' : null ,
'refGroup' : '' ,
'contentsUsed' : true
} } ,
{ 'type' : '/mwReference' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- after -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : 'internalList' } ,
{ 'type' : 'internalItem' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
'R' , [ 'e' , [ ve . dm . example . bold ] ] , 'f' ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- reference -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
'e' , [ 'r' , [ ve . dm . example . italic ] ] , [ 'e' , [ ve . dm . example . italic ] ] ,
{ 'type' : 'mwReference' , 'attributes' : {
'mw' : { } ,
'about' : '#mwt2' ,
'listIndex' : 1 ,
'listGroup' : 'mwReference/' ,
'listKey' : 'foo' ,
'refGroup' : '' ,
'contentsUsed' : true
} } ,
{ 'type' : '/mwReference' } ,
'n' , 'c' , 'e' ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/internalItem' } ,
{ 'type' : 'internalItem' } ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- beginning -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : 'preformatted' } ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- inside -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : 'mwEntity' , 'attributes' : { 'character' : '€' } } ,
{ 'type' : '/mwEntity' } ,
'2' , '5' , '0' ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- inside2 -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : '/preformatted' } ,
{ 'type' : 'alienMeta' , 'attributes' : { 'domElements' : $ ( '<!-- end -->' ) . get ( ) } } ,
{ 'type' : '/alienMeta' } ,
{ 'type' : '/internalItem' } ,
{ 'type' : '/internalList' }
] ;
ve . dm . mwExample . complexInternalData . internalItems = [
{ 'group' : 'mwReference' , 'key' : null , 'body' : 'First reference' } ,
{ 'group' : 'mwReference' , 'key' : 'foo' , 'body' : 'Table in ref: <table><tr><td>because I can</td></tr></table>' }
] ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . domToDataCases = {
2013-07-12 21:21:20 +00:00
'adjacent annotations' : {
2013-10-18 21:27:25 +00:00
'body' :
'<b>a</b><b data-parsoid="1">b</b><b>c</b><b data-parsoid="2">d</b> ' +
'<b>a</b><b>b</b> ' +
'<b data-parsoid="3">ab</b><b data-parsoid="4">c</b>' ,
2013-07-12 21:21:20 +00:00
'data' : [
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
[ 'a' , [ ve . dm . example . bold ] ] ,
[
'b' ,
[ {
'type' : 'textStyle/bold' ,
2013-08-08 06:05:20 +00:00
'attributes' : { 'nodeName' : 'b' } ,
2013-07-12 21:21:20 +00:00
'htmlAttributes' : [ { 'values' : {
'data-parsoid' : '1'
} } ]
} ]
] ,
[ 'c' , [ ve . dm . example . bold ] ] ,
[
'd' ,
[ {
'type' : 'textStyle/bold' ,
2013-08-08 06:05:20 +00:00
'attributes' : { 'nodeName' : 'b' } ,
2013-07-12 21:21:20 +00:00
'htmlAttributes' : [ { 'values' : {
'data-parsoid' : '2'
} } ]
} ]
] ,
' ' ,
[ 'a' , [ ve . dm . example . bold ] ] ,
[ 'b' , [ ve . dm . example . bold ] ] ,
' ' ,
[
'a' ,
[ {
'type' : 'textStyle/bold' ,
2013-08-08 06:05:20 +00:00
'attributes' : { 'nodeName' : 'b' } ,
2013-07-12 21:21:20 +00:00
'htmlAttributes' : [ { 'values' : {
'data-parsoid' : '3'
} } ]
} ]
] ,
[
'b' ,
[ {
'type' : 'textStyle/bold' ,
2013-08-08 06:05:20 +00:00
'attributes' : { 'nodeName' : 'b' } ,
2013-07-12 21:21:20 +00:00
'htmlAttributes' : [ { 'values' : {
'data-parsoid' : '3'
} } ]
} ]
] ,
[
'c' ,
[ {
'type' : 'textStyle/bold' ,
2013-08-08 06:05:20 +00:00
'attributes' : { 'nodeName' : 'b' } ,
2013-07-12 21:21:20 +00:00
'htmlAttributes' : [ { 'values' : {
'data-parsoid' : '4'
} } ]
} ]
] ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
] ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : '<b>abcd</b> <b>ab</b> <b data-parsoid="3">ab</b><b data-parsoid="4">c</b>' ,
2013-07-12 21:21:20 +00:00
} ,
2013-06-26 21:18:39 +00:00
'mw:Image' : {
2013-10-18 21:27:25 +00:00
'body' : '<p>' + ve . dm . mwExample . MWInlineImage . html + '</p>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
2013-10-15 16:50:01 +00:00
ve . dm . mwExample . MWInlineImage . data ,
2013-06-26 21:18:39 +00:00
{ 'type' : '/mwInlineImage' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'mw:Transclusion (block level)' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ,
2013-06-26 21:18:39 +00:00
'data' : [
ve . dm . mwExample . MWTransclusion . blockData ,
{ 'type' : '/mwTransclusionBlock' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
] ,
'storeItems' : [
ve . dm . mwExample . MWTransclusion . blockStoreItems
] ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent
2013-06-26 21:18:39 +00:00
} ,
'mw:Transclusion (block level - modified)' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ,
2013-06-26 21:18:39 +00:00
'data' : [
ve . dm . mwExample . MWTransclusion . blockData ,
{ 'type' : '/mwTransclusionBlock' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
] ,
'storeItems' : [
ve . dm . mwExample . MWTransclusion . blockStoreItems
] ,
'modify' : function ( data ) {
data [ 0 ] . attributes . mw . params [ '1' ] . wt = 'Hello, globe!' ;
} ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : ve . dm . mwExample . MWTransclusion . blockOpenModified
2013-06-26 21:18:39 +00:00
} ,
'mw:Transclusion (inline)' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
2013-06-26 21:18:39 +00:00
'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
] ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose
2013-06-26 21:18:39 +00:00
} ,
'mw:Transclusion (inline - modified)' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
2013-06-26 21:18:39 +00:00
'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 ( data ) {
data [ 1 ] . attributes . mw . params [ '1' ] . wt = '5,678' ;
} ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : ve . dm . mwExample . MWTransclusion . inlineOpenModified + ve . dm . mwExample . MWTransclusion . inlineClose
2013-06-26 21:18:39 +00:00
} ,
'two mw:Transclusion nodes with identical params but different htmlAttributes' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . pairOne + ve . dm . mwExample . MWTransclusion . pairTwo ,
2013-06-26 21:18:39 +00:00
'data' : [
{
'type' : 'mwTransclusionBlock' ,
'attributes' : {
'mw' : {
'params' : { '1' : { 'wt' : 'foo' } }
} ,
'originalMw' : '{"params":{"1":{"wt":"foo"}}}' ,
'originalDomElements' : $ ( ve . dm . mwExample . MWTransclusion . pairOne ) . toArray ( ) ,
'originalIndex' : 0
} ,
'htmlAttributes' : [
{
'values' : {
'about' : '#mwt1' ,
'data-mw' : '{"params":{"1":{"wt":"foo"}}}' ,
'data-parsoid' : '1' ,
'typeof' : 'mw:Transclusion'
}
}
]
} ,
{ 'type' : '/mwTransclusionBlock' } ,
{
'type' : 'mwTransclusionBlock' ,
'attributes' : {
'mw' : {
'params' : { '1' : { 'wt' : 'foo' } }
} ,
'originalMw' : '{"params":{"1":{"wt":"foo"}}}' ,
'originalDomElements' : $ ( ve . dm . mwExample . MWTransclusion . pairTwo ) . toArray ( ) ,
'originalIndex' : 0
} ,
'htmlAttributes' : [
{
'values' : {
'about' : '#mwt2' ,
'data-mw' : '{"params":{"1":{"wt":"foo"}}}' ,
'data-parsoid' : '2' ,
'typeof' : 'mw:Transclusion'
}
}
]
} ,
{ 'type' : '/mwTransclusionBlock' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
] ,
'storeItems' : [
{
2013-08-03 23:05:51 +00:00
'hash' : '[{"mw":{"params":{"1":{"wt":"foo"}}},"type":"mwTransclusionBlock"},null]' ,
2013-06-26 21:18:39 +00:00
'value' : $ ( '<p about="#mwt1" typeof="mw:Transclusion" data-mw="{"params":{"1":{"wt":"foo"}}}" data-parsoid="1">foo</p>' ) . toArray ( )
}
]
} ,
2013-07-23 13:35:26 +00:00
'mw:Transclusion containing only meta data' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . meta ,
2013-07-23 13:35:26 +00:00
'data' : [
{
'type' : 'mwTransclusionMeta' ,
'attributes' : {
'domElements' : $ ( ve . dm . mwExample . MWTransclusion . meta ) . toArray ( )
}
} ,
{ 'type' : '/mwTransclusionMeta' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'empty' } } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
2013-06-26 21:18:39 +00:00
'mw:Reference' : {
2013-07-25 17:11:50 +00:00
// Wikitext:
2013-09-19 22:57:08 +00:00
// Foo<ref name="bar" /> Baz<ref group="g1" name=":0">Quux</ref> Whee<ref name="bar">[[Bar]]</ref> Yay<ref group="g1">No name</ref> Quux<ref name="bar">Different content</ref> Foo<ref group="g1">No name</ref> Bar<ref name="foo" />
2013-07-25 17:11:50 +00:00
// <references><ref name="foo">Ref in refs</ref></references>
2013-10-18 21:27:25 +00:00
'body' :
'<p>Foo' +
'<span about="#mwt1" class="reference" data-mw="{"name":"ref","attrs":{"name":"bar"}}" id="cite_ref-bar-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{}">' +
'<a href="#cite_note-bar-1">[1]</a>' +
'</span>' +
' Baz' +
'<span about="#mwt2" class="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" data-parsoid="{}">' +
'</span>' +
' Whee' +
'<span about="#mwt3" class="reference" data-mw="{"name":"ref","body":{"html":"' +
'<a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar' +
'</a>"},"attrs":{"name":"bar"}}" id="cite_ref-bar-1-1" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{}">' +
'</span>' +
' Yay' +
'<span about="#mwt4" class="reference" data-mw="{"name":"ref","body":{"html":"No name"},"attrs":{"group":"g1"}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{}">' +
'</span>' +
' Quux' +
'<span about="#mwt5" class="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" data-parsoid="{}">' +
'</span>' +
' Foo' +
'<span about="#mwt6" class="reference" data-mw="{"name":"ref","attrs":{"name":"foo"}}" ' +
'id="cite_ref-foo-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{}">' +
'</span>' +
'</p>' +
ve . dm . mwExample . MWReference . referenceList ,
2013-09-26 02:07:22 +00:00
'head' : '<base href="http://example.com" />' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
'F' , 'o' , 'o' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listIndex' : 0 ,
'listGroup' : 'mwReference/' ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/bar' ,
2013-06-26 21:18:39 +00:00
'refGroup' : '' ,
2013-06-27 23:17:59 +00:00
'mw' : { 'name' : 'ref' , 'attrs' : { 'name' : 'bar' } } ,
'originalMw' : '{"name":"ref","attrs":{"name":"bar"}}' ,
2013-07-25 17:11:50 +00:00
'childDomElements' : $ ( '<a href="#cite_note-bar-1">[1]</a>' ) . toArray ( ) ,
2013-06-26 21:18:39 +00:00
'contentsUsed' : false
} ,
'htmlAttributes' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'about' : '#mwt1' ,
2013-06-26 21:18:39 +00:00
'class' : 'reference' ,
2013-06-27 23:17:59 +00:00
'data-mw' : '{"name":"ref","attrs":{"name":"bar"}}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '{}' ,
'id' : 'cite_ref-bar-1-0' ,
2013-07-25 17:11:50 +00:00
'rel' : 'dc:references' ,
2013-06-26 21:18:39 +00:00
'typeof' : 'mw:Extension/ref'
} ,
'children' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'href' : '#cite_note-bar-1'
2013-09-26 02:07:22 +00:00
} ,
'computed' : {
'href' : 'http://example.com/#cite_note-bar-1'
2013-06-26 21:18:39 +00:00
}
}
]
}
]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'B' , 'a' , 'z' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listIndex' : 1 ,
2013-09-19 22:57:08 +00:00
'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"}}' ,
2013-07-25 17:11:50 +00:00
'childDomElements' : [ ] ,
2013-06-26 21:18:39 +00:00
'contentsUsed' : true
} ,
'htmlAttributes' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'about' : '#mwt2' ,
2013-06-26 21:18:39 +00:00
'class' : 'reference' ,
2013-09-19 22:57:08 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Quux"},"attrs":{"group":"g1","name":":0"}}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '{}' ,
'id' : 'cite_ref-quux-2-0' ,
2013-07-25 17:11:50 +00:00
'rel' : 'dc:references' ,
2013-06-26 21:18:39 +00:00
'typeof' : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'W' , 'h' , 'e' , 'e' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listIndex' : 0 ,
'listGroup' : 'mwReference/' ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/bar' ,
2013-06-26 21:18:39 +00:00
'refGroup' : '' ,
2013-06-27 23:17:59 +00:00
'mw' : { 'name' : 'ref' , 'body' : { 'html' : '<a rel="mw:WikiLink" href="./Bar">Bar</a>' } , 'attrs' : { 'name' : 'bar' } } ,
'originalMw' : '{"name":"ref","body":{"html":"<a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar</a>"},"attrs":{"name":"bar"}}' ,
2013-07-25 17:11:50 +00:00
'childDomElements' : [ ] ,
2013-06-26 21:18:39 +00:00
'contentsUsed' : true
} ,
'htmlAttributes' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'about' : '#mwt3' ,
2013-06-26 21:18:39 +00:00
'class' : 'reference' ,
2013-06-27 23:17:59 +00:00
'data-mw' : '{"name":"ref","body":{"html":"<a rel=\\"mw:WikiLink\\" href=\\"./Bar\\">Bar</a>"},"attrs":{"name":"bar"}}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '{}' ,
'id' : 'cite_ref-bar-1-1' ,
2013-07-25 17:11:50 +00:00
'rel' : 'dc:references' ,
2013-06-26 21:18:39 +00:00
'typeof' : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'Y' , 'a' , 'y' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listIndex' : 2 ,
'listGroup' : 'mwReference/g1' ,
2013-09-19 22:57:08 +00:00
'listKey' : 'auto/0' ,
2013-06-26 21:18:39 +00:00
'refGroup' : 'g1' ,
2013-06-27 23:17:59 +00:00
'mw' : { 'name' : 'ref' , 'body' : { 'html' : 'No name' } , 'attrs' : { 'group' : 'g1' } } ,
'originalMw' : '{"name":"ref","body":{"html":"No name"},"attrs":{"group":"g1"}}' ,
2013-07-25 17:11:50 +00:00
'childDomElements' : [ ] ,
2013-06-26 21:18:39 +00:00
'contentsUsed' : true
} ,
'htmlAttributes' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'about' : '#mwt4' ,
2013-06-26 21:18:39 +00:00
'class' : 'reference' ,
2013-06-27 23:17:59 +00:00
'data-mw' : '{"name":"ref","body":{"html":"No name"},"attrs":{"group":"g1"}}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '{}' ,
2013-07-25 17:11:50 +00:00
'id' : 'cite_ref-1-0' ,
'rel' : 'dc:references' ,
2013-06-26 21:18:39 +00:00
'typeof' : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
{ 'type' : '/mwReference' } ,
2013-06-30 08:43:56 +00:00
' ' , 'Q' , 'u' , 'u' , 'x' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listIndex' : 0 ,
'listGroup' : 'mwReference/' ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/bar' ,
2013-06-30 08:43:56 +00:00
'refGroup' : '' ,
'mw' : { 'name' : 'ref' , 'body' : { 'html' : 'Different content' } , 'attrs' : { 'name' : 'bar' } } ,
'originalMw' : '{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' ,
2013-07-25 17:11:50 +00:00
'childDomElements' : [ ] ,
2013-06-30 08:43:56 +00:00
'contentsUsed' : false
} ,
'htmlAttributes' : [
{
'values' : {
2013-07-25 17:11:50 +00:00
'about' : '#mwt5' ,
2013-06-30 08:43:56 +00:00
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' ,
'data-parsoid' : '{}' ,
'id' : 'cite_ref-bar-1-2' ,
2013-07-25 17:11:50 +00:00
'rel' : 'dc:references' ,
2013-06-30 08:43:56 +00:00
'typeof' : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
}
]
} ,
{ 'type' : '/mwReference' } ,
' ' , 'F' , 'o' , 'o' ,
{
'type' : 'mwReference' ,
'attributes' : {
'listGroup' : 'mwReference/' ,
'listIndex' : 3 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/foo' ,
2013-07-25 17:11:50 +00:00
'refGroup' : '' ,
'mw' : { 'name' : 'ref' , 'attrs' : { 'name' : 'foo' } } ,
'originalMw' : '{"name":"ref","attrs":{"name":"foo"}}' ,
'childDomElements' : [ ] ,
'contentsUsed' : false
} ,
'htmlAttributes' : [
{
'values' : {
'about' : '#mwt6' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","attrs":{"name":"foo"}}' ,
'data-parsoid' : '{}' ,
'id' : 'cite_ref-foo-3-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
}
2013-06-30 08:43:56 +00:00
}
]
} ,
{ 'type' : '/mwReference' } ,
2013-06-26 21:18:39 +00:00
{ 'type' : '/paragraph' } ,
{
'type' : 'mwReferenceList' ,
'attributes' : {
'mw' : {
'name' : 'references' ,
2013-07-25 17:11:50 +00:00
'attrs' : { } ,
'body' : {
'extsrc' : '<ref name="foo">Ref in refs</ref>' ,
'html' : '<span about="#mwt8" class="reference" data-mw="{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-foo-3">[3]</a></span>'
}
2013-06-26 21:18:39 +00:00
} ,
2013-07-25 17:11:50 +00:00
'originalMw' : '{"name":"references","body":{"extsrc":"<ref name=\\"foo\\">Ref in refs</ref>","html":"<span about=\\"#mwt8\\" class=\\"reference\\" data-mw=\\"{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}\\" rel=\\"dc:references\\" typeof=\\"mw:Extension/ref\\"><a href=\\"#cite_note-foo-3\\">[3]</a></span>"},"attrs":{}}' ,
'domElements' : $ ( ve . dm . mwExample . MWReference . referenceList ) . toArray ( ) ,
2013-06-26 21:18:39 +00:00
'listGroup' : 'mwReference/' ,
'refGroup' : ''
}
} ,
2013-07-25 17:11:50 +00:00
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
{
'type' : 'mwReference' ,
'attributes' : {
'childDomElements' : $ ( '<a href="#cite_note-foo-3">[3]</a>' ) . toArray ( ) ,
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 3 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'literal/foo' ,
2013-07-25 17:11:50 +00:00
'mw' : { 'name' : 'ref' , 'attrs' : { 'name' : 'foo' } , 'body' : { 'html' : 'Ref in refs' } } ,
'originalMw' : '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}' ,
'refGroup' : ''
} ,
'htmlAttributes' : [ {
2013-09-26 02:07:22 +00:00
'children' : [
{
'values' : {
'href' : '#cite_note-foo-3'
} ,
'computed' : {
'href' : 'http://example.com/#cite_note-foo-3'
}
}
] ,
2013-07-25 17:11:50 +00:00
'values' : {
'about' : '#mwt8' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
}
} ]
} ,
{ 'type' : '/mwReference' } ,
{ 'type' : '/paragraph' } ,
2013-06-26 21:18:39 +00:00
{ 'type' : '/mwReferenceList' } ,
{ 'type' : 'internalList' } ,
{ 'type' : 'internalItem' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
[
'B' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'a' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'r' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/internalItem' } ,
{ 'type' : 'internalItem' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
'Q' , 'u' , 'u' , 'x' ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/internalItem' } ,
{ 'type' : 'internalItem' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
'N' , 'o' , ' ' , 'n' , 'a' , 'm' , 'e' ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/internalItem' } ,
2013-07-25 17:11:50 +00:00
{ 'type' : 'internalItem' } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
'R' , 'e' , 'f' , ' ' , 'i' , 'n' , ' ' , 'r' , 'e' , 'f' , 's' ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/internalItem' } ,
2013-06-26 21:18:39 +00:00
{ 'type' : '/internalList' }
]
} ,
'mw:Reference with metadata' : {
2013-10-18 21:27:25 +00:00
'body' : '<p><span about="#mwt2" class="reference" ' +
2013-06-26 21:18:39 +00:00
'data-mw="{"name":"ref","body":' +
'{"html":"Foo<!-- bar -->"},"attrs":{}}" ' +
'id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid="{}">' +
'<a href="#cite_note-bar-1" data-parsoid="{}">[1]</a></span></p>' ,
2013-09-26 02:07:22 +00:00
'head' : '<base href="http://example.com" />' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
{
'type' : 'mwReference' ,
'attributes' : {
'contentsUsed' : true ,
'listGroup' : 'mwReference/' ,
'listIndex' : 0 ,
2013-09-19 22:57:08 +00:00
'listKey' : 'auto/0' ,
2013-06-26 21:18:39 +00:00
'mw' : {
'attrs' : { } ,
'body' : {
'html' : 'Foo<!-- bar -->'
} ,
'name' : 'ref'
} ,
'originalMw' : '{"name":"ref","body":{"html":"Foo<!-- bar -->"},"attrs":{}}' ,
'childDomElements' : $ ( '<a href="#cite_note-bar-1" data-parsoid="{}">[1]</a>' ) . toArray ( ) ,
'refGroup' : ''
} ,
'htmlAttributes' : [
{
'values' : {
'about' : '#mwt2' ,
'class' : 'reference' ,
'data-mw' : '{"name":"ref","body":{"html":"Foo<!-- bar -->"},"attrs":{}}' ,
'data-parsoid' : '{}' ,
'id' : 'cite_ref-1-0' ,
'rel' : 'dc:references' ,
'typeof' : 'mw:Extension/ref'
} ,
2013-09-26 02:07:22 +00:00
'children' : [
{
'values' : {
'data-parsoid' : '{}' ,
'href' : '#cite_note-bar-1'
} ,
'computed' : {
'href' : 'http://example.com/#cite_note-bar-1'
} } ]
2013-06-26 21:18:39 +00:00
}
]
} ,
{ 'type' : '/mwReference' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : 'internalItem' } ,
{
'internal' : {
'generated' : 'wrapper'
} ,
'type' : 'paragraph'
} ,
'F' , 'o' , 'o' ,
{ 'type' : '/paragraph' } ,
{
'type' : 'alienMeta' ,
'attributes' : {
'domElements' : $ ( '<!-- bar -->' ) . toArray ( )
}
} ,
{ 'type' : '/alienMeta' } ,
{ 'type' : '/internalItem' } ,
{ 'type' : '/internalList' }
]
} ,
'internal link with ./ and ../' : {
2013-10-18 21:27:25 +00:00
'body' : '<p><a rel="mw:WikiLink" href="./../../../Foo/Bar">Foo</a></p>' ,
2013-09-26 02:07:22 +00:00
'head' : '<base href="http://example.com/one/two/three/four/five" />' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
[
'F' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Foo/Bar' ,
'origTitle' : 'Foo/Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Foo/Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './../../../'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './../../../Foo/Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/one/Foo/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'o' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Foo/Bar' ,
'origTitle' : 'Foo/Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Foo/Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './../../../'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './../../../Foo/Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/one/Foo/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'o' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Foo/Bar' ,
'origTitle' : 'Foo/Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Foo/Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './../../../'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './../../../Foo/Bar' ,
'rel' : 'mw:WikiLink'
} ,
'computed' : {
'href' : 'http://example.com/one/Foo/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
2013-10-17 20:15:36 +00:00
'numbered external link (empty mw:Extlink)' : {
2013-10-18 21:27:25 +00:00
'body' : '<p>Foo<a rel="mw:ExtLink" href="http://www.example.com"></a>Bar</p>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
2013-10-17 20:15:36 +00:00
'F' , 'o' , 'o' ,
{
'type' : 'link/mwNumberedExternal' ,
'attributes' : {
'href' : 'http://www.example.com'
} ,
'htmlAttributes' : [ {
'values' : {
'href' : 'http://www.example.com' ,
'rel' : 'mw:ExtLink'
2013-09-26 02:07:22 +00:00
} ,
'computed' : {
'href' : 'http://www.example.com/'
2013-10-17 20:15:36 +00:00
}
2013-06-26 21:18:39 +00:00
} ]
2013-10-17 20:15:36 +00:00
} ,
{ 'type' : '/link/mwNumberedExternal' } ,
'B' , 'a' , 'r' ,
2013-06-26 21:18:39 +00:00
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'URL link' : {
2013-10-18 21:27:25 +00:00
'body' : '<p><a rel="mw:ExtLink" href="http://www.mediawiki.org/">mw</a></p>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
[
'm' ,
[ {
'type' : 'link/mwExternal' ,
'attributes' : {
'href' : 'http://www.mediawiki.org/' ,
2013-07-04 11:18:18 +00:00
'rel' : 'mw:ExtLink'
2013-06-26 21:18:39 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : 'http://www.mediawiki.org/' ,
'rel' : 'mw:ExtLink'
} ,
'computed' : {
'href' : 'http://www.mediawiki.org/'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'w' ,
[ {
'type' : 'link/mwExternal' ,
'attributes' : {
'href' : 'http://www.mediawiki.org/' ,
2013-07-04 11:18:18 +00:00
'rel' : 'mw:ExtLink'
2013-06-26 21:18:39 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : 'http://www.mediawiki.org/' ,
'rel' : 'mw:ExtLink'
} ,
'computed' : {
'href' : 'http://www.mediawiki.org/'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'whitespace preservation with wrapped comments and language links' : {
2013-10-18 21:27:25 +00:00
'body' : 'Foo\n' +
2013-06-26 21:18:39 +00:00
'<link rel="mw:WikiLink/Language" href="http://de.wikipedia.org/wiki/Foo">\n' +
2013-10-18 21:27:25 +00:00
'<link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Foo">' ,
2013-06-26 21:18:39 +00:00
'data' : [
{
'type' : 'paragraph' ,
'internal' : {
'generated' : 'wrapper' ,
'whitespace' : [ undefined , undefined , undefined , '\n' ]
}
} ,
'F' ,
'o' ,
'o' ,
{ 'type' : '/paragraph' } ,
{
'type' : 'mwLanguage' ,
'attributes' : {
2013-10-17 13:48:37 +00:00
'href' : 'http://de.wikipedia.org/wiki/Foo' ,
'origRel' : 'mw:WikiLink/Language'
2013-06-26 21:18:39 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : 'http://de.wikipedia.org/wiki/Foo' ,
'rel' : 'mw:WikiLink/Language'
} ,
'computed' : {
'href' : 'http://de.wikipedia.org/wiki/Foo'
}
}
] ,
2013-06-26 21:18:39 +00:00
'internal' : { 'whitespace' : [ '\n' , undefined , undefined , '\n' ] }
} ,
{ 'type' : '/mwLanguage' } ,
{
'type' : 'mwLanguage' ,
'attributes' : {
2013-10-17 13:48:37 +00:00
'href' : 'http://fr.wikipedia.org/wiki/Foo' ,
'origRel' : 'mw:PageProp/Language'
2013-06-26 21:18:39 +00:00
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : 'http://fr.wikipedia.org/wiki/Foo' ,
'rel' : 'mw:PageProp/Language'
} ,
'computed' : {
'href' : 'http://fr.wikipedia.org/wiki/Foo'
}
}
] ,
2013-06-26 21:18:39 +00:00
'internal' : { 'whitespace' : [ '\n' ] }
} ,
{ 'type' : '/mwLanguage' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'document with meta elements' : {
2013-10-18 21:27:25 +00:00
'body' : '<!-- No content conversion --><meta property="mw:PageProp/nocc" /><p>Foo' +
2013-10-17 13:48:37 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Bar" />Bar' +
2013-06-26 21:18:39 +00:00
'<meta property="mw:foo" content="bar" />Ba<!-- inline -->z</p>' +
'<meta property="mw:bar" content="baz" /><!--barbaz-->' +
2013-10-17 13:48:37 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Foo_foo#Bar baz%23quux" />' +
2013-10-18 21:27:25 +00:00
'<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ,
2013-09-26 02:07:22 +00:00
'head' : '<base href="http://example.com" />' ,
2013-07-03 01:30:10 +00:00
'data' : ve . dm . mwExample . withMeta
2013-06-26 21:18:39 +00:00
} ,
'RDFa types spread across two attributes, about grouping is forced' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWTransclusion . mixed ,
2013-06-26 21:18:39 +00:00
'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' : {
2013-10-18 21:27:25 +00:00
'body' : '<p>a<span typeof="mw:Entity">¢</span>b<span typeof="mw:Entity">¥</span><span typeof="mw:Entity">™</span></p>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' } ,
'a' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '¢' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
'b' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '¥' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '™' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'wrapping with mw:Entity' : {
2013-10-18 21:27:25 +00:00
'body' : 'a<span typeof="mw:Entity">¢</span>b<span typeof="mw:Entity">¥</span><span typeof="mw:Entity">™</span>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' } } ,
'a' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '¢' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
'b' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '¥' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '™' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'whitespace preservation with mw:Entity' : {
2013-10-18 21:27:25 +00:00
'body' : '<p> a <span typeof="mw:Entity"> </span> b <span typeof="mw:Entity">¥</span>\t<span typeof="mw:Entity">™</span></p>' ,
2013-06-26 21:18:39 +00:00
'data' : [
{ 'type' : 'paragraph' , 'internal' : { 'whitespace' : [ undefined , ' ' ] } } ,
'a' ,
' ' ,
' ' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : ' ' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
' ' ,
' ' ,
' ' ,
'b' ,
' ' ,
' ' ,
' ' ,
' ' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '¥' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
'\t' ,
{
'type' : 'mwEntity' ,
'attributes' : { 'character' : '™' } ,
'htmlAttributes' : [ { 'values' : { 'typeof' : 'mw:Entity' } } ]
} ,
{ 'type' : '/mwEntity' } ,
{ 'type' : '/paragraph' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'category default sort key' : {
2013-10-18 21:27:25 +00:00
'body' : '<meta property="mw:PageProp/categorydefaultsort" content="foo">' ,
2013-06-26 21:18:39 +00:00
'data' : [
{
'type' : 'mwDefaultSort' ,
'attributes' : {
'content' : 'foo'
} ,
'htmlAttributes' : [ { 'values' : {
'content' : 'foo' ,
'property' : 'mw:PageProp/categorydefaultsort'
} } ]
} ,
{ 'type' : '/mwDefaultSort' } ,
2013-07-15 11:06:31 +00:00
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'empty' } } ,
{ 'type' : '/paragraph' } ,
2013-06-26 21:18:39 +00:00
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
} ,
'thumb image' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . MWBlockImage . html ,
2013-10-05 10:27:39 +00:00
'data' : ve . dm . mwExample . MWBlockImage . data . concat ( [
2013-06-26 21:18:39 +00:00
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
2013-10-05 10:27:39 +00:00
] )
2013-06-26 21:18:39 +00:00
} ,
'attribute preservation does not crash due to text node split' : {
2013-10-18 21:27:25 +00:00
'body' :
'<figure typeof="mw:Image/Thumb" data-parsoid="{}">' +
'<a href="Foo" data-parsoid="{}">' +
'<img src="Bar" width="1" height="2" resource="FooBar" data-parsoid="{}">' +
'</a>' +
'<figcaption data-parsoid="{}">' +
' foo <a rel="mw:WikiLink" href="./Bar" data-parsoid="{}">bar</a> baz' +
'</figcaption>' +
'</figure>' ,
2013-09-26 02:07:22 +00:00
'head' : '<base href="http://example.com" />' ,
2013-06-26 21:18:39 +00:00
'data' : [
{
'type' : 'mwBlockImage' ,
'attributes' : {
'type' : 'thumb' ,
'align' : 'default' ,
'href' : 'Foo' ,
'src' : 'Bar' ,
2013-10-15 16:50:01 +00:00
'width' : 1 ,
'height' : 2 ,
2013-06-26 21:18:39 +00:00
'resource' : 'FooBar' ,
2013-06-28 00:24:05 +00:00
'originalClasses' : undefined ,
'unrecognizedClasses' : [ ]
2013-06-26 21:18:39 +00:00
} ,
'htmlAttributes' : [ {
'values' : { 'data-parsoid' : '{}' } ,
'children' : [
{
'values' : { 'data-parsoid' : '{}' } ,
'children' : [ {
'values' : { 'data-parsoid' : '{}' }
} ]
} ,
{
'values' : { 'data-parsoid' : '{}' } ,
'children' : [
{ 'values' : { 'data-parsoid' : '{}' } }
]
}
]
} ]
} ,
{ 'type' : 'mwImageCaption' , 'internal' : { 'whitespace' : [ undefined , ' ' ] } } ,
{ 'type' : 'paragraph' , 'internal' : { 'generated' : 'wrapper' , 'whitespace' : [ ' ' ] } } ,
'f' , 'o' , 'o' , ' ' ,
[
'b' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink' ,
'data-parsoid' : '{}'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'a' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink' ,
'data-parsoid' : '{}'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'r' ,
[ {
'type' : 'link/mwInternal' ,
'attributes' : {
'title' : 'Bar' ,
'origTitle' : 'Bar' ,
2013-06-26 13:56:59 +00:00
'normalizedTitle' : 'Bar' ,
2013-06-26 21:18:39 +00:00
'hrefPrefix' : './'
} ,
2013-09-26 02:07:22 +00:00
'htmlAttributes' : [
{
'values' : {
'href' : './Bar' ,
'rel' : 'mw:WikiLink' ,
'data-parsoid' : '{}'
} ,
'computed' : {
'href' : 'http://example.com/Bar'
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
' ' , 'b' , 'a' , 'z' ,
{ 'type' : '/paragraph' } ,
{ 'type' : '/mwImageCaption' } ,
{ 'type' : '/mwBlockImage' } ,
{ 'type' : 'internalList' } ,
{ 'type' : '/internalList' }
]
2013-07-17 01:22:22 +00:00
} ,
'mw:Nowiki' : {
2013-10-18 21:27:25 +00:00
'body' : ve . dm . mwExample . mwNowikiHtml ,
2013-07-17 01:22:22 +00:00
'data' : ve . dm . mwExample . mwNowiki
} ,
'mw:Nowiki unwraps when text modified' : {
'data' : ve . dm . mwExample . mwNowiki ,
'modify' : function ( data ) {
data [ 7 ] [ 0 ] = 'z' ;
} ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : '<p>Foo[[Bzr]]Baz</p>'
2013-07-17 01:22:22 +00:00
} ,
'mw:Nowiki unwraps when annotations modified' : {
'data' : ve . dm . mwExample . mwNowiki ,
'modify' : function ( data ) {
data [ 7 ] [ 1 ] . push ( ve . dm . example . bold ) ;
} ,
2013-10-18 21:27:25 +00:00
'normalizedBody' : '<p>Foo[[B<b>a</b>r]]Baz</p>'
2013-06-26 21:18:39 +00:00
}
} ;