mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Merge "Rename data-mw into data-rt"
This commit is contained in:
commit
681b0d4d40
|
@ -86,7 +86,7 @@ Sanitizer.prototype._stripIDNs = function ( host ) {
|
|||
* Sanitize any tag.
|
||||
*
|
||||
* XXX: Make attribute sanitation reversible by storing round-trip info in
|
||||
* token.dataAttribs object (which is serialized as JSON in a data-mw
|
||||
* token.dataAttribs object (which is serialized as JSON in a data-rt
|
||||
* attribute in the DOM).
|
||||
*/
|
||||
Sanitizer.prototype.onAny = function ( token ) {
|
||||
|
|
|
@ -81,7 +81,7 @@ FauxHTML5.TreeBuilder.prototype.processToken = function (token) {
|
|||
attribs = attribs.concat([
|
||||
{
|
||||
// Mediawiki-specific round-trip / non-semantic information
|
||||
k: 'data-mw',
|
||||
k: 'data-rt',
|
||||
v: dataMW
|
||||
} ] );
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ var annotationTypes = {
|
|||
'span': 'textStyle/span',
|
||||
'a': function( node ) {
|
||||
// FIXME the parser currently doesn't output this data this way
|
||||
// Internal links get linkType:'internal' in the data-mw-rt attrib,
|
||||
// Internal links get linkType:'internal' in the data-rt attrib,
|
||||
// external links get nothing
|
||||
var atype = node.getAttribute( 'data-type' );
|
||||
if ( atype ) {
|
||||
|
|
|
@ -654,7 +654,7 @@ WSP.tagHandlers = {
|
|||
if ( state.prevToken.constructor === TagTk && state.prevToken.name === 'tbody' ) {
|
||||
// Omit for first row in a table. XXX: support optional trs
|
||||
// for first line (in source wikitext) too using some flag in
|
||||
// data-mw (stx: 'wikitext' ?)
|
||||
// data-rt (stx: 'wikitext' ?)
|
||||
return '';
|
||||
} else {
|
||||
return WSP._serializeTableTag("|-", '', state, token );
|
||||
|
@ -1300,7 +1300,7 @@ WSP._getDOMAttribs = function( attribs ) {
|
|||
var out = [];
|
||||
for ( var i = 0, l = attribs.length; i < l; i++ ) {
|
||||
var attrib = attribs.item(i);
|
||||
if ( attrib.name !== 'data-mw' ) {
|
||||
if ( attrib.name !== 'data-rt' ) {
|
||||
out.push( { k: attrib.name, v: attrib.value } );
|
||||
}
|
||||
}
|
||||
|
@ -1308,8 +1308,8 @@ WSP._getDOMAttribs = function( attribs ) {
|
|||
};
|
||||
|
||||
WSP._getDOMRTInfo = function( attribs ) {
|
||||
if ( attribs['data-mw'] ) {
|
||||
return JSON.parse( attribs['data-mw'].value || '{}' );
|
||||
if ( attribs['data-rt'] ) {
|
||||
return JSON.parse( attribs['data-rt'].value || '{}' );
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ testWhiteList["Invalid attributes in table cell (bug 1830)"] = "<table><tbody><t
|
|||
testWhiteList["Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)"] = "<table><tbody><tr><td> |<a href=\"ftp://|x||\">[1]</a>\" onmouseover=\"alert(document.cookie)\">test</td></tr></tbody></table>";
|
||||
|
||||
// Sanitizer, but UTF8 in link is ok in HTML5
|
||||
testWhiteList["External link containing double-single-quotes with no space separating the url from text in italics"] = "<p><a href=\"http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm\" data-mw=\"{"sourcePos":[0,146]}\"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href=\"/wiki/Museo_Picasso_(París)\">Museo Picasso</a>.</p>";
|
||||
testWhiteList["External link containing double-single-quotes with no space separating the url from text in italics"] = "<p><a href=\"http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm\" data-rt=\"{"sourcePos":[0,146]}\"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href=\"/wiki/Museo_Picasso_(París)\">Museo Picasso</a>.</p>";
|
||||
|
||||
testWhiteList["External links: wiki links within external link (Bug 3695)"] = "<p><a href=\"http://example.com\"></a><a href=\"/wiki/Wikilink\">wikilink</a> embedded in ext link</p>";
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ ParserTests.prototype.normalizeOut = function ( out ) {
|
|||
return out
|
||||
.replace(/<span data-gen=[^>]*>((?:[^<]+|(?!<\/span).)*)<\/span>/g,
|
||||
'$1')
|
||||
.replace(/[\r\n]| (data-mw|typeof|resource|rel|prefix|about|rev|datatype|inlist|property|vocab|content)="[^">]*"/g, '')
|
||||
.replace(/[\r\n]| (data-rt|typeof|resource|rel|prefix|about|rev|datatype|inlist|property|vocab|content)="[^">]*"/g, '')
|
||||
.replace(/<!--.*?-->\n?/gm, '')
|
||||
.replace(/<\/?meta[^>]*>/g, '');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue