From 8a30f76370c9cd3ccb121269ac5ce73a740dd7ab Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Fri, 4 May 2012 11:15:35 +0200 Subject: [PATCH] Use upright option, including the 0.75 default width Change-Id: Iacdf6173e0ee8f58ca4385fd9b2cde77b2fdf3c4 --- modules/parser/ext.core.LinkHandler.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/parser/ext.core.LinkHandler.js b/modules/parser/ext.core.LinkHandler.js index 16cc65e8af..3658ce1ec8 100644 --- a/modules/parser/ext.core.LinkHandler.js +++ b/modules/parser/ext.core.LinkHandler.js @@ -212,7 +212,18 @@ WikiLinkHandler.prototype.renderThumb = function ( token, manager, cb, title, pa a.dataAttribs.optionHash = oHash; a.dataAttribs.optionList = options; - var figurestyle = "width: 165px;", + var width = 165; + + // Handle upright + if ( 'aspect' in oHash ) { + if ( oHash.aspect > 0 ) { + width = width * oHash.aspect; + } else { + width *= 0.75; + } + } + + var figurestyle = "width: " + (width + 5) + "px;", figureclass = "thumb tright thumbinner"; // set horizontal alignment @@ -257,7 +268,7 @@ WikiLinkHandler.prototype.renderThumb = function ( token, manager, cb, title, pa 'img', [ new KV('src', path), - new KV('width', '160px'), + new KV('width', width + 'px'), //new KV('height', '160px'), new KV('class', 'thumbimage'), new KV('alt', oHash.alt || title.key ),