2013-08-07 05:21:10 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel MWAlienExtensionNode class.
|
|
|
|
*
|
2016-01-03 22:56:59 +00:00
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
2013-08-07 05:21:10 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2014-02-07 17:28:54 +00:00
|
|
|
* DataModel MediaWiki alien extension node.
|
2013-08-07 05:21:10 +00:00
|
|
|
*
|
|
|
|
* @class
|
2015-03-23 15:49:38 +00:00
|
|
|
* @abstract
|
2013-08-07 05:21:10 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
*/
|
2015-03-23 15:49:38 +00:00
|
|
|
ve.dm.MWAlienExtensionNode = function VeDmMWAlienExtensionNode() {};
|
2013-08-07 05:21:10 +00:00
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2015-03-23 15:49:38 +00:00
|
|
|
OO.initClass( ve.dm.MWAlienExtensionNode );
|
2013-08-07 05:21:10 +00:00
|
|
|
|
|
|
|
/* Static members */
|
|
|
|
|
|
|
|
ve.dm.MWAlienExtensionNode.static.getMatchRdfaTypes = function () {
|
|
|
|
return [
|
|
|
|
/^mw:Extension/
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2015-03-23 15:49:38 +00:00
|
|
|
ve.dm.MWAlienExtensionNode.static.toDataElement = function ( domElements, converter ) {
|
|
|
|
// 'Parent' method
|
2016-04-01 09:50:13 +00:00
|
|
|
var element = ve.dm.MWExtensionNode.static.toDataElement.call( this, domElements, converter ),
|
2015-03-23 15:49:38 +00:00
|
|
|
isInline = this.isHybridInline( domElements, converter );
|
|
|
|
|
|
|
|
element.type = isInline ? 'mwAlienInlineExtension' : 'mwAlienBlockExtension';
|
|
|
|
return element;
|
|
|
|
};
|
2013-08-07 05:21:10 +00:00
|
|
|
|
2015-03-23 15:49:38 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc ve.dm.MWExtensionNode
|
|
|
|
*/
|
2013-08-30 23:23:18 +00:00
|
|
|
ve.dm.MWAlienExtensionNode.static.getExtensionName = function ( dataElement ) {
|
|
|
|
return dataElement.attributes.mw.name;
|
2013-08-15 09:40:58 +00:00
|
|
|
};
|
|
|
|
|
2015-03-23 15:49:38 +00:00
|
|
|
/**
|
|
|
|
* DataModel MediaWiki alien inline extension node.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
* @extends ve.dm.MWInlineExtensionNode
|
|
|
|
* @mixins ve.dm.MWAlienExtensionNode
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [element] Reference to element in linear model
|
|
|
|
*/
|
|
|
|
ve.dm.MWAlienInlineExtensionNode = function VeDmMWAlienInlineExtensionNode() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.dm.MWAlienInlineExtensionNode.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Mixin constructors
|
|
|
|
ve.dm.MWAlienExtensionNode.call( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.dm.MWAlienInlineExtensionNode, ve.dm.MWInlineExtensionNode );
|
|
|
|
|
|
|
|
OO.mixinClass( ve.dm.MWAlienInlineExtensionNode, ve.dm.MWAlienExtensionNode );
|
|
|
|
|
|
|
|
/* Static members */
|
|
|
|
|
|
|
|
ve.dm.MWAlienInlineExtensionNode.static.name = 'mwAlienInlineExtension';
|
|
|
|
|
|
|
|
ve.dm.MWAlienInlineExtensionNode.static.isContent = true;
|
|
|
|
|
|
|
|
ve.dm.MWAlienInlineExtensionNode.static.tagName = 'span';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DataModel MediaWiki alien block extension node.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
* @extends ve.dm.MWBlockExtensionNode
|
|
|
|
* @mixins ve.dm.MWAlienExtensionNode
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [element] Reference to element in linear model
|
|
|
|
* @param {ve.dm.Node[]} [children]
|
|
|
|
*/
|
|
|
|
ve.dm.MWAlienBlockExtensionNode = function VeDmMWAlienBlockExtensionNode() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.dm.MWAlienBlockExtensionNode.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Mixin constructors
|
|
|
|
ve.dm.MWAlienExtensionNode.call( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.dm.MWAlienBlockExtensionNode, ve.dm.MWBlockExtensionNode );
|
|
|
|
|
|
|
|
OO.mixinClass( ve.dm.MWAlienBlockExtensionNode, ve.dm.MWAlienExtensionNode );
|
|
|
|
|
|
|
|
/* Static members */
|
|
|
|
|
|
|
|
ve.dm.MWAlienBlockExtensionNode.static.name = 'mwAlienBlockExtension';
|
|
|
|
|
|
|
|
ve.dm.MWAlienBlockExtensionNode.static.tagName = 'div';
|
|
|
|
|
2013-08-07 05:21:10 +00:00
|
|
|
/* Registration */
|
|
|
|
|
2015-03-23 15:49:38 +00:00
|
|
|
ve.dm.modelRegistry.register( ve.dm.MWAlienInlineExtensionNode );
|
|
|
|
ve.dm.modelRegistry.register( ve.dm.MWAlienBlockExtensionNode );
|