2014-04-22 21:07:13 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel MWDisplayTitleMetaItem class.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright 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 ) {
|
2024-05-21 14:22:56 +00:00
|
|
|
const 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 ) {
|
2024-05-21 14:22:56 +00:00
|
|
|
const meta = doc.createElement( 'meta' );
|
2014-04-22 21:07:13 +00:00
|
|
|
meta.setAttribute( 'property', 'mw:PageProp/displaytitle' );
|
|
|
|
meta.setAttribute( 'content', dataElement.attributes.content );
|
|
|
|
return [ meta ];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.dm.modelRegistry.register( ve.dm.MWDisplayTitleMetaItem );
|