https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112899
Revision: 112899
Author: gwicke
Date: 2012-03-02 14:19:33 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
Use some options primitively.
Modified Paths:
--------------
trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js
Modified: trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js
===================================================================
--- trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js
2012-03-02 14:13:12 UTC (rev 112898)
+++ trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js
2012-03-02 14:19:33 UTC (rev 112899)
@@ -58,6 +58,7 @@
// XXX: get /wiki from config!
var a = new TagTk( 'a', [ new KV( 'href', '/wiki' + title.makeLink() )
] );
+ a.dataAttribs = token.dataAttribs;
var MD5 = new jshashes.MD5(),
hash = MD5.hex( title.key ),
@@ -70,6 +71,8 @@
var contentPos = token.dataAttribs.contentPos;
var optionSource = token.source.substr( contentPos[0], contentPos[1] -
contentPos[0] );
console.log( 'optionSource: ' + optionSource );
+ // XXX: The trouble with re-parsing is the need to re-expand templates.
+ // Figure out often non-image links contain image-like parameters!
var options = this.imageParser.processImageOptions( optionSource );
//console.log( JSON.stringify( options, null, 2 ) );
// XXX: check if the file exists, generate thumbnail
@@ -77,10 +80,10 @@
var img = new SelfclosingTagTk( 'img',
[
// FIXME!
- new KV( 'height', '220' ),
- new KV( 'width', '1941' ),
+ new KV( 'height', options.height || '220' ),
+ new KV( 'width', options.width || '1941' ),
new KV( 'src', path ),
- new KV( 'alt', title.key )
+ new KV( 'alt', options.alt || title.key )
] );
return { tokens: [ a, img, new EndTagTk( 'a' )] };
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs