Index: trunk/extensions/VisualEditor/modules/parser/ext.core.LinkHandler.js |
— | — | @@ -58,6 +58,7 @@ |
59 | 59 | |
60 | 60 | // XXX: get /wiki from config! |
61 | 61 | var a = new TagTk( 'a', [ new KV( 'href', '/wiki' + title.makeLink() ) ] ); |
| 62 | + a.dataAttribs = token.dataAttribs; |
62 | 63 | |
63 | 64 | var MD5 = new jshashes.MD5(), |
64 | 65 | hash = MD5.hex( title.key ), |
— | — | @@ -70,6 +71,8 @@ |
71 | 72 | var contentPos = token.dataAttribs.contentPos; |
72 | 73 | var optionSource = token.source.substr( contentPos[0], contentPos[1] - contentPos[0] ); |
73 | 74 | 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! |
74 | 77 | var options = this.imageParser.processImageOptions( optionSource ); |
75 | 78 | //console.log( JSON.stringify( options, null, 2 ) ); |
76 | 79 | // XXX: check if the file exists, generate thumbnail |
— | — | @@ -77,10 +80,10 @@ |
78 | 81 | var img = new SelfclosingTagTk( 'img', |
79 | 82 | [ |
80 | 83 | // 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' ), |
83 | 86 | new KV( 'src', path ), |
84 | | - new KV( 'alt', title.key ) |
| 87 | + new KV( 'alt', options.alt || title.key ) |
85 | 88 | ] ); |
86 | 89 | |
87 | 90 | return { tokens: [ a, img, new EndTagTk( 'a' )] }; |