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
*
2020-01-08 17:13:04 +00:00
* @ copyright 2011 - 2020 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 = { } ;
2021-04-30 09:33:22 +00:00
ve . dm . mwExample . createExampleDocument = ( name , store ) =>
ve . dm . example . createExampleDocumentFromObject ( name , store , ve . dm . mwExample ) ;
2013-07-03 01:30:10 +00:00
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 :
2017-07-18 11:55:33 +00:00
'<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>' ,
2015-03-12 17:30:28 +00:00
metaClipboard :
2017-07-18 11:55:33 +00:00
'<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 = { } ;
2018-03-06 12:44:37 +00:00
ve . dm . mwExample . MWTransclusion . blockStoreItems [ ve . dm . HashValueStore . prototype . hashOfValue ( null , ve . dm . mwExample . MWTransclusion . blockParamsHash ) ] =
2022-03-08 23:48:22 +00:00
$ . parseHTML ( ve . dm . mwExample . MWTransclusion . blockOpen + ve . dm . mwExample . MWTransclusion . blockContent ) ;
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 = { } ;
2018-03-06 12:44:37 +00:00
ve . dm . mwExample . MWTransclusion . inlineStoreItems [ ve . dm . HashValueStore . prototype . hashOfValue ( null , ve . dm . mwExample . MWTransclusion . inlineParamsHash ) ] =
2022-03-08 23:48:22 +00:00
$ . parseHTML ( ve . dm . mwExample . MWTransclusion . inlineOpen + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ) ;
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 = { } ;
2018-03-06 12:44:37 +00:00
ve . dm . mwExample . MWTransclusion . mixedStoreItems [ ve . dm . HashValueStore . prototype . hashOfValue ( null , ve . dm . mwExample . MWTransclusion . mixedParamsHash ) ] =
2022-03-08 23:48:22 +00:00
$ . parseHTML ( ve . dm . mwExample . MWTransclusion . mixed ) ;
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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Foo/Bar'
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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Foo'
2015-02-17 00:36:52 +00:00
}
2014-03-19 02:08:47 +00:00
} ;
2019-09-24 16:25:03 +00:00
ve . dm . mwExample . MWMediaLinkExistsData = {
type : 'link/mwInternal' ,
attributes : {
lookupTitle : 'Media:Exists.png' ,
normalizedTitle : 'Media:Exists.png' ,
origTitle : 'Media:Exists.png' ,
title : 'Media:Exists.png'
}
} ;
ve . dm . mwExample . MWMediaLinkMissingData = {
type : 'link/mwInternal' ,
attributes : {
lookupTitle : 'Media:Missing.png' ,
normalizedTitle : 'Media:Missing.png' ,
origTitle : 'Media:Missing.png' ,
title : 'Media:Missing.png'
}
} ;
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">' +
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
'<a href="./Foo"><img src="' + ve . ce . minImgDataUri + '" width="1" height="2" resource="./FooBar" alt="alt text"></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' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2017-04-27 18:08:35 +00:00
mediaClass : 'Image' ,
2016-01-07 01:06:44 +00:00
src : ve . ce . minImgDataUri ,
2014-08-22 20:50:48 +00:00
width : 1 ,
height : 2 ,
2019-03-28 16:23:50 +00:00
alt : 'alt text' ,
2018-06-05 11:41:09 +00:00
isError : false ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './FooBar' ,
2018-06-26 12:02:19 +00:00
mw : { } ,
2014-08-22 20:50:48 +00:00
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 : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
h1d9b405cfd633576 : ve . ce . minImgDataUri
2016-08-17 19:50:55 +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 :
2020-11-18 16:51:03 +00:00
'<span typeof="mw:Image" class="foo mw-valign-text-top">' +
2013-10-15 16:50:01 +00:00
'<a href="./File:Wiki.png">' +
2019-03-28 16:23:50 +00:00
'<img resource="./File:Wiki.png" src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" height="155" width="135" alt="alt text">' +
2013-10-15 16:50:01 +00:00
'</a>' +
2020-11-18 16:51:03 +00:00
'</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' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2017-04-27 18:08:35 +00:00
mediaClass : 'Image' ,
2014-08-22 20:50:48 +00:00
width : 135 ,
height : 155 ,
2019-03-28 16:23:50 +00:00
alt : 'alt text' ,
2018-06-05 11:41:09 +00:00
isError : false ,
2014-08-22 20:50:48 +00:00
valign : 'text-top' ,
resource : './File:Wiki.png' ,
2018-06-26 12:02:19 +00:00
mw : { } ,
2014-08-22 20:50:48 +00:00
type : 'none' ,
originalClasses : 'foo mw-valign-text-top' ,
2020-12-10 22:25:59 +00:00
unrecognizedClasses : [ 'foo' ] ,
2020-11-18 16:51:03 +00:00
tagName : 'span'
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 : {
2018-02-24 12:15:55 +00:00
hbb0aeb2b8e907b74 : 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
2016-08-17 19:50:55 +00:00
}
2013-10-15 16:50:01 +00:00
} ;
2013-10-05 10:27:39 +00:00
2022-03-09 19:33:42 +00:00
ve . dm . mwExample . MWInlineImageWithWrapperClass = {
html :
'<span typeof="mw:Image" class="foo mw-valign-text-top">' +
'<a href="./File:Wiki.png" class="mw-file-description">' +
'<img resource="./File:Wiki.png" src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" height="155" width="135" alt="alt text">' +
'</a>' +
'</span>' ,
data : {
type : 'mwInlineImage' ,
attributes : {
src : 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png' ,
href : './File:Wiki.png' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : 'mw-file-description' ,
mediaClass : 'Image' ,
width : 135 ,
height : 155 ,
alt : 'alt text' ,
isError : false ,
valign : 'text-top' ,
resource : './File:Wiki.png' ,
mw : { } ,
type : 'none' ,
originalClasses : 'foo mw-valign-text-top' ,
unrecognizedClasses : [ 'foo' ] ,
tagName : 'span'
}
}
} ;
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 : {
2018-05-31 15:12:28 +00:00
text : ' No 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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:ThisIsAnAlien" />' )
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 : {
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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:foo" content="bar" />' )
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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:bar" content="baz" />' )
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 : {
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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' )
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
] ;
2018-03-20 23:22:03 +00:00
ve . dm . mwExample . withMetaRealData = [
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{
type : 'comment' ,
attributes : {
2018-05-31 15:12:28 +00:00
text : ' No conversion '
2018-03-20 23:22:03 +00:00
}
} ,
{ type : '/comment' } ,
{ type : '/paragraph' } ,
{
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:ThisIsAnAlien" />' )
2018-03-20 23:22:03 +00:00
} ,
{ type : '/mwAlienMeta' } ,
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' ,
2018-03-20 23:22:03 +00:00
{
type : 'comment' ,
attributes : {
text : ' inline '
}
} ,
{ type : '/comment' } ,
2013-07-03 01:30:10 +00:00
'z' ,
2014-08-22 20:50:48 +00:00
{ type : '/paragraph' } ,
2018-03-20 23:22:03 +00:00
{
type : 'mwCategory' ,
attributes : {
category : 'Category:Bar' ,
origCategory : 'Category:Bar' ,
sortkey : '' ,
origSortkey : ''
}
} ,
{ type : '/mwCategory' } ,
{
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:foo" content="bar" />' )
2018-03-20 23:22:03 +00:00
} ,
{ type : '/mwAlienMeta' } ,
{
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:bar" content="baz" />' )
2018-03-20 23:22:03 +00:00
} ,
{ type : '/mwAlienMeta' } ,
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{
type : 'comment' ,
attributes : {
text : 'barbaz'
}
} ,
{ type : '/comment' } ,
{ type : '/paragraph' } ,
{
type : 'mwCategory' ,
attributes : {
category : 'Category:Foo foo' ,
origCategory : 'Category:Foo_foo' ,
sortkey : 'Bar baz#quux' ,
origSortkey : 'Bar baz%23quux'
}
} ,
{ type : '/mwCategory' } ,
{
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' )
2018-03-20 23:22:03 +00:00
} ,
{ type : '/mwAlienMeta' } ,
2014-08-22 20:50:48 +00:00
{ 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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<!-- No conversion -->' )
2013-07-03 01:30:10 +00:00
} ,
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:ThisIsAnAlien" />' )
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
undefined ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwCategory' ,
attributes : {
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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:foo" content="bar" />' )
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'alienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<!-- inline -->' )
2013-07-03 01:30:10 +00:00
}
] ,
undefined ,
[
{
2014-08-22 20:50:48 +00:00
type : 'mwAlienMeta' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta property="mw:bar" content="baz" />' )
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 : {
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' ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<meta typeof="mw:Placeholder" data-parsoid="foobar" />' )
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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b data-parsoid="1">b</b>' )
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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b data-parsoid="2">c</b>' )
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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
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
] ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
2021-04-29 14:42:18 +00:00
const data = [ 'x' , [ ve . dm . example . bold ] ] ,
2015-11-20 00:08:32 +00:00
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
} ,
2020-06-10 19:31:16 +00:00
'adjacent annotations (RESTBase 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' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
2015-11-20 00:33:02 +00:00
} ]
] ,
[
'b' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b id="mwAB">b</b>' )
2015-11-20 00:33:02 +00:00
} ]
] ,
[
'c' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b id="mwCD">c</b>' )
2015-11-20 00:33:02 +00:00
} ]
] ,
' ' ,
[
'd' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
2015-11-20 00:33:02 +00:00
} ]
] ,
[
'd' ,
[ {
type : 'textStyle/bold' ,
attributes : { nodeName : 'b' } ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<b>a</b>' )
2015-11-20 00:33:02 +00:00
} ]
] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
2021-04-29 14:42:18 +00:00
const data = [ 'x' , [ ve . dm . example . bold ] ] ,
2015-11-20 00:33:02 +00:00
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
] ,
2017-06-22 19:55:28 +00:00
ceHtml : '<p class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode">' +
'<span class="ve-ce-branchNode-slug ve-ce-branchNode-inlineSlug"></span>' +
2022-03-09 19:33:42 +00:00
'<a class="ve-ce-leafNode ve-ce-focusableNode ve-ce-mwInlineImageNode" contenteditable="false">' +
'<img src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" width="135" height="155" style="vertical-align: text-top;">' +
'</a>' +
ve . dm . example . inlineSlug +
'</p>' ,
storeItems : ve . dm . mwExample . MWInlineImage . storeItems
} ,
mwImageWithWrapperClass : {
body : '<p>' + ve . dm . mwExample . MWInlineImageWithWrapperClass . html + '</p>' ,
data : [
{ type : 'paragraph' } ,
ve . dm . mwExample . MWInlineImageWithWrapperClass . data ,
{ type : '/mwInlineImage' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
ceHtml : '<p class="ve-ce-branchNode ve-ce-contentBranchNode ve-ce-paragraphNode">' +
'<span class="ve-ce-branchNode-slug ve-ce-branchNode-inlineSlug"></span>' +
'<a class="ve-ce-leafNode ve-ce-focusableNode ve-ce-mwInlineImageNode" contenteditable="false">' +
2017-06-22 19:55:28 +00:00
'<img src="http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png" width="135" height="155" style="vertical-align: text-top;">' +
'</a>' +
ve . dm . example . inlineSlug +
'</p>' ,
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
] ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 0 , ( item ) => {
2021-01-23 19:47:59 +00:00
item . attributes . wikitable = false ;
item . attributes . sortable = false ;
} ) ;
2016-06-30 12:31:04 +00:00
} ,
normalizedBody : '<table><tr><td>Foo</td></tr></table>'
2015-02-17 13:03:59 +00:00
} ,
2018-08-14 07:42:03 +00:00
'mwGalleryImage (no caption in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<ul class="gallery mw-gallery-packed-hover" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed-hover"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb" style="width: 120px;"><span typeof="mw:Image"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="120" width="120"/></a></span></div></li></ul>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwGallery' ,
attributes : {
mw : {
attrs : {
mode : 'packed-hover'
} ,
body : {
extsrc : ''
} ,
name : 'gallery'
} ,
originalMw : '{"attrs":{"mode":"packed-hover"},"body":{"extsrc":""},"name":"gallery"}'
}
} ,
{
type : 'mwGalleryImage' ,
attributes : {
altText : null ,
height : '120' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : ve . ce . minImgDataUri ,
2020-12-11 00:09:57 +00:00
width : '120' ,
2020-12-11 21:09:20 +00:00
tagName : 'span'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : 'mwGalleryImageCaption' } ,
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{ type : '/paragraph' } ,
{ type : '/mwGalleryImageCaption' } ,
{ type : '/mwGalleryImage' } ,
{ type : '/mwGallery' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2022-01-04 02:01:38 +00:00
normalizedBody : '<ul class="gallery mw-gallery-packed-hover" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed-hover"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext"></div></li></ul>' ,
fromDataBody : '<ul typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed-hover"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext"></div></li></ul>'
2018-08-14 07:42:03 +00:00
} ,
'mwGalleryImage (empty caption in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb" style="width: 120px;"><span typeof="mw:Image"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="120" width="120"/></a></span></div><div class="gallerytext"></div></li></ul>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwGallery' ,
attributes : {
mw : {
attrs : {
mode : 'packed'
} ,
body : {
extsrc : ''
} ,
name : 'gallery'
} ,
originalMw : '{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}'
}
} ,
{
type : 'mwGalleryImage' ,
attributes : {
altText : null ,
height : '120' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : ve . ce . minImgDataUri ,
2020-12-11 00:09:57 +00:00
width : '120' ,
2020-12-11 21:09:20 +00:00
tagName : 'span'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : 'mwGalleryImageCaption' } ,
{
type : 'paragraph' ,
internal : {
2021-03-10 22:59:31 +00:00
generated : 'wrapper'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : '/paragraph' } ,
{ type : '/mwGalleryImageCaption' } ,
{ type : '/mwGalleryImage' } ,
{ type : '/mwGallery' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2022-01-04 02:01:38 +00:00
normalizedBody : '<ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext"></div></li></ul>' ,
fromDataBody : '<ul typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext"></div></li></ul>'
2018-08-14 07:42:03 +00:00
} ,
'mwGalleryImage (caption with content in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb" style="width: 120px;"><span typeof="mw:Image"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="120" width="120"/></a></span></div><div class="gallerytext">Caption</div></li></ul>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwGallery' ,
attributes : {
mw : {
attrs : {
mode : 'packed'
} ,
body : {
extsrc : ''
} ,
name : 'gallery'
} ,
originalMw : '{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}'
}
} ,
{
type : 'mwGalleryImage' ,
attributes : {
altText : null ,
height : '120' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : ve . ce . minImgDataUri ,
2020-12-11 00:09:57 +00:00
width : '120' ,
2020-12-11 21:09:20 +00:00
tagName : 'span'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : 'mwGalleryImageCaption' } ,
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
'C' , 'a' , 'p' , 't' , 'i' , 'o' , 'n' ,
{ type : '/paragraph' } ,
{ type : '/mwGalleryImageCaption' } ,
{ type : '/mwGalleryImage' } ,
{ type : '/mwGallery' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2022-01-04 02:01:38 +00:00
normalizedBody : '<ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox" style="width: 122px;"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext">Caption</div></li></ul>' ,
fromDataBody : '<ul typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext">Caption</div></li></ul>'
2018-08-14 07:42:03 +00:00
} ,
'mwGalleryImage (no caption in model)' : {
data : [
{
type : 'mwGallery' ,
attributes : {
mw : {
attrs : {
mode : 'packed'
} ,
body : {
extsrc : ''
} ,
name : 'gallery'
} ,
originalMw : '{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}'
}
} ,
{
type : 'mwGalleryImage' ,
attributes : {
altText : null ,
height : '120' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : ve . ce . minImgDataUri ,
2020-12-11 00:09:57 +00:00
width : '120' ,
2020-12-11 21:09:20 +00:00
tagName : 'span'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : '/mwGalleryImage' } ,
{ type : '/mwGallery' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2022-01-04 02:01:38 +00:00
fromDataBody : '<ul typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div></li></ul>'
2018-08-14 07:42:03 +00:00
} ,
'mwGalleryImage (empty caption in model)' : {
data : [
{
type : 'mwGallery' ,
attributes : {
mw : {
attrs : {
mode : 'packed'
} ,
body : {
extsrc : ''
} ,
name : 'gallery'
} ,
originalMw : '{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}'
}
} ,
{
type : 'mwGalleryImage' ,
attributes : {
altText : null ,
height : '120' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : ve . ce . minImgDataUri ,
2020-12-11 00:09:57 +00:00
width : '120' ,
2020-12-11 21:09:20 +00:00
tagName : 'span'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : 'mwGalleryImageCaption' } ,
{ type : '/mwGalleryImageCaption' } ,
{ type : '/mwGalleryImage' } ,
{ type : '/mwGallery' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2022-01-04 02:01:38 +00:00
fromDataBody : '<ul typeof="mw:Extension/gallery" data-mw=\'{"attrs":{"mode":"packed"},"body":{"extsrc":""},"name":"gallery"}\'><li class="gallerybox"><div class="thumb"><span typeof="mw:Image"><a><img resource="./Foo" src="' + ve . ce . minImgDataUri + '"/></a></span></div><div class="gallerytext"></div></li></ul>'
2018-08-14 07:42:03 +00:00
} ,
'mwBlockImage (no caption in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a></figure>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwBlockImage' ,
attributes : {
align : 'default' ,
alt : null ,
height : 300 ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2018-08-14 07:42:03 +00:00
isError : false ,
mediaClass : 'Image' ,
mw : { } ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' ,
type : 'thumb' ,
width : 300
}
} ,
{ type : 'mwImageCaption' } ,
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
normalizedBody : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a><figcaption></figcaption></figure>'
2018-08-14 07:42:03 +00:00
} ,
'mwBlockImage (empty caption in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a><figcaption></figcaption></figure>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwBlockImage' ,
attributes : {
align : 'default' ,
alt : null ,
height : 300 ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2018-08-14 07:42:03 +00:00
isError : false ,
mediaClass : 'Image' ,
mw : { } ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' ,
type : 'thumb' ,
width : 300
}
} ,
{ type : 'mwImageCaption' } ,
{
type : 'paragraph' ,
internal : {
2021-03-10 22:59:31 +00:00
generated : 'wrapper'
2018-08-14 07:42:03 +00:00
}
} ,
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
'mwBlockImage (caption with content in DOM)' : {
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
body : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a><figcaption>Caption</figcaption></figure>' ,
2018-08-14 07:42:03 +00:00
data : [
{
type : 'mwBlockImage' ,
attributes : {
align : 'default' ,
alt : null ,
height : 300 ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2018-08-14 07:42:03 +00:00
isError : false ,
mediaClass : 'Image' ,
mw : { } ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' ,
type : 'thumb' ,
width : 300
}
} ,
{ type : 'mwImageCaption' } ,
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
'C' , 'a' , 'p' , 't' , 'i' , 'o' , 'n' ,
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
'mwBlockImage (no caption in model)' : {
data : [
{
type : 'mwBlockImage' ,
attributes : {
align : 'default' ,
alt : null ,
height : 300 ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2018-08-14 07:42:03 +00:00
isError : false ,
mediaClass : 'Image' ,
mw : { } ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' ,
type : 'thumb' ,
width : 300
}
} ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
fromDataBody : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a></figure>'
2018-08-14 07:42:03 +00:00
} ,
'mwBlockImage (empty caption in model)' : {
data : [
{
type : 'mwBlockImage' ,
attributes : {
align : 'default' ,
alt : null ,
height : 300 ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2018-08-14 07:42:03 +00:00
isError : false ,
mediaClass : 'Image' ,
mw : { } ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
resource : './Foo' ,
2018-08-14 07:42:03 +00:00
src : 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' ,
type : 'thumb' ,
width : 300
}
} ,
{ type : 'mwImageCaption' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
fromDataBody : '<figure typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Foo" src="' + ve . ce . minImgDataUri + '" height="300" width="300"/></a></figure>'
2018-08-14 07:42:03 +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 ,
2018-05-31 15:12:28 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . blockOpenClipboard + ve . dm . mwExample . MWTransclusion . blockContentClipboard ,
previewBody : 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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . blockStoreItems ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 0 , ( item ) => {
2021-01-23 19:47:59 +00:00
item . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = 'Hello, globe!' ;
} ) ;
2013-06-26 21:18:39 +00:00
} ,
2019-01-17 12:58:29 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . blockOpenModified . replace ( /about="#mwt1"/ , '' ) ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . blockOpenFromDataModified ,
2018-05-31 15:12:28 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . blockOpenModifiedClipboard ,
previewBody : false
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 ,
2018-05-31 15:12:28 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . inlineOpenClipboard + ve . dm . mwExample . MWTransclusion . inlineContent + ve . dm . mwExample . MWTransclusion . inlineClose ,
previewBody : 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
] ,
2016-08-17 19:50:55 +00:00
storeItems : ve . dm . mwExample . MWTransclusion . inlineStoreItems ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 1 , ( item ) => {
2021-01-23 19:47:59 +00:00
item . attributes . mw . parts [ 0 ] . template . params [ '1' ] . wt = '5,678' ;
} ) ;
2013-06-26 21:18:39 +00:00
} ,
2019-01-17 12:58:29 +00:00
normalizedBody : ve . dm . mwExample . MWTransclusion . inlineOpenModified . replace ( /about="#mwt1"/ , '' ) + ve . dm . mwExample . MWTransclusion . inlineClose ,
2015-02-23 02:40:58 +00:00
fromDataBody : ve . dm . mwExample . MWTransclusion . inlineOpenFromDataModified + ve . dm . mwExample . MWTransclusion . inlineClose ,
2018-05-31 15:12:28 +00:00
clipboardBody : ve . dm . mwExample . MWTransclusion . inlineOpenModifiedClipboard + ve . dm . mwExample . MWTransclusion . inlineClose ,
previewBody : false
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 ,
2018-05-31 15:12:28 +00:00
previewBody : ve . dm . mwExample . MWTransclusion . pairOne + ve . dm . mwExample . MWTransclusion . pairOne ,
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 : {
2022-03-08 23:48:22 +00:00
hd2ff771ac84b229d : $ . parseHTML ( '<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>' )
2016-08-17 19:50:55 +00:00
}
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 ,
2018-05-31 15:12:28 +00:00
previewBody : false ,
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
}
} ]
} ,
2017-07-18 11:55:33 +00:00
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 : '{}'
} ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<span dir="ltr" about="#mwt1" typeof="mw:Transclusion" data-mw="{}">content</span>' )
2015-06-16 12:51:35 +00:00
} ,
{ type : '/mwTransclusionInline' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2018-05-31 15:12:28 +00:00
clipboardBody : '<span dir="ltr" about="#mwt1" typeof="mw:Transclusion" data-mw="{}" data-ve-no-generated-contents="true">content</span>' ,
previewBody : false
2015-06-16 12:51:35 +00:00
} ,
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"}}'
} ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<div about="#mwt1" data-parsoid="1"></div>' )
2015-03-23 12:49:37 +00:00
} ,
2015-03-23 15:49:38 +00:00
{ type : '/mwAlienBlockExtension' } ,
2015-03-23 12:49:37 +00:00
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 0 , ( item ) => {
2021-01-23 19:47:59 +00:00
item . 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 }"}}'
} ,
2022-03-08 23:48:22 +00:00
originalDomElements : $ . parseHTML ( '<img src="' + ve . ce . minImgDataUri + '" width="100" height="20" alt="Bar" about="#mwt1" data-parsoid="1"></img>' )
2015-03-23 15:49:38 +00:00
} ,
{ type : '/mwAlienInlineExtension' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 1 , ( item ) => {
2021-01-23 19:47:59 +00:00
item . attributes . mw . body . extsrc = '\\relative c\' { d d d e e e }' ;
} ) ;
2015-03-23 15:49:38 +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
] ,
2018-10-05 19:24:27 +00:00
normalizedBody : '<p><a rel="mw:WikiLink" href="./Foo/Bar">Foo</a></p>' ,
2014-08-22 20:50:48 +00:00
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
] ,
2018-10-05 19:24:27 +00:00
normalizedBody : '<p><a rel="mw:WikiLink" href="./Foo#Bar">Foo</a></p>' ,
2014-08-22 20:50:48 +00:00
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 : '' ,
2019-04-03 19:17:19 +00:00
lookupTitle : ''
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>' ,
2022-01-04 02:01:38 +00:00
ignoreXmlWarnings : true ,
2016-09-18 22:22:09 +00:00
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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Foo?+%&Bar'
2016-09-18 22:22:09 +00:00
}
} ]
] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
]
} ,
2019-09-24 16:25:03 +00:00
'mw:MediaLink (exists)' : {
body : '<p><a rel="mw:MediaLink" href="//localhost/w/images/x/xx/Exists.png" resource="./Media:Exists.png" title="Exists.png">Media:Exists.png</a></p>' ,
data : [
{ type : 'paragraph' } ,
[ 'M' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'e' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'd' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'i' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'a' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ ':' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'E' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'x' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'i' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 's' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 't' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 's' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ '.' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'p' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'n' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
[ 'g' , [ ve . dm . mwExample . MWMediaLinkExistsData ] ] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
normalizedBody : '<p><a href="./Media:Exists.png" rel="mw:WikiLink" resource="./Media:Exists.png" title="Exists.png">Media:Exists.png</a></p>' ,
fromDataBody : '<p><a href="./Media:Exists.png" rel="mw:WikiLink">Media:Exists.png</a></p>'
} ,
'mw:MediaLink (missing)' : {
body : '<p><a rel="mw:MediaLink" href="./Special:FilePath/Missing.png" resource="./Media:Missing.png" title="Missing.png" typeof="mw:Error" data-mw=\'{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}\'>Media:Missing.png</a></p>' ,
data : [
{ type : 'paragraph' } ,
[ 'M' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'e' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'd' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'i' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'a' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ ':' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'M' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'i' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 's' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 's' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'i' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'n' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'g' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ '.' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'p' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'n' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
[ 'g' , [ ve . dm . mwExample . MWMediaLinkMissingData ] ] ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
normalizedBody : '<p><a href="./Media:Missing.png" rel="mw:WikiLink" resource="./Media:Missing.png" title="Missing.png" typeof="mw:Error" data-mw=\'{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}\'>Media:Missing.png</a></p>' ,
fromDataBody : '<p><a href="./Media:Missing.png" rel="mw:WikiLink">Media:Missing.png</a></p>'
} ,
2013-10-17 20:15:36 +00:00
'numbered external link (empty mw:Extlink)' : {
2018-05-31 14:06:57 +00:00
body : '<p>Foo<a rel="mw:ExtLink" href="http://www.example.com"></a>Bar</p>' ,
2014-08-22 20:50:48 +00:00
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
] ,
2018-05-31 14:06:57 +00:00
clipboardBody : '<p>Foo<a rel="ve:NumberedLink" href="http://www.example.com">[1]</a>Bar</p>'
2013-06-26 21:18:39 +00:00
} ,
2018-03-05 19:35:25 +00:00
'numbered external link (non-empty mw:Extlink as cross-document paste)' : {
2018-05-31 14:06:57 +00:00
body : '<p>Foo<a rel="ve:NumberedLink" href="http://www.example.com">[1]</a>Bar</p>' ,
2018-03-05 19:35:25 +00:00
data : [
{ type : 'paragraph' } ,
'F' , 'o' , 'o' ,
{
type : 'link/mwNumberedExternal' ,
attributes : {
href : 'http://www.example.com'
}
} ,
{ type : '/link/mwNumberedExternal' } ,
'B' , 'a' , 'r' ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
2018-05-31 14:06:57 +00:00
clipboardBody : '<p>Foo<a rel="ve:NumberedLink" href="http://www.example.com">[1]</a>Bar</p>' ,
normalizedBody : '<p>Foo<a rel="mw:ExtLink" href="http://www.example.com"></a>Bar</p>'
2018-03-05 19:35:25 +00:00
} ,
2013-06-26 21:18:39 +00:00
'URL link' : {
2018-04-23 15:03:32 +00:00
body : '<p><a rel="mw:ExtLink" href="https://www.mediawiki.org/">mw</a></p>' ,
2014-08-22 20:50:48 +00:00
data : [
{ type : 'paragraph' } ,
2013-06-26 21:18:39 +00:00
[
'm' ,
[ {
2014-08-22 20:50:48 +00:00
type : 'link/mwExternal' ,
attributes : {
2018-04-23 15:03:32 +00:00
href : 'https://www.mediawiki.org/' ,
2014-08-22 20:50:48 +00:00
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 : {
2018-04-23 15:03:32 +00:00
href : 'https://www.mediawiki.org/' ,
2014-08-22 20:50:48 +00:00
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' }
2018-05-31 15:12:28 +00:00
] ,
previewBody : '<p><a rel="mw:ExtLink" class="external" href="https://www.mediawiki.org/">mw</a></p>'
2018-01-22 18:59:45 +00:00
} , / * F I X M E T 1 8 5 9 0 2 : T e m p o r a r i l y c o m m e n t e d o u t f a i l i n g t e s t c a s e
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' ,
2018-01-22 18:59:45 +00:00
metaItems : [
{
2018-03-06 12:44:37 +00:00
originalDomElementsHash : 'h188ab6af88887790' ,
2018-01-22 18:59:45 +00:00
type : 'mwLanguage' ,
attributes : {
href : 'http://de.wikipedia.org/wiki/Foo'
} ,
internal : {
2018-03-06 12:44:37 +00:00
loadMetaParentHash : 'hbc66e1df10d058e6' ,
2018-01-22 18:59:45 +00:00
loadMetaParentOffset : 3
}
} ,
{
2018-03-06 12:44:37 +00:00
originalDomElementsHash : 'h188ab6ff88887790' ,
2018-01-22 18:59:45 +00:00
type : 'mwLanguage' ,
attributes : {
href : 'http://fr.wikipedia.org/wiki/Foo'
} ,
internal : {
2018-03-06 12:44:37 +00:00
loadMetaParentHash : 'h4e7ce2a82b7ce627' ,
2018-01-22 18:59:45 +00:00
loadMetaParentOffset : 6
}
}
] ,
2014-08-22 20:50:48 +00:00
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
} ,
2018-01-22 18:59:45 +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
} ,
2018-01-22 18:59:45 +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
]
2020-06-02 20:30:00 +00:00
} , * /
2013-06-26 21:18:39 +00:00
'document with meta elements' : {
2018-05-31 15:12:28 +00:00
body : '<!-- No 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" />' ,
2018-05-31 15:12:28 +00:00
clipboardBody : '<span rel="ve:Comment" data-ve-comment=" No 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" />' ,
2018-05-31 15:12:28 +00:00
previewBody : ve . dm . example . commentNodePreview ( ' No conversion ' ) + '<meta property="mw:ThisIsAnAlien" /><p>Foo' +
'<link rel="mw:PageProp/Category" href="./Category:Bar" />Bar' +
'<meta property="mw:foo" content="bar" />Ba' + ve . dm . example . commentNodePreview ( ' inline ' ) + 'z</p>' +
'<meta property="mw:bar" content="baz" />' + ve . dm . example . commentNodePreview ( 'barbaz' ) +
'<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" />' ,
2018-03-20 23:22:03 +00:00
data : ve . dm . mwExample . withMeta ,
realData : ve . dm . mwExample . withMetaRealData
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 ,
2018-05-31 15:12:28 +00:00
previewBody : ve . dm . mwExample . MWTransclusion . mixed ,
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
]
} ,
2020-01-08 00:38:19 +00:00
'mw:DisplaySpace' : {
2020-06-04 17:48:49 +00:00
body : '<p>a<span typeof="mw:DisplaySpace"> </span>: b</p>' ,
2020-01-08 00:38:19 +00:00
data : [
{ type : 'paragraph' } ,
'a' ,
{
type : 'mwEntity' ,
attributes : {
character : '\u00a0' ,
displaySpace : true
}
} ,
{ type : '/mwEntity' } ,
':' ,
' ' ,
'b' ,
{ 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
} ,
2022-01-19 00:39:56 +00:00
'broken block image' : {
body :
'<figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-mw="{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}">' +
'<a href="./Special:FilePath/Missing_image.jpg">' +
2022-03-21 21:03:00 +00:00
'<span class="mw-broken-media" resource="./File:Missing_image.jpg" data-width="220">File:Missing image.jpg</span>' +
2022-01-19 00:39:56 +00:00
'</a>' +
'<figcaption>abc</figcaption>' +
'</figure>' ,
data : [
{
type : 'mwBlockImage' ,
attributes : {
type : 'thumb' ,
align : 'default' ,
href : './Special:FilePath/Missing_image.jpg' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : 'mw-broken-media' ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2022-01-19 00:39:56 +00:00
mediaClass : 'Image' ,
src : null ,
defaultSize : true ,
width : 220 ,
height : null ,
originalWidth : 220 ,
originalHeight : null ,
alt : null ,
isError : true ,
resource : './File:Missing_image.jpg' ,
mw : {
errors : [ {
key : 'apierror-filedoesnotexist' ,
message : 'This image does not exist.'
} ]
} ,
originalClasses : 'mw-default-size' ,
unrecognizedClasses : [ ]
}
} ,
{ type : 'mwImageCaption' } ,
{ type : 'paragraph' , internal : { generated : 'wrapper' } } ,
'a' , 'b' , 'c' ,
{ type : '/paragraph' } ,
{ type : '/mwImageCaption' } ,
{ type : '/mwBlockImage' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
previewBody :
'<figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-mw="{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}">' +
'<a href="./Special:FilePath/Missing_image.jpg" class="new">' +
2022-03-21 21:03:00 +00:00
'<span class="mw-broken-media" resource="./File:Missing_image.jpg" data-width="220">File:Missing image.jpg</span>' +
2022-01-19 00:39:56 +00:00
'</a>' +
'<figcaption>abc</figcaption>' +
'</figure>'
} ,
'broken inline image' : {
body :
'<p>' +
'<span typeof="mw:Error mw:Image" data-mw="{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}">' +
'<a href="./Special:FilePath/Missing_image.jpg">' +
2022-03-21 21:03:00 +00:00
'<span class="mw-broken-media" resource="./File:Missing_image.jpg" data-width="200">File:Missing image.jpg</span>' +
2022-01-19 00:39:56 +00:00
'</a>' +
'</span>' +
'</p>' ,
data : [
{ type : 'paragraph' } ,
{
type : 'mwInlineImage' ,
attributes : {
type : 'none' ,
href : './Special:FilePath/Missing_image.jpg' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : 'mw-broken-media' ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2022-01-19 00:39:56 +00:00
mediaClass : 'Image' ,
src : null ,
tagName : 'span' ,
width : 200 ,
height : null ,
valign : 'default' ,
alt : null ,
isError : true ,
resource : './File:Missing_image.jpg' ,
mw : {
errors : [ {
key : 'apierror-filedoesnotexist' ,
message : 'This image does not exist.'
} ]
} ,
originalClasses : null ,
unrecognizedClasses : [ ]
}
} ,
{ type : '/mwInlineImage' } ,
{ type : '/paragraph' } ,
{ type : 'internalList' } ,
{ type : '/internalList' }
] ,
previewBody :
'<p>' +
'<span typeof="mw:Error mw:Image" data-mw="{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}">' +
'<a href="./Special:FilePath/Missing_image.jpg" class="new">' +
2022-03-21 21:03:00 +00:00
'<span class="mw-broken-media" resource="./File:Missing_image.jpg" data-width="200">File:Missing image.jpg</span>' +
2022-01-19 00:39:56 +00:00
'</a>' +
'</span>' +
'</p>'
} ,
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="{}">' +
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
'<a href="./Foo" data-parsoid="{}">' +
'<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">' +
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
'<a href="./Foo">' +
'<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' ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +00:00
href : './Foo' ,
2022-03-21 21:03:00 +00:00
imageClassAttr : null ,
2022-03-09 19:33:42 +00:00
imgWrapperClassAttr : null ,
2017-04-27 18:08:35 +00:00
mediaClass : 'Image' ,
2016-01-07 01:06:44 +00:00
src : ve . ce . minImgDataUri ,
2014-08-22 20:50:48 +00:00
width : 1 ,
height : 2 ,
2018-06-05 11:41:09 +00:00
alt : null ,
2018-06-26 12:02:19 +00:00
mw : { } ,
2018-06-05 11:41:09 +00:00
isError : false ,
Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbdba9007cfe893b1eafd1ccb42dbb537.
This attempt also includes 6037fefbe044fbf61e7734923f3b625f10e910a1,
and fixes minor conflicts with other changes.
* In normal images, parse relative 'href' attributes instead of
expanding them to absolute. This resolves Parsoid generating
|link= options for copy-pasted images (T193253).
Keep them in the underscore-form to avoid causing dirty diffs like
T237040 again. Unlike in the previous attempt, we don't need to be
super-careful about the 'resource' attribute, thanks to the Parsoid
changes in T108504.
* In gallery images stuff, prefix the 'resource' attribute with './',
same as normal images do. This causes no functional changes, but it
makes updating tests easier, and the consistency is probably good.
* Update test examples to also prefix 'resource' and relative 'href'
attributes with './', like the real Parsoid does.
Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2019-09-10 18:57:05 +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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Bar'
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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Bar'
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' ,
2019-04-03 19:17:19 +00:00
lookupTitle : 'Bar'
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 ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 7 , ( item ) => {
2021-01-23 19:47:59 +00:00
item [ 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 ,
2021-04-30 09:33:22 +00:00
modify : ( model ) => {
model . data . modifyData ( 7 , ( item ) => {
2021-01-23 19:47:59 +00:00
item [ 1 ] . push ( model . getStore ( ) . hash ( 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
} ,
2020-11-05 21:24:43 +00:00
'plain external links when pasted are converted to link/mwExternal' : {
fromClipboard : true ,
2018-04-23 15:03:32 +00:00
body : '<a href="https://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 : {
2018-04-23 15:03:32 +00:00
href : 'https://www.mediawiki.org/'
2016-03-17 18:35:22 +00:00
}
} ]
] ,
2016-03-17 15:30:59 +00:00
[
'b' ,
[ {
type : 'link/mwExternal' ,
attributes : {
2018-04-23 15:03:32 +00:00
href : 'https://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'
}
] ,
2018-05-31 15:12:28 +00:00
normalizedBody : '<a href="https://www.mediawiki.org/" rel="mw:ExtLink">ab</a>' ,
previewBody : '<a href="https://www.mediawiki.org/" class="external" rel="mw:ExtLink">ab</a>'
2016-03-17 18:35:22 +00:00
} ,
2020-11-05 21:24:43 +00:00
'plain internal links when pasted are converted to link/mwInternal' : {
fromClipboard : true ,
2016-03-17 18:35:22 +00:00
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'
}
] ,
2018-10-05 19:24:27 +00:00
normalizedBody : '<a href="./Foo/Bar" rel="mw:WikiLink">ab</a>' ,
2016-03-17 18:35:22 +00:00
mwConfig : {
wgArticlePath : '/wiki/$1'
}
2018-04-06 10:52:02 +00:00
} ,
2020-11-05 21:24:43 +00:00
'plain href-less anchors when pasted are converted to spans' : {
fromClipboard : true ,
2018-04-06 10:52:02 +00:00
body : '<a name="foo">ab</a>' ,
data : [
{
type : 'paragraph' ,
internal : {
generated : 'wrapper'
}
} ,
[
'a' ,
[ {
type : 'textStyle/span' ,
2020-11-05 21:24:43 +00:00
attributes : { nodeName : 'span' }
2018-04-06 10:52:02 +00:00
} ]
] ,
[
'b' ,
[ {
type : 'textStyle/span' ,
2020-11-05 21:24:43 +00:00
attributes : { nodeName : 'span' }
2018-04-06 10:52:02 +00:00
} ]
] ,
{
type : '/paragraph'
} ,
{
type : 'internalList'
} ,
{
type : '/internalList'
}
] ,
2020-11-05 21:24:43 +00:00
normalizedBody : '<span name="foo">ab</span>' ,
fromDataBody : '<span>ab</span>'
2013-06-26 21:18:39 +00:00
}
} ;