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
*
2017-01-03 16:58:33 +00:00
* @ copyright 2011 - 2017 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:23:29 +00:00
'>' +
'</div>' ,
2015-02-17 00:36:52 +00:00
blockOpenFromData :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}"' +
'>' +
'</span>' ,
2015-02-23 02:40:58 +00:00
blockOpenClipboard :
'<div about="#mwt1" typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}"' +
' data-ve-no-generated-contents="true"' +
'>' +
' ' +
'</div>' ,
2015-02-17 00:36:52 +00:00
blockOpenFromDataModified :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, globe!"}},"i":0}}]}"' +
'>' +
'</span>' ,
2015-02-23 02:40:58 +00:00
blockOpenModifiedClipboard :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, globe!"}},"i":0}}]}"' +
' data-ve-no-generated-contents="true"' +
'>' +
' ' +
'</span>' ,
2014-08-22 20:50:48 +00:00
blockContent : '<p about="#mwt1" data-parsoid="{}">Hello, world!</p>' ,
2015-02-23 02:40:58 +00:00
blockContentClipboard : '<p about="#mwt1" data-parsoid="{}" data-ve-ignore="true">Hello, world!</p>' ,
2014-08-22 20:50:48 +00:00
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:23:29 +00:00
'>' ,
2015-02-17 00:36:52 +00:00
inlineOpenFromData :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}"' +
'>' ,
2015-02-23 02:40:58 +00:00
inlineOpenClipboard :
'<span about="#mwt1" typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}"' +
' data-ve-no-generated-contents="true"' +
'>' ,
2015-02-17 00:36:52 +00:00
inlineOpenFromDataModified :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
'>' ,
2015-02-23 02:40:58 +00:00
inlineOpenModifiedClipboard :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
' data-ve-no-generated-contents="true"' +
'>' +
' ' ,
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>' ,
2015-02-17 00:36:52 +00:00
mixedFromData :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
'></span>' ,
2015-02-23 02:40:58 +00:00
mixedClipboard :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}"' +
' data-ve-no-generated-contents="true"' +
'> </span>' +
'<span about="#mwt1" data-ve-ignore="true">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>' ,
2015-02-17 00:36:52 +00:00
pairFromData :
'<span typeof="mw:Transclusion"' +
' data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}"' +
'></span>' ,
2015-02-23 02:40:58 +00:00
pairClipboard :
'<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"' +
' data-ve-no-generated-contents="true"' +
'>foo</p>' ,
2015-03-12 17:30:28 +00:00
meta : '<link rel="mw:PageProp/Category" href="./Category:Page" about="#mwt1" typeof="mw:Transclusion"' +
' 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>' +
2015-03-12 17:30:28 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Book" about="#mwt1">' ,
metaFromData :
'<span typeof=\"mw:Transclusion\"' +
' data-mw=\"{"parts":[{"template":{"target":{"wt":"Template:Echo","href":"./Template:Echo"},"params":{"1":{"wt":"' +
'[[Category:Page]]\\n[[Category:Book]]"}},"i":0}}]}\"></span>' ,
metaClipboard :
'<span typeof=\"mw:Transclusion\"' +
' data-mw=\"{"parts":[{"template":{"target":{"wt":"Template:Echo","href":"./Template:Echo"},"params":{"1":{"wt":"' +
'[[Category:Page]]\\n[[Category:Book]]"}},"i":0}}]}\"' +
' data-ve-no-generated-contents=\"true\"> </span>'
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
} ,
2015-10-02 10:39:40 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"Hello, world!"}},"i":0}}]}'
2015-02-17 00:36:52 +00:00
}
2013-06-26 21:18:39 +00:00
} ;
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
} ,
2015-10-02 10:39:40 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"1,234"}},"i":0}}]}'
2015-02-17 00:36:52 +00:00
}
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
} ,
2015-10-02 10:39:40 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"Inline","href":"./Template:Inline"},"params":{"1":{"wt":"5,678"}},"i":0}}]}'
2015-02-17 00:36:52 +00:00
}
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 ] ) ;
2016-08-17 19:50:55 +00:00
ve . dm . mwExample . MWTransclusion . blockStoreItems = { } ;
ve . dm . mwExample . MWTransclusion . blockStoreItems [ ve . dm . IndexValueStore . prototype . indexOfValue ( null , ve . dm . mwExample . MWTransclusion . blockParamsHash ) ] =
$ ( 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 ] ) ;
2016-08-17 19:50:55 +00:00
ve . dm . mwExample . MWTransclusion . inlineStoreItems = { } ;
ve . dm . mwExample . MWTransclusion . inlineStoreItems [ ve . dm . IndexValueStore . prototype . indexOfValue ( null , ve . dm . mwExample . MWTransclusion . inlineParamsHash ) ] =
$ ( 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 ] ) ;
2016-08-17 19:50:55 +00:00
ve . dm . mwExample . MWTransclusion . mixedStoreItems = { } ;
ve . dm . mwExample . MWTransclusion . mixedStoreItems [ ve . dm . IndexValueStore . prototype . indexOfValue ( null , ve . dm . mwExample . MWTransclusion . mixedParamsHash ) ] =
$ ( 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 : ''
2015-02-17 00:36:52 +00:00
}
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 : ''
2015-02-17 00:36:52 +00:00
}
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">' +
2016-01-07 01:06:44 +00:00
'<a href="Foo"><img src="' + ve . ce . minImgDataUri + '" width="1" height="2" resource="FooBar"></a>' +
2013-10-05 10:27:39 +00:00
'<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' ,
2016-01-07 01:06:44 +00:00
src : ve . ce . minImgDataUri ,
2014-08-22 20:50:48 +00:00
width : 1 ,
height : 2 ,
resource : 'FooBar' ,
originalClasses : 'mw-halign-right foobar' ,
2015-07-22 22:13:09 +00:00
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : {
heedc6ea02e1424e1 : ve . ce . minImgDataUri
}
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' ,
2015-07-22 22:13:09 +00:00
unrecognizedClasses : [ 'foo' ]
2014-05-15 16:12:43 +00:00
}
2013-10-15 12:18:11 +00:00
} ,
2016-08-17 19:50:55 +00:00
storeItems : {
h9e4c46abce8374a6 : 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
}
2013-10-15 16:50:01 +00:00
} ;
2013-10-05 10:27:39 +00:00
2013-07-17 01:22:22 +00:00
ve . dm . mwExample . mwNowikiAnnotation = {
2015-02-17 00:36:52 +00:00
type : 'mwNowiki'
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>' ;
2015-02-17 00:36:52 +00:00
ve . dm . mwExample . mwNowikiHtmlFromData = '<body><p>Foo[[Bar]]Baz</p></body>' ;
2013-07-03 01:30:10 +00:00
ve . dm . mwExample . withMeta = [
{
2015-02-21 21:18:24 +00:00
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{
type : 'comment' ,
2014-08-22 20:50:48 +00:00
attributes : {
text : ' No content conversion '
2013-07-03 01:30:10 +00:00
}
} ,
2015-02-21 21:18:24 +00:00
{ type : '/comment' } ,
{ type : '/paragraph' } ,
2013-07-03 01:30:10 +00:00
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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 : ''
2015-02-17 00:36:52 +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' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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
{
2015-02-21 21:18:24 +00:00
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{
type : 'comment' ,
2014-08-22 20:50:48 +00:00
attributes : {
text : 'barbaz'
2013-07-03 01:30:10 +00:00
}
} ,
2015-02-21 21:18:24 +00:00
{ type : '/comment' } ,
{ type : '/paragraph' } ,
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'
2015-02-17 00:36:52 +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' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<!-- No content conversion -->' ) . toArray ( )
2013-07-03 01:30:10 +00:00
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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 : ''
2015-02-17 00:36:52 +00:00
}
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<!-- inline -->' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<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'
2015-02-17 00:36:52 +00:00
}
2013-07-03 01:30:10 +00:00
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2015-03-16 15:22:14 +00:00
originalDomElements : $ ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' ) . toArray ( )
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
undefined
] ;
2013-06-26 21:18:39 +00:00
ve . dm . mwExample . domToDataCases = {
2015-11-20 00:08:32 +00:00
'adjacent annotations (data-parsoid)' : {
preserveAnnotationDomElements : true ,
body : '<b>a</b><b data-parsoid="1">b</b><b data-parsoid="2">c</b> ' +
'<b>d</b><b>d</b>' ,
2014-08-22 20:50:48 +00:00
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
2013-07-12 21:21:20 +00:00
[
2015-11-20 00:08:32 +00:00
'a' ,
2013-07-12 21:21:20 +00:00
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
2015-11-20 00:08:32 +00:00
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
2013-07-12 21:21:20 +00:00
} ]
] ,
[
2015-11-20 00:08:32 +00:00
'b' ,
2013-07-12 21:21:20 +00:00
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
2015-11-20 00:08:32 +00:00
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b data-parsoid="1">b</b>' ) . toArray ( )
2013-07-12 21:21:20 +00:00
} ]
] ,
[
2015-11-20 00:08:32 +00:00
'c' ,
2013-07-12 21:21:20 +00:00
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
2015-11-20 00:08:32 +00:00
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b data-parsoid="2">c</b>' ) . toArray ( )
2013-07-12 21:21:20 +00:00
} ]
] ,
2015-11-20 00:08:32 +00:00
' ' ,
2013-07-12 21:21:20 +00:00
[
2015-11-20 00:08:32 +00:00
'd' ,
2013-07-12 21:21:20 +00:00
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
2015-11-20 00:08:32 +00:00
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
2013-07-12 21:21:20 +00:00
} ]
] ,
[
2015-11-20 00:08:32 +00:00
'd' ,
2013-07-12 21:21:20 +00:00
[ {
2014-08-22 20:50:48 +00:00
type : 'textStyle/bold' ,
2015-11-20 00:08:32 +00:00
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
2013-07-12 21:21:20 +00:00
} ]
] ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-12 21:21:20 +00:00
] ,
2015-11-20 00:08:32 +00:00
modify : function ( model ) {
var data = [ 'x' , [ ve . dm . example . bold ] ] ,
linearData = ve . dm . example . preprocessAnnotations ( [ data ] , model . getStore ( ) ) ;
model . data . data . splice ( 3 , 0 , linearData . data [ 0 ] ) ;
} ,
normalizedBody : '<b>a</b><b data-parsoid="1">bx</b><b data-parsoid="2">c</b> ' +
'<b>dd</b>' ,
fromDataBody : '<b>a</b><b data-parsoid="1">bx</b><b data-parsoid="2">c</b> ' +
'<b>dd</b>'
2013-07-12 21:21:20 +00:00
} ,
2015-11-20 19:42:54 +00:00
'adjacent annotations (Parsoid IDs)' : {
2015-11-20 00:33:02 +00:00
preserveAnnotationDomElements : true ,
body : '<b>a</b><b id="mwAB">b</b><b id="mwCD">c</b> ' +
'<b>d</b><b>d</b>' ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
[
'a' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
} ]
] ,
[
'b' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b id="mwAB">b</b>' ) . toArray ( )
} ]
] ,
[
'c' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b id="mwCD">c</b>' ) . toArray ( )
} ]
] ,
' ' ,
[
'd' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
} ]
] ,
[
'd' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
originalDomElements : $ ( '<b>a</b>' ) . toArray ( )
} ]
] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
modify : function ( model ) {
var data = [ 'x' , [ ve . dm . example . bold ] ] ,
linearData = ve . dm . example . preprocessAnnotations ( [ data ] , model . getStore ( ) ) ;
model . data . data . splice ( 3 , 0 , linearData . data [ 0 ] ) ;
} ,
normalizedBody : '<b>a</b><b id="mwAB">bx</b><b id="mwCD">c</b> ' +
'<b>dd</b>' ,
fromDataBody : '<b>a</b><b id="mwAB">bx</b><b id="mwCD">c</b> ' +
'<b>dd</b>'
} ,
2015-02-17 13:03:59 +00:00
mwImage : {
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' }
2016-08-17 19:50:55 +00:00
] ,
storeItems : ve . dm . mwExample . MWInlineImage . storeItems
2013-06-26 21:18:39 +00:00
} ,
2015-02-17 13:03:59 +00:00
'mwHeading and mwPreformatted nodes' : {
body : '<h2>Foo</h2><pre>Bar</pre>' ,
data : [
{
type : 'mwHeading' ,
attributes : {
level : 2
}
} ,
'F' , 'o' , 'o' ,
{ type : '/mwHeading' } ,
{ type : 'mwPreformatted' } ,
'B' , 'a' , 'r' ,
{ type : '/mwPreformatted' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
2015-02-17 13:05:24 +00:00
'mwTable with duplicate class attributes' : {
body : '<table class="wikitable sortable wikitable"><tr><td>Foo</td></tr></table>' ,
2015-02-17 13:03:59 +00:00
data : [
{
type : 'mwTable' ,
attributes : {
wikitable : true ,
sortable : true ,
2015-02-17 13:05:24 +00:00
originalClasses : 'wikitable sortable wikitable' ,
2015-02-17 13:03:59 +00:00
unrecognizedClasses : [ ]
2015-02-17 00:36:52 +00:00
}
2015-02-17 13:03:59 +00:00
} ,
{ type : 'tableSection' , attributes : { style : 'body' } } ,
{ type : 'tableRow' } ,
{ type : 'tableCell' , attributes : { style : 'data' } } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
'F' , 'o' , 'o' ,
{ type : '/paragraph' } ,
{ type : '/tableCell' } ,
{ type : '/tableRow' } ,
{ type : '/tableSection' } ,
{ type : '/mwTable' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2016-06-30 12:31:04 +00:00
] ,
modify : function ( model ) {
model . data . data [ 0 ] . attributes . wikitable = false ;
model . data . data [ 0 ] . attributes . sortable = false ;
} ,
normalizedBody : '<table><tr><td>Foo</td></tr></table>'
2015-02-17 13:03:59 +00:00
} ,
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . blockStoreItems ,
2015-02-17 00:36:52 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . blockOpenFromData ,
clipboardBody : ve . dm . mwExample . MWTransclusion . blockOpenClipboard + ve . dm . mwExample . MWTransclusion . blockContentClipboard
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . blockStoreItems ,
2015-02-14 01:44:23 +00:00
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 0 ] . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = 'Hello, globe!' ;
2013-06-26 21:18:39 +00:00
} ,
2015-02-17 00:36:52 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . blockOpenModified ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . blockOpenFromDataModified ,
clipboardBody : ve . dm . mwExample . MWTransclusion . blockOpenModifiedClipboard
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . inlineStoreItems ,
2015-02-17 00:36:52 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . inlineOpenFromData + ve . dm . mwExample . MWTransclusion . inlineClose ,
clipboardBody : ve . dm . mwExample . MWTransclusion . inlineOpenClipboard + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . inlineStoreItems ,
2015-02-14 01:44:23 +00:00
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 1 ] . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = '5,678' ;
2013-06-26 21:18:39 +00:00
} ,
2015-02-17 00:36:52 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . inlineOpenModified + ve . dm . mwExample . MWTransclusion . inlineClose ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . inlineOpenFromDataModified + ve . dm . mwExample . MWTransclusion . inlineClose ,
clipboardBody : ve . dm . mwExample . MWTransclusion . inlineOpenModifiedClipboard + 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 ,
2015-02-17 00:36:52 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . pairFromData + ve . dm . mwExample . MWTransclusion . pairFromData ,
2015-02-23 02:40:58 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . pairClipboard + ve . dm . mwExample . MWTransclusion . pairClipboard ,
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 : '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
} ,
2015-10-02 10:39:40 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'
2015-02-17 00:36:52 +00:00
}
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
} ,
2015-10-02 10:39:40 +00:00
originalMw : '{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'
2015-02-17 00:36:52 +00:00
}
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : {
hd2ff771ac84b229d : $ ( '<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 ,
2015-03-12 17:30:28 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . metaFromData ,
clipboardBody : ve . dm . mwExample . MWTransclusion . metaClipboard ,
2014-08-22 20:50:48 +00:00
data : [
2013-07-23 13:35:26 +00:00
{
2015-03-12 17:30:28 +00:00
internal : { generated : 'wrapper' } ,
type : 'paragraph'
} ,
{
type : 'mwTransclusionInline' ,
2014-08-22 20:50:48 +00:00
attributes : {
2015-03-12 17:30:28 +00:00
mw : {
parts : [ {
template : {
target : {
wt : 'Template:Echo' ,
href : './Template:Echo'
} ,
params : {
1 : { wt : '[[Category:Page]]\n[[Category:Book]]' }
} ,
i : 0
}
} ]
} ,
originalMw : '{\"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
}
} ,
2015-03-12 17:30:28 +00:00
{ type : '/mwTransclusionInline' } ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
2013-07-23 13:35:26 +00:00
]
} ,
2015-06-16 12:51:35 +00:00
'mw:Transclusion which is also a language annotation' : {
body : '<span dir="ltr" about="#mwt1" typeof="mw:Transclusion" data-mw="{}">content</span>' ,
data : [
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
{
type : 'mwTransclusionInline' ,
attributes : {
mw : { } ,
originalMw : '{}'
} ,
originalDomElements : $ ( '<span dir="ltr" about="#mwt1" typeof="mw:Transclusion" data-mw="{}">content</span>' ) . toArray ( )
} ,
{ type : '/mwTransclusionInline' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
clipboardBody : '<span dir="ltr" about="#mwt1" typeof="mw:Transclusion" data-mw="{}" data-ve-no-generated-contents="true">content</span>'
} ,
2015-03-23 15:49:38 +00:00
'mw:AlienBlockExtension' : {
2015-03-23 12:49:37 +00:00
body :
'<div about="#mwt1" typeof="mw:Extension/syntaxhighlight"' +
' data-mw="{"name":"syntaxhighlight","attrs":{"lang":"php"},"body":{"extsrc":"\\n$foo = bar;\\n"}}"' +
' data-parsoid="1"' +
'>' +
'<div><span>Rendering</span></div>' +
'</div>' ,
normalizedBody :
'<div typeof="mw:Extension/syntaxhighlight"' +
' data-mw="{"name":"syntaxhighlight","attrs":{"lang":"php5"},"body":{"extsrc":"\\n$foo = bar;\\n"}}"' +
' about="#mwt1" data-parsoid="1"' +
'>' +
'</div>' ,
data : [
{
2015-03-23 15:49:38 +00:00
type : 'mwAlienBlockExtension' ,
2015-03-23 12:49:37 +00:00
attributes : {
mw : {
name : 'syntaxhighlight' ,
attrs : {
lang : 'php'
} ,
body : {
extsrc : '\n$foo = bar;\n'
}
} ,
originalMw : '{"name":"syntaxhighlight","attrs":{"lang":"php"},"body":{"extsrc":"\\n$foo = bar;\\n"}}'
} ,
originalDomElements : $ ( '<div about="#mwt1" data-parsoid="1"></div>' ) . toArray ( )
} ,
2015-03-23 15:49:38 +00:00
{ type : '/mwAlienBlockExtension' } ,
2015-03-23 12:49:37 +00:00
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 0 ] . attributes . mw . attrs . lang = 'php5' ;
2015-03-23 12:49:37 +00:00
}
} ,
2015-03-23 15:49:38 +00:00
'mw:AlienInlineExtension' : {
body :
'<p>' +
2016-01-07 01:06:44 +00:00
'<img src="' + ve . ce . minImgDataUri + '" width="100" height="20" alt="Bar" typeof="mw:Extension/score"' +
2015-03-23 15:49:38 +00:00
' data-mw="{"name":"score","attrs":{},"body":{"extsrc":"\\\\relative c' { e d c d e e e }"}}" ' +
' data-parsoid="1" about="#mwt1" />' +
'</p>' ,
normalizedBody :
'<p>' +
'<span typeof="mw:Extension/score"' +
' data-mw="{"name":"score","attrs":{},"body":{"extsrc":"\\\\relative c' { d d d e e e }"}}" ' +
2016-01-07 01:06:44 +00:00
' src="' + ve . ce . minImgDataUri + '" width="100" height="20" alt="Bar" data-parsoid="1" about="#mwt1" />' +
2015-03-23 15:49:38 +00:00
'</p>' ,
data : [
{ type : 'paragraph' } ,
{
type : 'mwAlienInlineExtension' ,
attributes : {
mw : {
name : 'score' ,
attrs : { } ,
body : {
extsrc : '\\relative c\' { e d c d e e e }'
}
} ,
originalMw : '{"name":"score","attrs":{},"body":{"extsrc":"\\\\relative c\' { e d c d e e e }"}}'
} ,
2016-01-07 01:06:44 +00:00
originalDomElements : $ ( '<img src="' + ve . ce . minImgDataUri + '" width="100" height="20" alt="Bar" about="#mwt1" data-parsoid="1"></img>' ) . toArray ( )
2015-03-23 15:49:38 +00:00
} ,
{ type : '/mwAlienInlineExtension' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 1 ] . attributes . mw . body . extsrc = '\\relative c\' { d d d e e e }' ;
2015-03-23 15:49:38 +00:00
}
} ,
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 : './../../../'
2015-02-17 00:36:52 +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 : './../../../'
2015-02-17 00:36:52 +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 : './../../../'
2015-02-17 00:36:52 +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
}
} ,
2015-01-31 02:43:09 +00:00
'internal link with href set to ./' : {
2015-04-16 20:46:49 +00:00
body : '<p><a rel="mw:WikiLink" href="./">x</a></p>' ,
2015-01-31 02:43:09 +00:00
head : '<base href="http://example.com" />' ,
data : [
{ type : 'paragraph' } ,
[
2015-04-16 20:46:49 +00:00
'x' ,
2015-01-31 02:43:09 +00:00
[ {
type : 'link/mwInternal' ,
attributes : {
title : '' ,
origTitle : '' ,
normalizedTitle : '' ,
lookupTitle : '' ,
hrefPrefix : './'
2015-02-17 00:36:52 +00:00
}
2015-01-31 02:43:09 +00:00
} ]
] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
2016-09-18 22:22:09 +00:00
'internal link with special characters' : {
body : '<p><a rel="mw:WikiLink" href="./Foo%3F+%25&Bar">x</a></p>' ,
head : '<base href="http://example.com" />' ,
data : [
{ type : 'paragraph' } ,
[
'x' ,
[ {
type : 'link/mwInternal' ,
attributes : {
title : 'Foo?+%&Bar' ,
origTitle : 'Foo%3F+%25&Bar' ,
normalizedTitle : 'Foo?+%&Bar' ,
lookupTitle : 'Foo?+%&Bar' ,
hrefPrefix : './'
}
} ]
] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
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'
2015-02-17 00:36:52 +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' }
2016-06-27 14:19:53 +00:00
] ,
clipboardBody : '<p>Foo<a rel="mw:ExtLink" href="http://www.example.com">[1]</a>Bar</p>'
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'
2015-02-17 00:36:52 +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'
2015-02-17 00:36:52 +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
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
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" />' ,
2015-08-17 19:46:21 +00:00
clipboardBody : '<span rel="ve:Comment" data-ve-comment=" No content conversion "> </span><meta property="mw:ThisIsAnAlien" /><p>Foo' +
2015-02-23 02:40:58 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Bar" />Bar' +
2015-08-17 19:46:21 +00:00
'<meta property="mw:foo" content="bar" />Ba<span rel="ve:Comment" data-ve-comment=" inline "> </span>z</p>' +
'<meta property="mw:bar" content="baz" /><span rel="ve:Comment" data-ve-comment="barbaz"> </span>' +
2015-02-23 02:40:58 +00:00
'<link rel="mw:PageProp/Category" href="./Category:Foo_foo#Bar baz%23quux" />' +
'<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 ,
2015-02-17 00:36:52 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . mixedFromData ,
2015-02-23 02:40:58 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . mixedClipboard ,
2014-08-22 20:50:48 +00:00
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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . mixedStoreItems
2013-06-26 21:18:39 +00:00
} ,
'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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '¢' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '¥' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '™' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '¢' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '¥' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '™' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : ' ' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '¥' }
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' ,
2015-02-17 00:36:52 +00:00
attributes : { character : '™' }
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'
2015-02-17 00:36:52 +00:00
}
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' }
2016-08-17 19:50:55 +00:00
] ) ,
storeItems : ve . dm . mwExample . MWBlockImage . storeItems
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="{}">' +
2016-01-07 01:06:44 +00:00
'<img src="' + ve . ce . minImgDataUri + '" width="1" height="2" resource="FooBar" data-parsoid="{}">' +
2013-10-18 21:27:25 +00:00
'</a>' +
'<figcaption data-parsoid="{}">' +
' foo <a rel="mw:WikiLink" href="./Bar" data-parsoid="{}">bar</a> baz' +
'</figcaption>' +
'</figure>' ,
2015-02-17 00:36:52 +00:00
fromDataBody :
'<figure typeof="mw:Image/Thumb">' +
'<a href="Foo">' +
2016-01-07 01:06:44 +00:00
'<img src="' + ve . ce . minImgDataUri + '" width="1" height="2" resource="FooBar">' +
2015-02-17 00:36:52 +00:00
'</a>' +
'<figcaption>' +
' foo <a rel="mw:WikiLink" href="./Bar">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' ,
2016-01-07 01:06:44 +00:00
src : ve . ce . minImgDataUri ,
2014-08-22 20:50:48 +00:00
width : 1 ,
height : 2 ,
2014-10-28 11:46:40 +00:00
resource : 'FooBar'
2015-02-17 00:36:52 +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 : './'
2015-02-17 00:36:52 +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 : './'
2015-02-17 00:36:52 +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 : './'
2015-02-17 00:36:52 +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 ,
2015-02-17 00:36:52 +00:00
data : ve . dm . mwExample . mwNowiki ,
fromDataBody : ve . dm . mwExample . mwNowikiHtmlFromData
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 ,
2015-02-14 01:44:23 +00:00
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 7 ] [ 0 ] = 'z' ;
2013-07-17 01:22:22 +00:00
} ,
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 ,
2015-02-14 01:44:23 +00:00
modify : function ( model ) {
2015-08-19 17:33:02 +00:00
model . data . data [ 7 ] [ 1 ] . push ( model . getStore ( ) . index ( ve . dm . example . createAnnotation ( ve . dm . example . bold ) ) ) ;
2013-07-17 01:22:22 +00:00
} ,
2014-08-22 20:50:48 +00:00
normalizedBody : '<p>Foo[[B<b>a</b>r]]Baz</p>'
2015-08-03 22:48:42 +00:00
} ,
'mwHeading with no content' : {
data : [
{ type : 'mwHeading' , attributes : { level : 1 } } ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
normalizedBody : '<p></p>'
} ,
'mwHeading with whitespace content' : {
data : [
{ type : 'mwHeading' , attributes : { level : 2 } } ,
' ' , ' ' , '\t' , ' ' ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
normalizedBody : '<p> \t </p>'
} ,
'mwHeading containing metadata' : {
data : [
{ type : 'mwHeading' , attributes : { level : 3 } } ,
{ type : 'alienMeta' , originalDomElements : $ ( '<meta />' ) . toArray ( ) } ,
{ type : '/alienMeta' } ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
normalizedBody : '<p><meta /></p>'
} ,
'mwHeading containing alienated text' : {
data : [
{
type : 'mwHeading' ,
attributes : { level : 4 }
} ,
{ type : 'alienInline' , originalDomElements : $ ( '<span rel="ve:Alien">Alien</span>' ) . toArray ( ) } ,
{ type : '/alienInline' } ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
body : '<h4><span rel="ve:Alien">Alien</span></h4>'
} ,
'existing empty mwHeading is not converted to paragraph' : {
data : [
{
type : 'mwHeading' ,
attributes : {
level : 5 ,
noconvert : true
}
} ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
body : '<h5></h5>'
} ,
'adding whitespace to existing empty mwHeading does not convert to paragraph' : {
data : [
{
type : 'mwHeading' ,
attributes : {
level : 6 ,
noconvert : true
}
} ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
modify : function ( doc ) {
doc . data . data . splice ( 1 , 0 , ' ' ) ;
} ,
body : '<h6></h6>' ,
normalizedBody : '<h6> </h6>'
} ,
'emptying existing meta-only mwHeading does not convert to paragraph' : {
data : [
{
type : 'mwHeading' ,
attributes : {
level : 1 ,
noconvert : true
}
} ,
{ type : 'alienMeta' , originalDomElements : $ ( '<meta />' ) . toArray ( ) } ,
{ type : '/alienMeta' } ,
{ type : '/mwHeading' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
modify : function ( doc ) {
2015-08-19 17:33:02 +00:00
doc . metadata . data [ 1 ] . splice ( 0 , 1 ) ;
2015-08-03 22:48:42 +00:00
} ,
normalizedBody : '<h1></h1>'
2016-03-17 15:30:59 +00:00
} ,
2016-03-17 18:35:22 +00:00
'Plain external links (e.g. on paste) are converted to link/mwExternal' : {
body : '<a href="http://www.mediawiki.org/">ab</a>' ,
2016-03-17 15:30:59 +00:00
data : [
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
2016-03-17 18:35:22 +00:00
[
'a' ,
[ {
type : 'link/mwExternal' ,
attributes : {
href : 'http://www.mediawiki.org/'
}
} ]
] ,
2016-03-17 15:30:59 +00:00
[
'b' ,
[ {
type : 'link/mwExternal' ,
attributes : {
2016-03-17 18:35:22 +00:00
href : 'http://www.mediawiki.org/'
2016-03-17 15:30:59 +00:00
}
} ]
] ,
2016-03-17 18:35:22 +00:00
{
type : '/paragraph'
} ,
{
type : 'internalList'
} ,
{
type : '/internalList'
}
] ,
normalizedBody : '<a href="http://www.mediawiki.org/" rel="mw:ExtLink">ab</a>'
} ,
'Plain internal links (e.g. on paste) are converted to link/mwInternal' : {
body : '<a href="' + ve . dm . mwExample . MWInternalLink . absoluteHref + '">ab</a>' ,
data : [
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
2016-03-17 15:30:59 +00:00
[
'a' ,
[ {
2016-03-17 18:35:22 +00:00
type : 'link/mwInternal' ,
2016-03-17 15:30:59 +00:00
attributes : {
2016-03-17 18:35:22 +00:00
title : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar'
2016-03-17 15:30:59 +00:00
}
} ]
] ,
[
2016-03-17 18:35:22 +00:00
'b' ,
2016-03-17 15:30:59 +00:00
[ {
2016-03-17 18:35:22 +00:00
type : 'link/mwInternal' ,
2016-03-17 15:30:59 +00:00
attributes : {
2016-03-17 18:35:22 +00:00
title : 'Foo/Bar' ,
normalizedTitle : 'Foo/Bar' ,
lookupTitle : 'Foo/Bar'
2016-03-17 15:30:59 +00:00
}
} ]
] ,
{
type : '/paragraph'
} ,
{
type : 'internalList'
} ,
{
type : '/internalList'
}
] ,
2016-03-17 18:35:22 +00:00
normalizedBody : '<a href="Foo/Bar" rel="mw:WikiLink">ab</a>' ,
mwConfig : {
wgArticlePath : '/wiki/$1'
}
2013-06-26 21:18:39 +00:00
}
} ;