mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Merge "'typeof' for templates changed in Parsoid, it is 'Transclusion' now and used to be 'Object/Template'"
This commit is contained in:
commit
8c20fb278f
|
@ -38,7 +38,7 @@ ve.dm.MWTemplateNode.static.name = 'mwTemplate';
|
|||
ve.dm.MWTemplateNode.static.matchTagNames = null;
|
||||
|
||||
ve.dm.MWTemplateNode.static.matchRdfaTypes = [
|
||||
'mw:Object/Template',
|
||||
'mw:Transclusion',
|
||||
// We're interested in all nodes that have mw:Object/Template, even if they also have other mw:
|
||||
// types. So we match all mw: types, then use a matchFunction to assert that mw:Object/Template
|
||||
// is in there.
|
||||
|
@ -46,7 +46,7 @@ ve.dm.MWTemplateNode.static.matchRdfaTypes = [
|
|||
];
|
||||
|
||||
ve.dm.MWTemplateNode.static.matchFunction = function ( domElement ) {
|
||||
return ve.indexOf( 'mw:Object/Template',
|
||||
return ve.indexOf( 'mw:Transclusion',
|
||||
( domElement.getAttribute( 'typeof' ) || '' ).split( ' ' )
|
||||
) !== -1;
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ ve.dm.MWTemplateNode.static.toDomElements = function ( dataElement, doc, convert
|
|||
span = doc.createElement( 'span' );
|
||||
// All we need to send back to Parsoid is the original template marker,
|
||||
// with a reconstructed data-mw property.
|
||||
span.setAttribute( 'typeof', 'mw:Object/Template' );
|
||||
span.setAttribute( 'typeof', 'mw:Transclusion' );
|
||||
span.setAttribute( 'data-mw', JSON.stringify( dataElement.attributes.mw ) );
|
||||
return [ span ];
|
||||
}
|
||||
|
|
|
@ -910,8 +910,8 @@ ve.dm.example.conversions = {
|
|||
|
||||
ve.dm.example.MWInlineImageHtml = '<a rel="mw:Image" href="./File:Wiki.png" data-parsoid="{"tsr":[158,216],"src":"[[Image:Wiki.png|500px|thumb|center|Example wiki file]]","optNames":{"width":"$1px"},"dsr":[158,216,null,null]}"><img height="" width="500" src="/index.php?title=Special:FilePath/Wiki.png&width=500" alt="Wiki.png"></a>';
|
||||
ve.dm.example.MWTemplate = {
|
||||
'blockSpan': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{"id":"mwt1","target":{"wt":"Test"},"params":{"1":{"wt":"Hello, world!"}}}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></span>',
|
||||
'blockSpanModified': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{"id":"mwt1","target":{"wt":"Test"},"params":{"1":{"wt":"Hello, globe!"}}}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></span>',
|
||||
'blockSpan': '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Test"},"params":{"1":{"wt":"Hello, world!"}}}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></span>',
|
||||
'blockSpanModified': '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Test"},"params":{"1":{"wt":"Hello, globe!"}}}" data-parsoid="{"tsr":[18,40],"src":"{{Test|Hello, world!}}","dsr":[18,40,null,null]}"></span>',
|
||||
'blockContent': '<p about="#mwt1" data-parsoid="{}">Hello, world!</p>',
|
||||
'blockData': {
|
||||
'type': 'mwTemplateBlock',
|
||||
|
@ -938,7 +938,7 @@ ve.dm.example.MWTemplate = {
|
|||
'about': '#mwt1',
|
||||
'data-mw': '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Test\"},\"params\":{\"1\":{\"wt\":\"Hello, world!\"}}}',
|
||||
'data-parsoid': '{\"tsr\":[18,40],\"src\":\"{{Test|Hello, world!}}\",\"dsr\":[18,40,null,null]}',
|
||||
'typeof': 'mw:Object/Template'
|
||||
'typeof': 'mw:Transclusion'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -950,8 +950,8 @@ ve.dm.example.MWTemplate = {
|
|||
}
|
||||
]
|
||||
},
|
||||
'inlineOpen': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"1,234"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">',
|
||||
'inlineOpenModified': '<span about="#mwt1" typeof="mw:Object/Template" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">',
|
||||
'inlineOpen': '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"1,234"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">',
|
||||
'inlineOpenModified': '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">',
|
||||
'inlineContent': '$1,234.00',
|
||||
'inlineClose': '</span>',
|
||||
'inlineData': {
|
||||
|
@ -979,12 +979,12 @@ ve.dm.example.MWTemplate = {
|
|||
'about': '#mwt1',
|
||||
'data-mw': '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"1,234\"}}}',
|
||||
'data-parsoid': '{\"tsr\":[18,34],\"src\":\"{{Inline|1,234}}\",\"dsr\":[18,34,null,null]}',
|
||||
'typeof': 'mw:Object/Template'
|
||||
'typeof': 'mw:Transclusion'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'mixed': '<link about="#mwt1" rel="mw:WikiLink/Category" typeof="mw:Object/Template" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}"><span about="#mwt1">Foo</span>',
|
||||
'mixed': '<link about="#mwt1" rel="mw:WikiLink/Category" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}"><span about="#mwt1">Foo</span>',
|
||||
'mixedDataOpen': {
|
||||
'type': 'mwTemplateInline',
|
||||
'attributes': {
|
||||
|
@ -1009,7 +1009,7 @@ ve.dm.example.MWTemplate = {
|
|||
'values': {
|
||||
'about': '#mwt1',
|
||||
'rel': 'mw:WikiLink/Category',
|
||||
'typeof': 'mw:Object/Template',
|
||||
'typeof': 'mw:Transclusion',
|
||||
'data-mw': '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"5,678\"}}}'
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue