2013-06-26 21:18:39 +00:00
/ * !
2014-03-03 14:10:06 +00:00
* VisualEditor DataModel MediaWiki - specific example data sets .
2013-06-26 21:18:39 +00:00
*
2015-01-08 23:54:03 +00:00
* @ copyright 2011 - 2015 VisualEditor Team and others ; see AUTHORS . txt
2013-06-26 21:18:39 +00:00
* @ 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 = {
2014-08-22 20:50:48 +00:00
blockOpen :
2013-12-11 10:23:29 +00:00
'<div about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}"' +
2013-12-11 10:23:29 +00:00
'>' +
'</div>' ,
2014-08-22 20:50:48 +00:00
blockOpenModified :
2013-12-11 10:23:29 +00:00
'<div about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, globe!"}},"i":0}}]}"' +
2013-12-11 10:33:15 +00:00
' data-ve-no-generated-contents="true"' +
2013-12-11 10:23:29 +00:00
'>' +
'</div>' ,
2014-08-22 20:50:48 +00:00
blockContent : '<p about="#mwt1" data-parsoid="{}">Hello, world!</p>' ,
inlineOpen :
2013-12-11 10:23:29 +00:00
'<span about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}"' +
2013-12-11 10:23:29 +00:00
'>' ,
2014-08-22 20:50:48 +00:00
inlineOpenModified :
2013-12-11 10:23:29 +00:00
'<span about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
2013-12-11 10:33:15 +00:00
' data-ve-no-generated-contents="true"' +
2013-12-11 10:23:29 +00:00
'>' ,
2014-08-22 20:50:48 +00:00
inlineContent : '$1,234.00' ,
inlineClose : '</span>' ,
mixed :
2013-12-11 10:23:29 +00:00
'<link about="#mwt1" rel="mw:PageProp/Category" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
2013-12-11 10:23:29 +00:00
'>' +
'<span about="#mwt1">Foo</span>' ,
2014-08-22 20:50:48 +00:00
pairOne :
2013-12-11 10:23:29 +00:00
'<p about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}" data-parsoid="1"' +
2013-12-11 10:23:29 +00:00
'>foo</p>' ,
2014-08-22 20:50:48 +00:00
pairTwo :
2013-12-11 10:23:29 +00:00
'<p about="#mwt2" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}" data-parsoid="2"' +
2013-12-11 10:23:29 +00:00
'>foo</p>' ,
2014-08-22 20:50:48 +00:00
meta :
2013-12-11 10:23:29 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Page" about="#mwt1" typeof="mw:Transclusion"' +
2014-08-20 20:36:12 +00:00
' data-mw="{"parts":[{"template":{"target":{"wt":"Template:Echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Page]]\\n[[Category:Book]]"}},"i":0}}]}">' +
2013-07-23 13:35:26 +00:00
'<span about="#mwt1" data-parsoid="{}">\n</span>' +
2013-12-06 21:12:44 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Book" about="#mwt1">'
2013-06-26 21:18:39 +00:00
} ;
ve . dm . mwExample . MWTransclusion . blockData = {
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionBlock' ,
attributes : {
mw : {
parts : [
2014-08-20 20:36:12 +00:00
{
2014-08-22 20:50:48 +00:00
template : {
target : {
wt : 'Test' ,
href : './Template:Test'
2014-08-20 20:36:12 +00:00
} ,
2014-08-22 20:50:48 +00:00
params : {
1 : {
wt : 'Hello, world!'
2014-08-20 20:36:12 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
i : 0
2014-08-20 20:36:12 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalDomElements : $ ( ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ) . toArray ( ) ,
originalMw : '{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}' ,
originalIndex : 0
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
{ values : {
about : '#mwt1' ,
2014-08-20 20:36:12 +00:00
'data-mw' : '{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}' ,
2014-08-22 20:50:48 +00:00
typeof : 'mw:Transclusion'
2013-06-26 21:18:39 +00:00
} } ,
2014-08-22 20:50:48 +00:00
{ values : {
about : '#mwt1' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '{}'
} }
]
} ;
ve . dm . mwExample . MWTransclusion . inlineData = {
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionInline' ,
attributes : {
mw : {
parts : [
2014-08-20 20:36:12 +00:00
{
2014-08-22 20:50:48 +00:00
template : {
target : {
wt : 'Inline' ,
href : './Template:Inline'
2014-08-20 20:36:12 +00:00
} ,
2014-08-22 20:50:48 +00:00
params : {
1 : {
wt : '1,234'
2014-08-20 20:36:12 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
i : 0
2014-08-20 20:36:12 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalDomElements : $ ( ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ) . toArray ( ) ,
originalMw : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}' ,
originalIndex : 0
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt1' ,
2014-08-20 20:36:12 +00:00
'data-mw' : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}' ,
2014-08-22 20:50:48 +00:00
typeof : 'mw:Transclusion'
2013-06-26 21:18:39 +00:00
} } ]
} ;
ve . dm . mwExample . MWTransclusion . mixedDataOpen = {
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionInline' ,
attributes : {
mw : {
parts : [
2014-08-20 20:36:12 +00:00
{
2014-08-22 20:50:48 +00:00
template : {
target : {
wt : 'Inline' ,
href : './Template:Inline'
2014-08-20 20:36:12 +00:00
} ,
2014-08-22 20:50:48 +00:00
params : {
1 : {
wt : '5,678'
2014-08-20 20:36:12 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
i : 0
2014-08-20 20:36:12 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalDomElements : $ ( ve . dm . mwExample . MWTransclusion . mixed ) . toArray ( ) ,
originalMw : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}' ,
originalIndex : 0
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
{ values : {
about : '#mwt1' ,
rel : 'mw:PageProp/Category' ,
typeof : 'mw:Transclusion' ,
2014-08-20 20:36:12 +00:00
'data-mw' : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}'
2013-06-26 21:18:39 +00:00
} } ,
2014-08-22 20:50:48 +00:00
{ values : { about : '#mwt1' } }
2013-06-26 21:18:39 +00:00
]
} ;
2014-08-22 20:50:48 +00:00
ve . dm . mwExample . MWTransclusion . mixedDataClose = { type : '/mwTransclusionInline' } ;
2013-06-26 21:18:39 +00:00
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 = {
2014-08-22 20:50:48 +00:00
hash : ve . dm . mwExample . MWTransclusion . blockParamsHash ,
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 = {
2014-08-22 20:50:48 +00:00
hash : ve . dm . mwExample . MWTransclusion . inlineParamsHash ,
value : $ ( ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ) . toArray ( )
2013-06-26 21:18:39 +00:00
} ;
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 = {
2014-08-22 20:50:48 +00:00
hash : ve . dm . mwExample . MWTransclusion . mixedParamsHash ,
value : $ ( ve . dm . mwExample . MWTransclusion . mixed ) . toArray ( )
2013-06-26 21:18:39 +00:00
} ;
2014-01-06 13:56:55 +00:00
ve . dm . mwExample . MWInternalLink = {
2014-08-22 20:50:48 +00:00
absoluteHref : ve . resolveUrl ( '/wiki/Foo/Bar' , ve . dm . example . base )
2014-01-06 13:56:55 +00:00
} ;
ve . dm . mwExample . MWInternalLink . absoluteOpen = '<a rel="mw:WikiLink" href="' + ve . dm . mwExample . MWInternalLink . absoluteHref + '">' ;
ve . dm . mwExample . MWInternalLink . absoluteData = {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Foo/Bar' ,
origTitle : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar' ,
hrefPrefix : ''
2014-01-06 13:56:55 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2014-01-06 13:56:55 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : ve . dm . mwExample . MWInternalLink . absoluteHref ,
rel : 'mw:WikiLink'
2014-01-06 13:56:55 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : ve . dm . mwExample . MWInternalLink . absoluteHref
2014-01-06 13:56:55 +00:00
}
}
]
} ;
2014-03-19 02:08:47 +00:00
ve . dm . mwExample . MWInternalSectionLink = {
2014-08-22 20:50:48 +00:00
absoluteHref : ve . resolveUrl ( '/wiki/Foo#Bar' , ve . dm . example . base )
2014-03-19 02:08:47 +00:00
} ;
ve . dm . mwExample . MWInternalSectionLink . absoluteOpen = '<a rel="mw:WikiLink" href="' + ve . dm . mwExample . MWInternalSectionLink . absoluteHref + '">' ;
ve . dm . mwExample . MWInternalSectionLink . absoluteData = {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Foo#Bar' ,
origTitle : 'Foo#Bar' ,
normalizedTitle : 'Foo#Bar' ,
lookupTitle : 'Foo' ,
hrefPrefix : ''
2014-03-19 02:08:47 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2014-03-19 02:08:47 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : ve . dm . mwExample . MWInternalSectionLink . absoluteHref ,
rel : 'mw:WikiLink'
2014-03-19 02:08:47 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : ve . dm . mwExample . MWInternalSectionLink . absoluteHref
2014-03-19 02:08:47 +00:00
}
}
]
} ;
2013-10-05 10:27:39 +00:00
ve . dm . mwExample . MWBlockImage = {
2014-08-22 20:50:48 +00:00
html :
2013-10-05 10:27:39 +00:00
'<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>' ,
2014-08-22 20:50:48 +00:00
data : [
2013-10-05 10:27:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwBlockImage' ,
attributes : {
type : 'thumb' ,
align : 'right' ,
href : 'Foo' ,
src : 'Bar' ,
width : 1 ,
height : 2 ,
resource : 'FooBar' ,
originalClasses : 'mw-halign-right foobar' ,
unrecognizedClasses : [ 'foobar' ]
2013-10-05 10:27:39 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : 'mwImageCaption' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-10-05 10:27:39 +00:00
'a' , 'b' , 'c' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' }
2013-10-15 12:18:11 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-10-15 12:18:11 +00:00
{
2014-08-22 20:50:48 +00:00
hash : '[{"height":2,"resource":"FooBar","type":"mwBlockImage","width":1},null]' ,
value : 'Bar'
2013-10-15 12:18:11 +00:00
}
2013-10-05 10:27:39 +00:00
]
} ;
2013-10-15 16:50:01 +00:00
ve . dm . mwExample . MWInlineImage = {
2014-08-22 20:50:48 +00:00
html :
2013-10-15 16:50:01 +00:00
'<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>' ,
2014-08-22 20:50:48 +00:00
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' ]
2014-05-15 16:12:43 +00:00
}
2013-10-15 12:18:11 +00:00
} ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-10-15 12:18:11 +00:00
{
2014-08-22 20:50:48 +00:00
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 12:18:11 +00:00
}
]
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 = {
2014-08-22 20:50:48 +00:00
referencesList :
2013-07-25 17:11:50 +00:00
'<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 = {
2014-08-22 20:50:48 +00:00
type : 'mwNowiki' ,
attributes : {
originalDomElements : $ ( '<span typeof="mw:Nowiki">[[Bar]]</span>' ) . toArray ( )
2013-07-17 01:22:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : { typeof : 'mw:Nowiki' } } ]
2013-07-17 01:22:22 +00:00
} ;
ve . dm . mwExample . mwNowiki = [
2014-08-22 20:50:48 +00:00
{ type : 'paragraph' } ,
2013-07-17 01:22:22 +00:00
'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' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-17 01:22:22 +00:00
] ;
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 = [
{
2014-08-22 20:50:48 +00:00
type : 'commentMeta' ,
attributes : {
text : ' No content conversion '
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/commentMeta' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:ThisIsAnAlien" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwAlienMeta' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'F' ,
'o' ,
'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwCategory' ,
attributes : {
hrefPrefix : './' ,
category : 'Category:Bar' ,
origCategory : 'Category:Bar' ,
sortkey : '' ,
origSortkey : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
rel : 'mw:PageProp/Category' ,
href : './Category:Bar'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Category:Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwCategory' } ,
2013-07-03 01:30:10 +00:00
'B' ,
'a' ,
'r' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:foo" content="bar" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwAlienMeta' } ,
2013-07-03 01:30:10 +00:00
'B' ,
'a' ,
{
2014-08-22 20:50:48 +00:00
type : 'comment' ,
attributes : {
text : ' inline '
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/comment' } ,
2013-07-03 01:30:10 +00:00
'z' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:bar" content="baz" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwAlienMeta' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'commentMeta' ,
attributes : {
text : 'barbaz'
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/commentMeta' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwCategory' ,
attributes : {
hrefPrefix : './' ,
category : 'Category:Foo foo' ,
origCategory : 'Category:Foo_foo' ,
sortkey : 'Bar baz#quux' ,
origSortkey : 'Bar baz%23quux'
2013-07-03 01:30:10 +00:00
} ,
2013-09-26 02:07:22 +00:00
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
rel : 'mw:PageProp/Category' ,
href : './Category:Foo_foo#Bar baz%23quux'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Category:Foo_foo#Bar baz%23quux'
2013-09-26 02:07:22 +00:00
}
}
]
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwCategory' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwAlienMeta' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-03 01:30:10 +00:00
] ;
ve . dm . mwExample . withMetaPlainData = [
2014-08-22 20:50:48 +00:00
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'F' ,
'o' ,
'o' ,
'B' ,
'a' ,
'r' ,
'B' ,
'a' ,
'z' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-03 01:30:10 +00:00
] ;
ve . dm . mwExample . withMetaMetaData = [
[
{
2014-08-22 20:50:48 +00:00
type : 'alienMeta' ,
attributes : {
domElements : $ ( '<!-- No content conversion -->' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:ThisIsAnAlien" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
}
] ,
undefined ,
undefined ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwCategory' ,
attributes : {
hrefPrefix : './' ,
category : 'Category:Bar' ,
origCategory : 'Category:Bar' ,
sortkey : '' ,
origSortkey : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
rel : 'mw:PageProp/Category' ,
href : './Category:Bar'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Category:Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:foo" content="bar" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
}
] ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'alienMeta' ,
attributes : {
domElements : $ ( '<!-- inline -->' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
}
] ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta property="mw:bar" content="baz" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
} ,
{
2014-08-22 20:50:48 +00:00
type : 'comment' ,
attributes : {
text : 'barbaz'
2013-07-03 01:30:10 +00:00
}
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwCategory' ,
attributes : {
hrefPrefix : './' ,
category : 'Category:Foo foo' ,
origCategory : 'Category:Foo_foo' ,
sortkey : 'Bar baz#quux' ,
origSortkey : 'Bar baz%23quux'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
rel : 'mw:PageProp/Category' ,
href : './Category:Foo_foo#Bar baz%23quux'
2013-07-03 01:30:10 +00:00
} } ]
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
attributes : {
domElements : $ ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
}
] ,
undefined ,
undefined
] ;
ve . dm . mwExample . references = [
2014-08-22 20:50:48 +00:00
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 0 ,
listKey : 'auto/0' ,
mw : {
attrs : { } ,
body : { html : 'No name 1' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}' ,
refGroup : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt2' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","body":{"html":"No name 1"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 1</ref>","dsr":[0,20,5,6]}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-1-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
{ type : '/paragraph' } ,
{ type : 'paragraph' , htmlAttributes : [ { values : { 'data-parsoid' : '{"dsr":[22,108,0,0]}' } } ] } ,
2013-07-03 01:30:10 +00:00
'F' , 'o' , 'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 1 ,
listKey : 'literal/bar' ,
mw : {
attrs : { name : 'bar' } ,
body : { html : 'Bar' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"body":{"html":""},"attrs":{"name":"bar"}}' ,
refGroup : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt6' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Bar"},"attrs":{"name":"bar"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"bar\\">Bar</ref>","dsr":[25,50,16,6]}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-bar-2-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-07-03 01:30:10 +00:00
' ' , 'B' , 'a' , 'z' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 2 ,
listKey : 'literal/:3' ,
mw : {
attrs : { name : ':3' } ,
body : { html : 'Quux' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":":3"}}' ,
refGroup : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt7' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Quux"},"attrs":{"name":"quux"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"quux\\">Quux</ref>","dsr":[54,81,17,6]}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-quux-3-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-07-03 01:30:10 +00:00
' ' , 'W' , 'h' , 'e' , 'e' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : false ,
listGroup : 'mwReference/' ,
listIndex : 1 ,
listKey : 'literal/bar' ,
mw : {
attrs : { name : 'bar' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"body":{"html":""},"attrs":{"name":"bar"}}' ,
refGroup : ''
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt8' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","attrs":{"name":"bar"}}' ,
'data-parsoid' : '{"src":"<ref name=\\"bar\\" />","dsr":[86,104,18,0]}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-bar-2-1' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-07-03 01:30:10 +00:00
' ' , 'Y' , 'a' , 'y' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 3 ,
listKey : 'auto/1' ,
mw : {
attrs : { } ,
body : { html : 'No name 2' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}' ,
refGroup : ''
2014-06-26 10:41:18 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt11' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","body":{"html":"No name 2"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 2</ref>","dsr":[110,130,5,6]}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-4-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/foo' ,
listIndex : 4 ,
listKey : 'auto/2' ,
mw : {
attrs : { group : 'foo' } ,
body : { html : 'No name 3' } ,
name : 'ref'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"ref","body":{"html":"No name 3"},"attrs":{"group":"foo"}}' ,
refGroup : 'foo'
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
about : '#mwt12' ,
class : 'reference' ,
2013-07-03 01:30:10 +00:00
'data-mw' : '{"name":"ref","body":{"html":"No name 3"},"attrs":{}}' ,
'data-parsoid' : '{"src":"<ref>No name 3</ref>"' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-5-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-03 01:30:10 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
{ type : '/paragraph' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReferencesList' ,
attributes : {
mw : {
name : 'references' ,
attrs : { }
2013-07-03 01:30:10 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"references","attrs":{}"}' ,
//domElements: HTML,
listGroup : 'mwReference/' ,
refGroup : ''
2013-07-03 01:30:10 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReferencesList' } ,
{ type : 'internalList' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'N' , 'o' , ' ' , 'n' , 'a' , 'm' , 'e' , ' ' , '1' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'B' , 'a' , 'r' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'Q' , 'u' , 'u' , 'x' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'N' , 'o' , ' ' , 'n' , 'a' , 'm' , 'e' , ' ' , '2' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' } ,
2013-07-03 01:30:10 +00:00
'N' , 'o' , ' ' , 'n' , 'a' , 'm' , 'e' , ' ' , '3' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : '/internalList' }
2013-07-03 01:30:10 +00:00
] ;
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 = [
2013-09-30 13:25:28 +00:00
// 0
2014-08-22 20:50:48 +00:00
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- before -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
{ type : 'paragraph' } ,
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
'F' , [ 'o' , [ ve . dm . example . bold ] ] , [ 'o' , [ ve . dm . example . italic ] ] ,
2013-09-30 13:25:28 +00:00
// 4
2014-08-22 20:50:48 +00:00
{ type : 'mwReference' , attributes : {
mw : { } ,
about : '#mwt1' ,
listIndex : 0 ,
listGroup : 'mwReference/' ,
listKey : 'auto/0' ,
refGroup : '' ,
contentsUsed : true
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
} } ,
2013-09-30 13:25:28 +00:00
// 5
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-09-30 13:25:28 +00:00
// 6
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- after -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
2013-09-30 13:25:28 +00:00
// 7
2014-08-22 20:50:48 +00:00
{ type : 'internalList' } ,
2013-09-30 13:25:28 +00:00
// 8
2014-08-22 20:50:48 +00:00
{ type : 'internalItem' } ,
2013-09-30 13:25:28 +00:00
// 9
2014-08-22 20:50:48 +00:00
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
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
'R' , [ 'e' , [ ve . dm . example . bold ] ] , 'f' ,
2013-09-30 13:25:28 +00:00
// 13
2014-08-22 20:50:48 +00:00
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- reference -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
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
'e' , [ 'r' , [ ve . dm . example . italic ] ] , [ 'e' , [ ve . dm . example . italic ] ] ,
2013-09-30 13:25:28 +00:00
// 16
2014-08-22 20:50:48 +00:00
{ type : 'mwReference' , attributes : {
mw : { } ,
about : '#mwt2' ,
listIndex : 1 ,
listGroup : 'mwReference/' ,
listKey : 'foo' ,
refGroup : '' ,
contentsUsed : true
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
} } ,
2013-09-30 13:25:28 +00:00
// 17
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
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
'n' , 'c' , 'e' ,
2013-09-30 13:25:28 +00:00
// 21
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
2013-09-30 13:25:28 +00:00
// 22
2014-08-22 20:50:48 +00:00
{ type : '/internalItem' } ,
2013-09-30 13:25:28 +00:00
// 23
2014-08-22 20:50:48 +00:00
{ type : 'internalItem' } ,
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- beginning -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
2013-09-30 13:25:28 +00:00
// 24
2014-08-22 20:50:48 +00:00
{ type : 'preformatted' } ,
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- inside -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
2013-09-30 13:25:28 +00:00
// 25
2014-08-22 20:50:48 +00:00
{ type : 'mwEntity' , attributes : { character : '€' } } ,
2013-09-30 13:25:28 +00:00
// 26
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
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
'2' , '5' , '0' ,
2014-08-22 20:50:48 +00:00
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- inside2 -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
2013-09-30 13:25:28 +00:00
// 30
2014-08-22 20:50:48 +00:00
{ type : '/preformatted' } ,
{ type : 'alienMeta' , attributes : { domElements : $ ( '<!-- end -->' ) . get ( ) } } ,
{ type : '/alienMeta' } ,
2013-09-30 13:25:28 +00:00
// 31
2014-08-22 20:50:48 +00:00
{ type : '/internalItem' } ,
2013-09-30 13:25:28 +00:00
// 32
2014-08-22 20:50:48 +00:00
{ type : '/internalList' }
2013-09-30 13:25:28 +00:00
// 33
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 . internalItems = [
2014-08-22 20:50:48 +00:00
{ group : 'mwReference' , key : null , body : 'First reference' } ,
{ group : 'mwReference' , key : 'foo' , body : 'Table in ref: <table><tr><td>because I can</td></tr></table>' }
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
] ;
2013-11-12 23:34:50 +00:00
ve . dm . mwExample . complexInternalData . internalListNextUniqueNumber = 1 ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . domToDataCases = {
2013-07-12 21:21:20 +00:00
'adjacent annotations' : {
2014-08-22 20:50:48 +00:00
body :
2013-10-18 21:27:25 +00:00
'<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>' ,
2014-08-22 20:50:48 +00:00
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-07-12 21:21:20 +00:00
[ 'a' , [ ve . dm . example . bold ] ] ,
[
'b' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
htmlAttributes : [ { values : {
2013-07-12 21:21:20 +00:00
'data-parsoid' : '1'
} } ]
} ]
] ,
[ 'c' , [ ve . dm . example . bold ] ] ,
[
'd' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
htmlAttributes : [ { values : {
2013-07-12 21:21:20 +00:00
'data-parsoid' : '2'
} } ]
} ]
] ,
' ' ,
[ 'a' , [ ve . dm . example . bold ] ] ,
[ 'b' , [ ve . dm . example . bold ] ] ,
' ' ,
[
'a' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
htmlAttributes : [ { values : {
2013-07-12 21:21:20 +00:00
'data-parsoid' : '3'
} } ]
} ]
] ,
[
'b' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
htmlAttributes : [ { values : {
2013-07-12 21:21:20 +00:00
'data-parsoid' : '3'
} } ]
} ]
] ,
[
'c' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
htmlAttributes : [ { values : {
2013-07-12 21:21:20 +00:00
'data-parsoid' : '4'
} } ]
} ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-12 21:21:20 +00:00
] ,
2014-08-22 20:50:48 +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' : {
2014-08-22 20:50:48 +00:00
body : '<p>' + ve . dm . mwExample . MWInlineImage . html + '</p>' ,
data : [
{ type : 'paragraph' } ,
2013-10-15 16:50:01 +00:00
ve . dm . mwExample . MWInlineImage . data ,
2014-08-22 20:50:48 +00:00
{ type : '/mwInlineImage' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'mw:Transclusion (block level)' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ,
data : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . blockData ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionBlock' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . blockStoreItems
] ,
2014-08-22 20:50:48 +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)' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ,
data : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . blockData ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionBlock' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . blockStoreItems
] ,
2014-08-22 20:50:48 +00:00
modify : function ( data ) {
2014-08-20 20:36:12 +00:00
data [ 0 ] . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = 'Hello, globe!' ;
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . blockOpenModified
2013-06-26 21:18:39 +00:00
} ,
'mw:Transclusion (inline)' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . inlineData ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionInline' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . inlineStoreItems
] ,
2014-08-22 20:50:48 +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)' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . inlineData ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionInline' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . inlineStoreItems
] ,
2014-08-22 20:50:48 +00:00
modify : function ( data ) {
2014-08-20 20:36:12 +00:00
data [ 1 ] . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = '5,678' ;
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +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' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . pairOne + ve . dm . mwExample . MWTransclusion . pairTwo ,
data : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionBlock' ,
attributes : {
mw : {
parts : [
2014-08-20 20:36:12 +00:00
{
2014-08-22 20:50:48 +00:00
template : {
target : {
wt : 'echo' ,
href : './Template:Echo'
2014-08-20 20:36:12 +00:00
} ,
2014-08-22 20:50:48 +00:00
params : {
1 : {
wt : 'foo'
2014-08-20 20:36:12 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
i : 0
2014-08-20 20:36:12 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}' ,
originalDomElements : $ ( ve . dm . mwExample . MWTransclusion . pairOne ) . toArray ( ) ,
originalIndex : 0
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt1' ,
2014-08-20 20:36:12 +00:00
'data-mw' : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '1' ,
2014-08-22 20:50:48 +00:00
typeof : 'mw:Transclusion'
2013-06-26 21:18:39 +00:00
}
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionBlock' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionBlock' ,
attributes : {
mw : {
parts : [
2014-08-20 20:36:12 +00:00
{
2014-08-22 20:50:48 +00:00
template : {
target : {
wt : 'echo' ,
href : './Template:Echo'
2014-08-20 20:36:12 +00:00
} ,
2014-08-22 20:50:48 +00:00
params : {
1 : {
wt : 'foo'
2014-08-20 20:36:12 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
i : 0
2014-08-20 20:36:12 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}' ,
originalDomElements : $ ( ve . dm . mwExample . MWTransclusion . pairTwo ) . toArray ( ) ,
originalIndex : 0
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt2' ,
2014-08-20 20:36:12 +00:00
'data-mw' : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}' ,
2013-06-26 21:18:39 +00:00
'data-parsoid' : '2' ,
2014-08-22 20:50:48 +00:00
typeof : 'mw:Transclusion'
2013-06-26 21:18:39 +00:00
}
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionBlock' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
hash : '[{"mw":{"parts":[{"template":{"i":0,"params":{"1":{"wt":"foo"}},"target":{"href":"./Template:Echo","wt":"echo"}}}]},"type":"mwTransclusionBlock"},null]' ,
value : $ ( '<p about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}" data-parsoid="1">foo</p>' ) . toArray ( )
2013-06-26 21:18:39 +00:00
}
]
} ,
2013-07-23 13:35:26 +00:00
'mw:Transclusion containing only meta data' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . meta ,
data : [
2013-07-23 13:35:26 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwTransclusionMeta' ,
attributes : {
domElements : $ ( ve . dm . mwExample . MWTransclusion . meta ) . toArray ( )
2013-07-23 13:35:26 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwTransclusionMeta' } ,
{ type : 'paragraph' , internal : { generated : 'empty' } } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-23 13:35:26 +00:00
]
} ,
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>
2014-08-22 20:50:48 +00:00
body :
2013-10-18 21:27:25 +00:00
'<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>' +
2014-08-19 18:32:46 +00:00
ve . dm . mwExample . MWReference . referencesList ,
2014-08-22 20:50:48 +00:00
head : '<base href="http://example.com" />' ,
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
'F' , 'o' , 'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
listIndex : 0 ,
listGroup : 'mwReference/' ,
listKey : 'literal/bar' ,
refGroup : '' ,
mw : { name : 'ref' , attrs : { name : 'bar' } } ,
originalMw : '{"name":"ref","attrs":{"name":"bar"}}' ,
childDomElements : $ ( '<a href="#cite_note-bar-1">[1]</a>' ) . toArray ( ) ,
contentsUsed : false
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt1' ,
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' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-bar-1-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
children : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : '#cite_note-bar-1'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/#cite_note-bar-1'
2013-06-26 21:18:39 +00:00
}
}
]
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-06-26 21:18:39 +00:00
' ' , 'B' , 'a' , 'z' ,
{
2014-08-22 20:50:48 +00:00
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"}}' ,
childDomElements : [ ] ,
contentsUsed : true
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt2' ,
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' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-quux-2-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-06-26 21:18:39 +00:00
' ' , 'W' , 'h' , 'e' , 'e' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
listIndex : 0 ,
listGroup : 'mwReference/' ,
listKey : 'literal/bar' ,
refGroup : '' ,
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"}}' ,
childDomElements : [ ] ,
contentsUsed : true
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt3' ,
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' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-bar-1-1' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-06-26 21:18:39 +00:00
' ' , 'Y' , 'a' , 'y' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
listIndex : 2 ,
listGroup : 'mwReference/g1' ,
listKey : 'auto/0' ,
refGroup : 'g1' ,
mw : { name : 'ref' , body : { html : 'No name' } , attrs : { group : 'g1' } } ,
originalMw : '{"name":"ref","body":{"html":"No name"},"attrs":{"group":"g1"}}' ,
childDomElements : [ ] ,
contentsUsed : true
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt4' ,
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' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-1-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-06-30 08:43:56 +00:00
' ' , 'Q' , 'u' , 'u' , 'x' ,
{
2014-08-22 20:50:48 +00:00
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"}}' ,
childDomElements : [ ] ,
contentsUsed : false
2013-06-30 08:43:56 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-30 08:43:56 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt5' ,
class : 'reference' ,
2013-06-30 08:43:56 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Different content"},"attrs":{"name":"bar"}}' ,
'data-parsoid' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-bar-1-2' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
2013-07-25 17:11:50 +00:00
' ' , 'F' , 'o' , 'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
listGroup : 'mwReference/' ,
listIndex : 3 ,
listKey : 'literal/foo' ,
refGroup : '' ,
mw : { name : 'ref' , attrs : { name : 'foo' } } ,
originalMw : '{"name":"ref","attrs":{"name":"foo"}}' ,
childDomElements : [ ] ,
contentsUsed : false
2013-07-25 17:11:50 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-07-25 17:11:50 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt6' ,
class : 'reference' ,
2013-07-25 17:11:50 +00:00
'data-mw' : '{"name":"ref","attrs":{"name":"foo"}}' ,
'data-parsoid' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-foo-3-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
2013-06-30 08:43:56 +00:00
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
{ type : '/paragraph' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReferencesList' ,
attributes : {
mw : {
name : 'references' ,
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-07-25 17:11:50 +00:00
}
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +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 . referencesList ) . toArray ( ) ,
listGroup : 'mwReference/' ,
refGroup : ''
2013-06-26 21:18:39 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-07-25 17:11:50 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
childDomElements : $ ( '<a href="#cite_note-foo-3">[3]</a>' ) . toArray ( ) ,
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 3 ,
listKey : 'literal/foo' ,
mw : { name : 'ref' , attrs : { name : 'foo' } , body : { html : 'Ref in refs' } } ,
originalMw : '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}' ,
refGroup : ''
2013-07-25 17:11:50 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ {
children : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : '#cite_note-foo-3'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/#cite_note-foo-3'
2013-09-26 02:07:22 +00:00
}
}
] ,
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt8' ,
class : 'reference' ,
2013-07-25 17:11:50 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Ref in refs"},"attrs":{"name":"foo"}}' ,
2014-08-22 20:50:48 +00:00
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-07-25 17:11:50 +00:00
}
} ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
{ type : '/paragraph' } ,
{ type : '/mwReferencesList' } ,
{ type : 'internalList' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
[
'B' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'a' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'r' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
'Q' , 'u' , 'u' , 'x' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
'N' , 'o' , ' ' , 'n' , 'a' , 'm' , 'e' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : 'internalItem' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-07-25 17:11:50 +00:00
'R' , 'e' , 'f' , ' ' , 'i' , 'n' , ' ' , 'r' , 'e' , 'f' , 's' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'mw:Reference with metadata' : {
2014-08-22 20:50:48 +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>' ,
2014-08-22 20:50:48 +00:00
head : '<base href="http://example.com" />' ,
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwReference' ,
attributes : {
contentsUsed : true ,
listGroup : 'mwReference/' ,
listIndex : 0 ,
listKey : 'auto/0' ,
mw : {
attrs : { } ,
body : {
html : 'Foo<!-- bar -->'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
name : 'ref'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
originalMw : '{"name":"ref","body":{"html":"Foo<!-- bar -->"},"attrs":{}}' ,
childDomElements : $ ( '<a href="#cite_note-bar-1" data-parsoid="{}">[1]</a>' ) . toArray ( ) ,
refGroup : ''
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
about : '#mwt2' ,
class : 'reference' ,
2013-06-26 21:18:39 +00:00
'data-mw' : '{"name":"ref","body":{"html":"Foo<!-- bar -->"},"attrs":{}}' ,
'data-parsoid' : '{}' ,
2014-08-22 20:50:48 +00:00
id : 'cite_ref-1-0' ,
rel : 'dc:references' ,
typeof : 'mw:Extension/ref'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
children : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
2013-09-26 02:07:22 +00:00
'data-parsoid' : '{}' ,
2014-08-22 20:50:48 +00:00
href : '#cite_note-bar-1'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/#cite_note-bar-1'
2014-06-26 10:41:18 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
}
]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwReference' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : 'internalItem' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
internal : {
generated : 'wrapper'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
type : 'paragraph'
2013-06-26 21:18:39 +00:00
} ,
'F' , 'o' , 'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'comment' ,
attributes : {
text : ' bar '
2013-06-26 21:18:39 +00:00
}
} ,
2014-08-22 20:50:48 +00:00
{ type : '/comment' } ,
{ type : '/paragraph' } ,
{ type : '/internalItem' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'internal link with ./ and ../' : {
2014-08-22 20:50:48 +00:00
body : '<p><a rel="mw:WikiLink" href="./../../../Foo/Bar">Foo</a></p>' ,
head : '<base href="http://example.com/one/two/three/four/five" />' ,
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
[
'F' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Foo/Bar' ,
origTitle : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar' ,
hrefPrefix : './../../../'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './../../../Foo/Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/one/Foo/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'o' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Foo/Bar' ,
origTitle : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar' ,
hrefPrefix : './../../../'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './../../../Foo/Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/one/Foo/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'o' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Foo/Bar' ,
origTitle : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar' ,
hrefPrefix : './../../../'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './../../../Foo/Bar' ,
rel : 'mw:WikiLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/one/Foo/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
2014-01-06 13:56:55 +00:00
'internal link with absolute path' : {
2014-08-22 20:50:48 +00:00
body : '<p>' + ve . dm . mwExample . MWInternalLink . absoluteOpen + 'Foo</a></p>' ,
data : [
{ type : 'paragraph' } ,
2014-01-06 13:56:55 +00:00
[
'F' ,
[ ve . dm . mwExample . MWInternalLink . absoluteData ]
] ,
[
'o' ,
[ ve . dm . mwExample . MWInternalLink . absoluteData ]
] ,
[
'o' ,
[ ve . dm . mwExample . MWInternalLink . absoluteData ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2014-01-06 13:56:55 +00:00
] ,
2014-08-22 20:50:48 +00:00
normalizedBody : '<p><a rel="mw:WikiLink" href="Foo/Bar">Foo</a></p>' ,
mwConfig : {
wgArticlePath : '/wiki/$1'
2014-01-06 13:56:55 +00:00
}
} ,
2014-03-19 02:08:47 +00:00
'internal link with absolute path and section' : {
2014-08-22 20:50:48 +00:00
body : '<p>' + ve . dm . mwExample . MWInternalSectionLink . absoluteOpen + 'Foo</a></p>' ,
data : [
{ type : 'paragraph' } ,
2014-03-19 02:08:47 +00:00
[
'F' ,
[ ve . dm . mwExample . MWInternalSectionLink . absoluteData ]
] ,
[
'o' ,
[ ve . dm . mwExample . MWInternalSectionLink . absoluteData ]
] ,
[
'o' ,
[ ve . dm . mwExample . MWInternalSectionLink . absoluteData ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2014-03-19 02:08:47 +00:00
] ,
2014-08-22 20:50:48 +00:00
normalizedBody : '<p><a rel="mw:WikiLink" href="Foo#Bar">Foo</a></p>' ,
mwConfig : {
wgArticlePath : '/wiki/$1'
2014-03-19 02:08:47 +00:00
}
} ,
2013-10-17 20:15:36 +00:00
'numbered external link (empty mw:Extlink)' : {
2014-08-22 20:50:48 +00:00
body : '<p>Foo<a rel="mw:ExtLink" href="http://www.example.com"></a>Bar</p>' ,
data : [
{ type : 'paragraph' } ,
2013-10-17 20:15:36 +00:00
'F' , 'o' , 'o' ,
{
2014-08-22 20:50:48 +00:00
type : 'link/mwNumberedExternal' ,
attributes : {
href : 'http://www.example.com'
2013-10-17 20:15:36 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ {
values : {
href : 'http://www.example.com' ,
rel : 'mw:ExtLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +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
} ,
2014-08-22 20:50:48 +00:00
{ type : '/link/mwNumberedExternal' } ,
2013-10-17 20:15:36 +00:00
'B' , 'a' , 'r' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'URL link' : {
2014-08-22 20:50:48 +00:00
body : '<p><a rel="mw:ExtLink" href="http://www.mediawiki.org/">mw</a></p>' ,
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
[
'm' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwExternal' ,
attributes : {
href : 'http://www.mediawiki.org/' ,
rel : 'mw:ExtLink'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : 'http://www.mediawiki.org/' ,
rel : 'mw:ExtLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://www.mediawiki.org/'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'w' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwExternal' ,
attributes : {
href : 'http://www.mediawiki.org/' ,
rel : 'mw:ExtLink'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : 'http://www.mediawiki.org/' ,
rel : 'mw:ExtLink'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://www.mediawiki.org/'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'whitespace preservation with wrapped comments and language links' : {
2014-08-22 20:50:48 +00:00
body : 'Foo\n' +
2013-12-06 21:12:44 +00:00
'<link rel="mw:PageProp/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">' ,
2014-08-22 20:50:48 +00:00
data : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'paragraph' ,
internal : {
generated : 'wrapper' ,
whitespace : [ undefined , undefined , undefined , '\n' ]
2013-06-26 21:18:39 +00:00
}
} ,
'F' ,
'o' ,
'o' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwLanguage' ,
attributes : {
href : 'http://de.wikipedia.org/wiki/Foo'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : 'http://de.wikipedia.org/wiki/Foo' ,
rel : 'mw:PageProp/Language'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://de.wikipedia.org/wiki/Foo'
2013-09-26 02:07:22 +00:00
}
}
] ,
2014-08-22 20:50:48 +00:00
internal : { whitespace : [ '\n' , undefined , undefined , '\n' ] }
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwLanguage' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwLanguage' ,
attributes : {
href : 'http://fr.wikipedia.org/wiki/Foo'
2014-05-15 16:12:43 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : 'http://fr.wikipedia.org/wiki/Foo' ,
rel : 'mw:PageProp/Language'
2013-09-26 02:07:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://fr.wikipedia.org/wiki/Foo'
2013-09-26 02:07:22 +00:00
}
}
] ,
2014-08-22 20:50:48 +00:00
internal : { whitespace : [ '\n' ] }
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwLanguage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'document with meta elements' : {
2014-08-22 20:50:48 +00:00
body : '<!-- No content conversion --><meta property="mw:ThisIsAnAlien" /><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" />' ,
2014-08-22 20:50:48 +00:00
head : '<base href="http://example.com" />' ,
data : ve . dm . mwExample . withMeta
2013-06-26 21:18:39 +00:00
} ,
'RDFa types spread across two attributes, about grouping is forced' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWTransclusion . mixed ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . mixedDataOpen ,
ve . dm . mwExample . MWTransclusion . mixedDataClose ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
] ,
2014-08-22 20:50:48 +00:00
storeItems : [
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . MWTransclusion . mixedStoreItems
]
} ,
'mw:Entity' : {
2014-08-22 20:50:48 +00:00
body : '<p>a<span typeof="mw:Entity">¢</span>b<span typeof="mw:Entity">¥</span><span typeof="mw:Entity">™</span></p>' ,
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
'a' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '¢' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
'b' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '¥' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '™' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'wrapping with mw:Entity' : {
2014-08-22 20:50:48 +00:00
body : 'a<span typeof="mw:Entity">¢</span>b<span typeof="mw:Entity">¥</span><span typeof="mw:Entity">™</span>' ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-06-26 21:18:39 +00:00
'a' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '¢' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
'b' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '¥' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '™' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'whitespace preservation with mw:Entity' : {
2014-08-22 20:50:48 +00:00
body : '<p> a <span typeof="mw:Entity"> </span> b <span typeof="mw:Entity">¥</span>\t<span typeof="mw:Entity">™</span></p>' ,
data : [
{ type : 'paragraph' , internal : { whitespace : [ undefined , ' ' ] } } ,
2013-06-26 21:18:39 +00:00
'a' ,
' ' ,
' ' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : ' ' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
' ' ,
' ' ,
' ' ,
'b' ,
' ' ,
' ' ,
' ' ,
' ' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '¥' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
2013-06-26 21:18:39 +00:00
'\t' ,
{
2014-08-22 20:50:48 +00:00
type : 'mwEntity' ,
attributes : { character : '™' } ,
htmlAttributes : [ { values : { typeof : 'mw:Entity' } } ]
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwEntity' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'category default sort key' : {
2014-08-22 20:50:48 +00:00
body : '<meta property="mw:PageProp/categorydefaultsort" content="foo">' ,
data : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwDefaultSort' ,
attributes : {
content : 'foo'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ { values : {
content : 'foo' ,
property : 'mw:PageProp/categorydefaultsort'
2013-06-26 21:18:39 +00:00
} } ]
} ,
2014-08-22 20:50:48 +00:00
{ type : '/mwDefaultSort' } ,
{ type : 'paragraph' , internal : { generated : 'empty' } } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
} ,
'thumb image' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . MWBlockImage . html ,
data : ve . dm . mwExample . MWBlockImage . data . concat ( [
{ 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' : {
2014-08-22 20:50:48 +00:00
body :
2013-10-18 21:27:25 +00:00
'<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>' ,
2014-08-22 20:50:48 +00:00
head : '<base href="http://example.com" />' ,
data : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwBlockImage' ,
attributes : {
type : 'thumb' ,
align : 'default' ,
href : 'Foo' ,
src : 'Bar' ,
width : 1 ,
height : 2 ,
2014-10-28 11:46:40 +00:00
resource : 'FooBar'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [ {
values : { 'data-parsoid' : '{}' } ,
children : [
2013-06-26 21:18:39 +00:00
{
2014-08-22 20:50:48 +00:00
values : { 'data-parsoid' : '{}' } ,
children : [ {
values : { 'data-parsoid' : '{}' }
2013-06-26 21:18:39 +00:00
} ]
} ,
{
2014-08-22 20:50:48 +00:00
values : { 'data-parsoid' : '{}' } ,
children : [
{ values : { 'data-parsoid' : '{}' } }
2013-06-26 21:18:39 +00:00
]
}
2014-05-15 16:12:43 +00:00
]
2013-06-26 21:18:39 +00:00
} ]
} ,
2014-08-22 20:50:48 +00:00
{ type : 'mwImageCaption' , internal : { whitespace : [ undefined , ' ' ] } } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' , whitespace : [ ' ' ] } } ,
2013-06-26 21:18:39 +00:00
'f' , 'o' , 'o' , ' ' ,
[
'b' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink' ,
2013-09-26 02:07:22 +00:00
'data-parsoid' : '{}'
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'a' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink' ,
2013-09-26 02:07:22 +00:00
'data-parsoid' : '{}'
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
[
'r' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwInternal' ,
attributes : {
title : 'Bar' ,
origTitle : 'Bar' ,
normalizedTitle : 'Bar' ,
lookupTitle : 'Bar' ,
hrefPrefix : './'
2013-06-26 21:18:39 +00:00
} ,
2014-08-22 20:50:48 +00:00
htmlAttributes : [
2013-09-26 02:07:22 +00:00
{
2014-08-22 20:50:48 +00:00
values : {
href : './Bar' ,
rel : 'mw:WikiLink' ,
2013-09-26 02:07:22 +00:00
'data-parsoid' : '{}'
} ,
2014-08-22 20:50:48 +00:00
computed : {
href : 'http://example.com/Bar'
2013-09-26 02:07:22 +00:00
}
}
]
2013-06-26 21:18:39 +00:00
} ]
] ,
' ' , 'b' , 'a' , 'z' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-06-26 21:18:39 +00:00
]
2013-07-17 01:22:22 +00:00
} ,
'mw:Nowiki' : {
2014-08-22 20:50:48 +00:00
body : ve . dm . mwExample . mwNowikiHtml ,
data : ve . dm . mwExample . mwNowiki
2013-07-17 01:22:22 +00:00
} ,
'mw:Nowiki unwraps when text modified' : {
2014-08-22 20:50:48 +00:00
data : ve . dm . mwExample . mwNowiki ,
modify : function ( data ) {
2013-07-17 01:22:22 +00:00
data [ 7 ] [ 0 ] = 'z' ;
} ,
2014-08-22 20:50:48 +00:00
normalizedBody : '<p>Foo[[Bzr]]Baz</p>'
2013-07-17 01:22:22 +00:00
} ,
'mw:Nowiki unwraps when annotations modified' : {
2014-08-22 20:50:48 +00:00
data : ve . dm . mwExample . mwNowiki ,
modify : function ( data ) {
2013-07-17 01:22:22 +00:00
data [ 7 ] [ 1 ] . push ( ve . dm . example . bold ) ;
} ,
2014-08-22 20:50:48 +00:00
normalizedBody : '<p>Foo[[B<b>a</b>r]]Baz</p>'
2013-06-26 21:18:39 +00:00
}
} ;