r112899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112898‎ | r112899 | r112900 >
Date:14:19, 2 March 2012
Author:gwicke
Status:deferred
Tags:
Comment:
Use some options primitively.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js
@@ -58,6 +58,7 @@
5959
6060 // XXX: get /wiki from config!
6161 var a = new TagTk( 'a', [ new KV( 'href', '/wiki' + title.makeLink() ) ] );
 62+ a.dataAttribs = token.dataAttribs;
6263
6364 var MD5 = new jshashes.MD5(),
6465 hash = MD5.hex( title.key ),
@@ -70,6 +71,8 @@
7172 var contentPos = token.dataAttribs.contentPos;
7273 var optionSource = token.source.substr( contentPos[0], contentPos[1] - contentPos[0] );
7374 console.log( 'optionSource: ' + optionSource );
 75+ // XXX: The trouble with re-parsing is the need to re-expand templates.
 76+ // Figure out often non-image links contain image-like parameters!
7477 var options = this.imageParser.processImageOptions( optionSource );
7578 //console.log( JSON.stringify( options, null, 2 ) );
7679 // XXX: check if the file exists, generate thumbnail
@@ -77,10 +80,10 @@
7881 var img = new SelfclosingTagTk( 'img',
7982 [
8083 // FIXME!
81 - new KV( 'height', '220' ),
82 - new KV( 'width', '1941' ),
 84+ new KV( 'height', options.height || '220' ),
 85+ new KV( 'width', options.width || '1941' ),
8386 new KV( 'src', path ),
84 - new KV( 'alt', title.key )
 87+ new KV( 'alt', options.alt || title.key )
8588 ] );
8689
8790 return { tokens: [ a, img, new EndTagTk( 'a' )] };

Status & tagging log