2014-04-22 21:07:13 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel MWDisplayTitleMetaItem class.
|
|
|
|
*
|
2016-01-03 22:56:59 +00:00
|
|
|
* @copyright 2011-2016 VisualEditor Team and others; see AUTHORS.txt
|
2014-04-22 21:07:13 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DataModel display title meta item.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.dm.MetaItem
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} element Reference to element in meta-linmod
|
|
|
|
*/
|
2016-08-22 21:44:59 +00:00
|
|
|
ve.dm.MWDisplayTitleMetaItem = function VeDmMWDisplayTitleMetaItem() {
|
2014-04-22 21:07:13 +00:00
|
|
|
// Parent constructor
|
2016-08-22 21:44:59 +00:00
|
|
|
ve.dm.MWDisplayTitleMetaItem.super.apply( this, arguments );
|
2014-04-22 21:07:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.dm.MWDisplayTitleMetaItem, ve.dm.MetaItem );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.name = 'mwDisplayTitle';
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.group = 'mwDisplayTitle';
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.matchTagNames = [ 'meta' ];
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/displaytitle' ];
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.toDataElement = function ( domElements ) {
|
2015-08-19 17:33:02 +00:00
|
|
|
var content = domElements[ 0 ].getAttribute( 'content' );
|
2014-04-22 21:07:13 +00:00
|
|
|
return {
|
2014-08-22 20:50:48 +00:00
|
|
|
type: this.name,
|
|
|
|
attributes: {
|
|
|
|
content: content
|
2014-04-22 21:07:13 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
ve.dm.MWDisplayTitleMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
|
|
|
var meta = doc.createElement( 'meta' );
|
|
|
|
meta.setAttribute( 'property', 'mw:PageProp/displaytitle' );
|
|
|
|
meta.setAttribute( 'content', dataElement.attributes.content );
|
|
|
|
return [ meta ];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.dm.modelRegistry.register( ve.dm.MWDisplayTitleMetaItem );
|