mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
More tweaks: safesubst and image options
* Ignore safesubst for now * Remove an unneeded whitelist entry * Make sure the caption is not lost for thumbs (fix to last commit) and remove debug print Change-Id: I243584ed0838cf7c3b4110fe9cdf869272477312
This commit is contained in:
parent
7fe5a86b60
commit
aaca5eac7d
|
@ -74,6 +74,7 @@ WikiLinkHandler.prototype._simpleImageOptions = {
|
|||
'left': 'halign',
|
||||
'right': 'halign',
|
||||
'center': 'halign',
|
||||
'float': 'halign',
|
||||
'none': 'halign',
|
||||
// valign
|
||||
'baseline': 'valign',
|
||||
|
@ -152,7 +153,7 @@ WikiLinkHandler.prototype.renderFile = function ( token, manager, cb, title ) {
|
|||
if ( bits.length > 1 && key) {
|
||||
oHash[key] = bits[1];
|
||||
options.push( new KV( key, bits[1] ) );
|
||||
console.warn('handle prefix ' + bits );
|
||||
//console.warn('handle prefix ' + bits );
|
||||
} else {
|
||||
// neither simple nor prefix option, add original
|
||||
// tokens to caption.
|
||||
|
@ -160,10 +161,10 @@ WikiLinkHandler.prototype.renderFile = function ( token, manager, cb, title ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
caption = caption.concat( oContent.v );
|
||||
}
|
||||
}
|
||||
//console.warn('caption: ' + JSON.stringify( caption ) );
|
||||
|
||||
|
||||
//var contentPos = token.dataAttribs.contentPos;
|
||||
//var optionSource = token.source.substr( contentPos[0], contentPos[1] - contentPos[0] );
|
||||
|
|
|
@ -160,6 +160,10 @@ TemplateHandler.prototype._expandTemplate = function ( tplExpandData ) {
|
|||
|
||||
this.manager.env.dp( 'argHash: ', args );
|
||||
|
||||
|
||||
// XXX: strip subst for now..
|
||||
target = target.replace( /^(safe)?subst:/, '' );
|
||||
|
||||
var prefix = target.split(':', 1)[0].toLowerCase().trim();
|
||||
if ( prefix && 'pf_' + prefix in this.parserFunctions ) {
|
||||
var funcArg = target.substr( prefix.length + 1 );
|
||||
|
@ -310,7 +314,7 @@ TemplateHandler.prototype._stripEOFTk = function ( tokens ) {
|
|||
*/
|
||||
TemplateHandler.prototype._processTemplateAndTitle = function( pipeline, src, title ) {
|
||||
// Feed the pipeline. XXX: Support different formats.
|
||||
this.manager.env.dp( 'TemplateHandler._processTemplateAndTitle: ', src );
|
||||
this.manager.env.dp( 'TemplateHandler._processTemplateAndTitle: ', title, src );
|
||||
pipeline.process ( src );
|
||||
};
|
||||
|
||||
|
@ -372,6 +376,7 @@ TemplateHandler.prototype.onTemplateArg = function ( token, frame, cb ) {
|
|||
|
||||
token.resultTokens = false;
|
||||
|
||||
// XXX: get this from the cache!
|
||||
new AttributeTransformManager (
|
||||
this.manager,
|
||||
this._returnArgAttributes.bind( this, token, cb, frame )
|
||||
|
|
|
@ -188,9 +188,6 @@ MWParserEnvironment.prototype.normalizeTitle = function( name ) {
|
|||
|
||||
name = name.trim().replace(/[\s_]+/g, '_');
|
||||
|
||||
// XXX: strip subst for now..
|
||||
name = name.replace( /^subst:/, '' );
|
||||
|
||||
// Implement int: as alias for MediaWiki:
|
||||
if ( name.substr( 0, 4 ) === 'int:' ) {
|
||||
name = 'MediaWiki:' + name.substr( 4 );
|
||||
|
|
|
@ -30,8 +30,6 @@ testWhiteList["A table with no data."] = "<table></table>";
|
|||
testWhiteList["A table with nothing but a caption"] = "<table><caption> caption</caption></table>";
|
||||
testWhiteList["Fuzz testing: Parser22"] = "<p><a href=\"http://===r:::https://b\">http://===r:::https://b</a></p><table></table>";
|
||||
|
||||
testWhiteList["Nested table"] = "<table border=\"1\"><tbody><tr><td> α</td><td><table bgcolor=\"#ABCDEF\" border=\"2\"><tbody><tr><td>nested</td></tr><tr><td>table</td></tr></tbody></table></td><td>the original table again</td></tr></tbody></table>";
|
||||
|
||||
// Very minor whitespace difference at end of cell (MediaWiki inserts a
|
||||
// newline before the close tag even if there was no trailing space in the cell)
|
||||
testWhiteList["Table rowspan"] = "<table border=\"1\"><tbody><tr><td> Cell 1, row 1 </td><td rowspan=\"2\"> Cell 2, row 1 (and 2) </td><td> Cell 3, row 1 </td></tr><tr><td> Cell 1, row 2 </td><td> Cell 3, row 2 </td></tr></tbody></table>";
|
||||
|
|
Loading…
Reference in a new issue