Merge "(bug 49837) Handle correctly figure tags with typeof="mw:Image""

This commit is contained in:
jenkins-bot 2013-06-19 21:56:16 +00:00 committed by Gerrit Code Review
commit 5cc6faaa1f
2 changed files with 21 additions and 7 deletions

View file

@ -34,8 +34,13 @@ ve.dm.MWBlockImageNode.static.handlesOwnChildren = true;
ve.dm.MWBlockImageNode.static.childNodeTypes = [ 'mwImageCaption' ];
// Match typeof="mw:Image/Thumb" and typeof="mw:Image/Frame"
ve.dm.MWBlockImageNode.static.matchRdfaTypes = [ /^mw:Image\/(Thumb|Frame)$/ ];
ve.dm.MWBlockImageNode.static.matchTagNames = [ 'figure' ];
ve.dm.MWBlockImageNode.static.matchRdfaTypes = [
'mw:Image',
'mw:Image/Thumb',
'mw:Image/Frame'
];
ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter ) {
var $figure = $( domElements[0] ),
@ -64,6 +69,9 @@ ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter
case 'mw:Image/Frame':
attributes.type = 'frame';
break;
case 'mw:Image':
attributes.type = 'none';
break;
}
// Horizontal alignment
@ -109,10 +117,16 @@ ve.dm.MWBlockImageNode.static.toDomElements = function ( data, doc, converter )
wrapper = doc.createElement( 'div' );
// Type
if ( dataElement.attributes.type === 'thumb' ) {
figure.setAttribute( 'typeof', 'mw:Image/Thumb' );
} else {
figure.setAttribute( 'typeof', 'mw:Image/Frame' );
switch ( dataElement.attributes.type ) {
case 'thumb':
figure.setAttribute( 'typeof', 'mw:Image/Thumb' );
break;
case 'frame':
figure.setAttribute( 'typeof', 'mw:Image/Frame' );
break;
case 'none':
figure.setAttribute( 'typeof', 'mw:Image' );
break;
}
// Default-size

View file

@ -32,7 +32,7 @@ ve.dm.MWInlineImageNode.static.storeHtmlAttributes = {
'blacklist': [ 'typeof', 'class', 'src', 'resource', 'width', 'height', 'href' ]
};
ve.dm.MWInlineImageNode.static.matchTagNames = null;
ve.dm.MWInlineImageNode.static.matchTagNames = [ 'span' ];
ve.dm.MWInlineImageNode.static.matchRdfaTypes = [
'mw:Image',