mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Remove dual-type support for Languages and Categories
The new form was implemented in Parsoid and deployed in October, so enough time has passed that there is no longer any need for VisualEditor to support the old type. Bug: 56009 Change-Id: Ief2e584345ccdb0e7eb44ab16c4bc14f7c14f5ec
This commit is contained in:
parent
d2c74b18a7
commit
114a24f1d3
|
@ -30,14 +30,10 @@ ve.dm.MWCategoryMetaItem.static.group = 'mwCategory';
|
|||
|
||||
ve.dm.MWCategoryMetaItem.static.matchTagNames = [ 'link' ];
|
||||
|
||||
ve.dm.MWCategoryMetaItem.static.matchRdfaTypes = [
|
||||
'mw:WikiLink/Category', // old type, pre-bug 53432
|
||||
'mw:PageProp/Category' // new type
|
||||
];
|
||||
ve.dm.MWCategoryMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/Category' ];
|
||||
|
||||
ve.dm.MWCategoryMetaItem.static.toDataElement = function ( domElements ) {
|
||||
var firstDomElement = domElements[0],
|
||||
href = firstDomElement.getAttribute( 'href' ),
|
||||
var href = domElements[0].getAttribute( 'href' ),
|
||||
/*jshint regexp:false */
|
||||
matches = href.match( /^((?:\.\.?\/)*)(.*?)(?:#(.*))?$/ ),
|
||||
rawSortkey = matches[3] || '';
|
||||
|
@ -48,8 +44,7 @@ ve.dm.MWCategoryMetaItem.static.toDataElement = function ( domElements ) {
|
|||
'category': decodeURIComponent( matches[2] ).replace( /_/g, ' ' ),
|
||||
'origCategory': matches[2],
|
||||
'sortkey': decodeURIComponent( rawSortkey ).replace( /_/g, ' ' ),
|
||||
'origSortkey': rawSortkey,
|
||||
'origRel': firstDomElement.getAttribute( 'rel' )
|
||||
'origSortkey': rawSortkey
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -74,7 +69,7 @@ ve.dm.MWCategoryMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
|||
} else {
|
||||
category = encodeURIComponent( category );
|
||||
}
|
||||
domElement.setAttribute( 'rel', dataElement.attributes.origRel || 'mw:WikiLink/Category' );
|
||||
domElement.setAttribute( 'rel', 'mw:PageProp/Category' );
|
||||
href = hrefPrefix + category;
|
||||
if ( sortkey !== '' ) {
|
||||
href += '#' + sortkey;
|
||||
|
|
|
@ -28,26 +28,21 @@ ve.dm.MWLanguageMetaItem.static.name = 'mwLanguage';
|
|||
|
||||
ve.dm.MWLanguageMetaItem.static.matchTagNames = [ 'link' ];
|
||||
|
||||
ve.dm.MWLanguageMetaItem.static.matchRdfaTypes = [
|
||||
'mw:WikiLink/Language', // old type, pre-bug 53432
|
||||
'mw:PageProp/Language' // new type
|
||||
];
|
||||
ve.dm.MWLanguageMetaItem.static.matchRdfaTypes = [ 'mw:PageProp/Language' ];
|
||||
|
||||
ve.dm.MWLanguageMetaItem.static.toDataElement = function ( domElements ) {
|
||||
var firstDomElement = domElements[0],
|
||||
href = firstDomElement.getAttribute( 'href' );
|
||||
var href = domElements[0].getAttribute( 'href' );
|
||||
return {
|
||||
'type': 'mwLanguage',
|
||||
'attributes': {
|
||||
'href': href,
|
||||
'origRel': firstDomElement.getAttribute( 'rel' )
|
||||
'href': href
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
ve.dm.MWLanguageMetaItem.static.toDomElements = function ( dataElement, doc ) {
|
||||
var domElement = doc.createElement( 'link' );
|
||||
domElement.setAttribute( 'rel', dataElement.attributes.origRel || 'mw:WikiLink/Language' );
|
||||
domElement.setAttribute( 'rel', 'mw:PageProp/Language' );
|
||||
domElement.setAttribute( 'href', dataElement.attributes.href );
|
||||
return [ domElement ];
|
||||
};
|
||||
|
|
|
@ -24,14 +24,14 @@ ve.dm.mwExample.MWTransclusion = {
|
|||
'inlineOpenModified': '<span about="#mwt1" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}" data-parsoid="{"tsr":[18,34],"src":"{{Inline|1,234}}","dsr":[18,34,null,null]}">',
|
||||
'inlineContent': '$1,234.00',
|
||||
'inlineClose': '</span>',
|
||||
'mixed': '<link about="#mwt1" rel="mw:WikiLink/Category" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}"><span about="#mwt1">Foo</span>',
|
||||
'mixed': '<link about="#mwt1" rel="mw:PageProp/Category" typeof="mw:Transclusion" data-mw="{"id":"mwt1","target":{"wt":"Inline"},"params":{"1":{"wt":"5,678"}}}"><span about="#mwt1">Foo</span>',
|
||||
'pairOne': '<p about="#mwt1" typeof="mw:Transclusion" data-mw="{"params":{"1":{"wt":"foo"}}}" data-parsoid="1">foo</p>',
|
||||
'pairTwo': '<p about="#mwt2" typeof="mw:Transclusion" data-mw="{"params":{"1":{"wt":"foo"}}}" data-parsoid="2">foo</p>',
|
||||
'meta':
|
||||
'<link rel="mw:WikiLink/Category" href="./Category:Page" about="#mwt1" typeof="mw:Transclusion" ' +
|
||||
'<link rel="mw:PageProp/Category" href="./Category:Page" about="#mwt1" typeof="mw:Transclusion" ' +
|
||||
'data-mw="{"target":{"wt":"Template:Echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Page]]\\n[[Category:Book]]"}},"i":0}">' +
|
||||
'<span about="#mwt1" data-parsoid="{}">\n</span>' +
|
||||
'<link rel="mw:WikiLink/Category" href="./Category:Book" about="#mwt1">'
|
||||
'<link rel="mw:PageProp/Category" href="./Category:Book" about="#mwt1">'
|
||||
};
|
||||
ve.dm.mwExample.MWTransclusion.blockData = {
|
||||
'type': 'mwTransclusionBlock',
|
||||
|
@ -98,7 +98,7 @@ ve.dm.mwExample.MWTransclusion.mixedDataOpen = {
|
|||
'htmlAttributes': [
|
||||
{ 'values': {
|
||||
'about': '#mwt1',
|
||||
'rel': 'mw:WikiLink/Category',
|
||||
'rel': 'mw:PageProp/Category',
|
||||
'typeof': 'mw:Transclusion',
|
||||
'data-mw': '{\"id\":\"mwt1\",\"target\":{\"wt\":\"Inline\"},\"params\":{\"1\":{\"wt\":\"5,678\"}}}'
|
||||
} },
|
||||
|
@ -255,8 +255,7 @@ ve.dm.mwExample.withMeta = [
|
|||
'category': 'Category:Bar',
|
||||
'origCategory': 'Category:Bar',
|
||||
'sortkey': '',
|
||||
'origSortkey': '',
|
||||
'origRel': 'mw:PageProp/Category'
|
||||
'origSortkey': ''
|
||||
},
|
||||
'htmlAttributes': [
|
||||
{
|
||||
|
@ -313,8 +312,7 @@ ve.dm.mwExample.withMeta = [
|
|||
'category': 'Category:Foo foo',
|
||||
'origCategory': 'Category:Foo_foo',
|
||||
'sortkey': 'Bar baz#quux',
|
||||
'origSortkey': 'Bar baz%23quux',
|
||||
'origRel': 'mw:PageProp/Category'
|
||||
'origSortkey': 'Bar baz%23quux'
|
||||
},
|
||||
|
||||
'htmlAttributes': [
|
||||
|
@ -388,7 +386,7 @@ ve.dm.mwExample.withMetaMetaData = [
|
|||
'htmlAttributes': [
|
||||
{
|
||||
'values': {
|
||||
'rel': 'mw:WikiLink/Category',
|
||||
'rel': 'mw:PageProp/Category',
|
||||
'href': './Category:Bar'
|
||||
},
|
||||
'computed': {
|
||||
|
@ -441,7 +439,7 @@ ve.dm.mwExample.withMetaMetaData = [
|
|||
'origSortkey': 'Bar baz%23quux'
|
||||
},
|
||||
'htmlAttributes': [ { 'values': {
|
||||
'rel': 'mw:WikiLink/Category',
|
||||
'rel': 'mw:PageProp/Category',
|
||||
'href': './Category:Foo_foo#Bar baz%23quux'
|
||||
} } ]
|
||||
},
|
||||
|
@ -1553,7 +1551,7 @@ ve.dm.mwExample.domToDataCases = {
|
|||
},
|
||||
'whitespace preservation with wrapped comments and language links': {
|
||||
'body': 'Foo\n' +
|
||||
'<link rel="mw:WikiLink/Language" href="http://de.wikipedia.org/wiki/Foo">\n' +
|
||||
'<link rel="mw:PageProp/Language" href="http://de.wikipedia.org/wiki/Foo">\n' +
|
||||
'<link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Foo">',
|
||||
'data': [
|
||||
{
|
||||
|
@ -1570,14 +1568,13 @@ ve.dm.mwExample.domToDataCases = {
|
|||
{
|
||||
'type': 'mwLanguage',
|
||||
'attributes': {
|
||||
'href': 'http://de.wikipedia.org/wiki/Foo',
|
||||
'origRel': 'mw:WikiLink/Language'
|
||||
'href': 'http://de.wikipedia.org/wiki/Foo'
|
||||
},
|
||||
'htmlAttributes': [
|
||||
{
|
||||
'values': {
|
||||
'href': 'http://de.wikipedia.org/wiki/Foo',
|
||||
'rel': 'mw:WikiLink/Language'
|
||||
'rel': 'mw:PageProp/Language'
|
||||
},
|
||||
'computed': {
|
||||
'href': 'http://de.wikipedia.org/wiki/Foo'
|
||||
|
@ -1590,8 +1587,7 @@ ve.dm.mwExample.domToDataCases = {
|
|||
{
|
||||
'type': 'mwLanguage',
|
||||
'attributes': {
|
||||
'href': 'http://fr.wikipedia.org/wiki/Foo',
|
||||
'origRel': 'mw:PageProp/Language'
|
||||
'href': 'http://fr.wikipedia.org/wiki/Foo'
|
||||
},
|
||||
'htmlAttributes': [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue