r103589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103588‎ | r103589 | r103590 >
Date:14:48, 18 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Improve internal link handling
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -145,8 +145,8 @@
146146 if (bs.attribs === undefined) {
147147 bs.attribs = [];
148148 }
149 - bs.attribs.push(['startPos', blockStart]);
150 - bs.attribs.push(['endPos', pos]);
 149+ bs.attribs.push(['data-startPos', blockStart]);
 150+ bs.attribs.push(['data-endPos', pos]);
151151 return b;
152152 }
153153
@@ -432,10 +432,13 @@
433433 name: 'a',
434434 attribs: [['data-type', 'internal']]
435435 };
 436+ obj.attribs.push(['href', target]);
436437 if (text && text.length) {
437 - obj.attribs.push(['href', text[0][1]]); // ehhhh
 438+ var textTokens = text[0][1]; // XXX
 439+ } else {
 440+ var textTokens = [{type: 'TEXT', value: target}];
438441 }
439 - return [obj, {type: 'ENDTAG', name: 'a'}];
 442+ return [obj].concat(textTokens, [{type: 'ENDTAG', name: 'a'}]);
440443 }
441444
442445 link_target
@@ -446,7 +449,7 @@
447450 x:inlineline { return x }
448451 )* {
449452 clearFlag('linkdesc')
450 - return h.join('');
 453+ return h;
451454 }
452455 / & { clearFlag('linkdesc') } { return null; }
453456

Status & tagging log