r60213 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60212‎ | r60213 | r60214 >
Date:19:39, 18 December 2009
Author:nimishg
Status:ok (Comments)
Tags:
Comment:
fixed name-finding issue and comments chomping 1 char
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -331,11 +331,12 @@
332332 divider = sanatizedStr.length;
333333 doneParsing = true;
334334 }
335 - nameMatch = wikitext.substring( oldDivider, divider ).match( /[^{\s]+/ );
 335+ nameMatch = wikitext.substring( 0, divider ).match( /[^{\s]+/ );
336336 if ( nameMatch != undefined ) {
337 - ranges.push( new Range( oldDivider,nameMatch.index ) ); //whitespace and squiggles upto the name
 337+ ranges.push( new Range( 0 ,nameMatch.index ) ); //whitespace and squiggles upto the name
 338+ nameEndMatch = sanatizedStr.substring( 0 , divider ).match( /[^\s]\s*$/ ); //last nonwhitespace character
338339 templateNameIndex = ranges.push( new Range( nameMatch.index,
339 - nameMatch.index + nameMatch[0].length ) );
 340+ nameEndMatch.index + 1 ) );
340341 templateNameIndex--; //push returns 1 less than the array
341342 ranges[templateNameIndex].old = wikitext.substring( ranges[templateNameIndex].begin,
342343 ranges[templateNameIndex].end );
@@ -359,7 +360,7 @@
360361 if ( currentField.indexOf( '=' ) == -1 ) {
361362 // anonymous field, gets a number
362363 valueBegin = currentField.match( /\S+/ ); //first nonwhitespace character
363 - valueBeginIndex = valueBegin.index + oldDivider + 1;
 364+ valueBeginIndex = valueBegin.index + oldDivider+1;
364365 valueEnd = currentField.match( /[^\s]\s*$/ ); //last nonwhitespace character
365366 valueEndIndex = valueEnd.index + oldDivider + 2;
366367 ranges.push( new Range( ranges[ranges.length-1].end,
@@ -383,7 +384,6 @@
384385 nameBegin = currentName.match( /\S+/ );
385386 if ( nameBegin == null ) {
386387 // This is a comment inside a template call / parser abuse. let's not encourage it
387 - divider++;
388388 currentParamNumber--;
389389 continue;
390390 }

Comments

#Comment by Catrope (talk | contribs)   21:48, 18 December 2009

Needs recombine and style version bump

Status & tagging log