Merge "Create remaining meta items in DM"

This commit is contained in:
jenkins-bot 2014-03-13 02:12:52 +00:00 committed by Gerrit Code Review
commit 4c67908f97
6 changed files with 209 additions and 3 deletions

View file

@ -756,12 +756,16 @@ $wgResourceModules += array(
'scripts' => array(
'modules/ve-mw/dm/metaitems/ve.dm.MWCategoryMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWDefaultSortMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWHiddenCategoryMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWIndexDisableMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWIndexForceMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWLanguageMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNewSectionEditDisableMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNewSectionEditForceMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNoContentConvertMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNoEditSectionMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNoGalleryMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWNoTitleConvertMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWRedirectMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWStaticRedirectMetaItem.js',
'modules/ve-mw/dm/metaitems/ve.dm.MWTOCDisableMetaItem.js',

View file

@ -0,0 +1,47 @@
/*!
* VisualEditor DataModel MWHiddenCategoryMetaItem class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel hidden category meta item (for __HIDDENCAT__).
*
* @class
* @extends ve.dm.MetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve.dm.MWHiddenCategoryMetaItem = function VeDmMWHiddenCategoryMetaItem( element ) {
// Parent constructor
ve.dm.MetaItem.call( this, element );
};
/* Inheritance */
OO.inheritClass( ve.dm.MWHiddenCategoryMetaItem, ve.dm.MetaItem );
/* Static Properties */
ve.dm.MWHiddenCategoryMetaItem.static.name = 'mwNoGallery';
ve.dm.MWHiddenCategoryMetaItem.static.group = 'mwNoGallery';
ve.dm.MWHiddenCategoryMetaItem.static.matchTagNames = [ 'meta' ];
ve.dm.MWHiddenCategoryMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/hiddencat' ];
ve.dm.MWHiddenCategoryMetaItem.static.toDataElement = function ( ) {
return { 'type': this.name };
};
ve.dm.MWHiddenCategoryMetaItem.static.toDomElements = function ( dataElement, doc ) {
var meta = doc.createElement( 'meta' );
meta.setAttribute( 'property', 'mw:PageProp/hiddencat' );
return [ meta ];
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWHiddenCategoryMetaItem );

View file

@ -0,0 +1,54 @@
/*!
* VisualEditor DataModel MWNoContentConvertMetaItem class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel disable content conversion meta item (for __NOCONTENTCONVERT__ and __NOCC__).
*
* @class
* @extends ve.dm.MetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve.dm.MWNoContentConvertMetaItem = function VeDmMWNoContentConvertMetaItem( element ) {
// Parent constructor
ve.dm.MetaItem.call( this, element );
};
/* Inheritance */
OO.inheritClass( ve.dm.MWNoContentConvertMetaItem, ve.dm.MetaItem );
/* Static Properties */
ve.dm.MWNoContentConvertMetaItem.static.name = 'mwNoContentConvert';
ve.dm.MWNoContentConvertMetaItem.static.group = 'mwNoContentConvert';
ve.dm.MWNoContentConvertMetaItem.static.matchTagNames = [ 'meta' ];
ve.dm.MWNoContentConvertMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/nocontentconvert', 'mw:PageProp/nocc' ];
ve.dm.MWNoContentConvertMetaItem.static.toDataElement = function ( domElements ) {
// HACK: Don't rely on Parsoid always putting the RDFa type as a property
return {
'type': this.name,
'originalProperty': domElements[0].getAttribute( 'property' )
};
};
ve.dm.MWNoContentConvertMetaItem.static.toDomElements = function ( dataElement, doc ) {
var meta = doc.createElement( 'meta' );
meta.setAttribute(
'property',
dataElement.attributes.originalProperty || 'mw:PageProp/nocontentconvert'
);
return [ meta ];
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWNoContentConvertMetaItem );

View file

@ -0,0 +1,47 @@
/*!
* VisualEditor DataModel MWNoGalleryMetaItem class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel disable gallery meta item (for __NOGALLERY__).
*
* @class
* @extends ve.dm.MetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve.dm.MWNoGalleryMetaItem = function VeDmMWNoGalleryMetaItem( element ) {
// Parent constructor
ve.dm.MetaItem.call( this, element );
};
/* Inheritance */
OO.inheritClass( ve.dm.MWNoGalleryMetaItem, ve.dm.MetaItem );
/* Static Properties */
ve.dm.MWNoGalleryMetaItem.static.name = 'mwNoGallery';
ve.dm.MWNoGalleryMetaItem.static.group = 'mwNoGallery';
ve.dm.MWNoGalleryMetaItem.static.matchTagNames = [ 'meta' ];
ve.dm.MWNoGalleryMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/nogallery' ];
ve.dm.MWNoGalleryMetaItem.static.toDataElement = function ( ) {
return { 'type': this.name };
};
ve.dm.MWNoGalleryMetaItem.static.toDomElements = function ( dataElement, doc ) {
var meta = doc.createElement( 'meta' );
meta.setAttribute( 'property', 'mw:PageProp/nogallery' );
return [ meta ];
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWNoGalleryMetaItem );

View file

@ -0,0 +1,54 @@
/*!
* VisualEditor DataModel MWNoTitleConvertMetaItem class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel disable title conversion meta item (for __NOTITILECONVERT__ and __NOTC__).
*
* @class
* @extends ve.dm.MetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve.dm.MWNoTitleConvertMetaItem = function VeDmMWNoTitleConvertMetaItem( element ) {
// Parent constructor
ve.dm.MetaItem.call( this, element );
};
/* Inheritance */
OO.inheritClass( ve.dm.MWNoTitleConvertMetaItem, ve.dm.MetaItem );
/* Static Properties */
ve.dm.MWNoTitleConvertMetaItem.static.name = 'mwNoTitleConvert';
ve.dm.MWNoTitleConvertMetaItem.static.group = 'mwNoTitleConvert';
ve.dm.MWNoTitleConvertMetaItem.static.matchTagNames = [ 'meta' ];
ve.dm.MWNoTitleConvertMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/notitleconvert', 'mw:PageProp/notc' ];
ve.dm.MWNoTitleConvertMetaItem.static.toDataElement = function ( domElements ) {
// HACK: Don't rely on Parsoid always putting the RDFa type as a property
return {
'type': this.name,
'originalProperty': domElements[0].getAttribute( 'property' )
};
};
ve.dm.MWNoTitleConvertMetaItem.static.toDomElements = function ( dataElement, doc ) {
var meta = doc.createElement( 'meta' );
meta.setAttribute(
'property',
dataElement.attributes.originalProperty || 'mw:PageProp/notitleconvert'
);
return [ meta ];
};
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWNoTitleConvertMetaItem );

View file

@ -298,7 +298,7 @@ ve.dm.mwExample.withMeta = [
{
'type': 'mwAlienMeta',
'attributes': {
'domElements': $( '<meta property="mw:PageProp/nocc" />' ).toArray()
'domElements': $( '<meta property="mw:ThisIsAnAlien" />' ).toArray()
}
},
{ 'type': '/mwAlienMeta' },
@ -424,7 +424,7 @@ ve.dm.mwExample.withMetaMetaData = [
{
'type': 'mwAlienMeta',
'attributes': {
'domElements': $( '<meta property="mw:PageProp/nocc" />' ).toArray()
'domElements': $( '<meta property="mw:ThisIsAnAlien" />' ).toArray()
}
}
],
@ -1691,7 +1691,7 @@ ve.dm.mwExample.domToDataCases = {
]
},
'document with meta elements': {
'body': '<!-- No content conversion --><meta property="mw:PageProp/nocc" /><p>Foo' +
'body': '<!-- No content conversion --><meta property="mw:ThisIsAnAlien" /><p>Foo' +
'<link rel="mw:PageProp/Category" href="./Category:Bar" />Bar' +
'<meta property="mw:foo" content="bar" />Ba<!-- inline -->z</p>' +
'<meta property="mw:bar" content="baz" /><!--barbaz-->' +