r60700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60699‎ | r60700 | r60701 >
Date:23:00, 5 January 2010
Author:tparscal
Status:ok
Tags:
Comment:
Bumped and rebuilt for r60699.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -78,14 +78,14 @@
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 55 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 9 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 13 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 14 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 131 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 132 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 131 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 132 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -3086,8 +3086,10 @@
30873087 var sanatizedStr = wikitext.replace( /{{/, " " );
30883088 // Replace end
30893089 endBraces = sanatizedStr.match( /}}\s*$/ );
3090 - sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " +
3091 - sanatizedStr.substring( endBraces.index + 2 );
 3090+ if ( endBraces ) {
 3091+ sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " +
 3092+ sanatizedStr.substring( endBraces.index + 2 );
 3093+ }
30923094 // Match the open braces we just found with equivalent closing braces note, works for any level of braces
30933095 while ( sanatizedStr.indexOf( '{{' ) != -1 ) {
30943096 startIndex = sanatizedStr.indexOf( '{{' ) + 1;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -194,8 +194,9 @@
195195 return retVal;};this.getName=function(){if(typeof ranges[templateNameIndex].newVal=='undefined'){return wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}else{return ranges[templateNameIndex].newVal;}};this.setName=function(name){ranges[templateNameIndex].newVal=name;};this.setValue=function(name,value){return getSetValue(name,value,false);};this.getValue=function(name){return getSetValue(name,null,false);};this.getOriginalValue=function(name){return getSetValue(name,null,true);};this.getAllParamNames=function(){return paramsByName;};this.getAllInitialParams=function(){return params;}
196196 this.getOriginalText=function(){return wikitext;};this.getText=function(){newText="";for(i=0;i<ranges.length;i++){if(typeof ranges[i].newVal=='undefined'){newText+=wikitext.substring(ranges[i].begin,ranges[i].end);}else{newText+=ranges[i].newVal;}}
197197 return newText;};if(wikitext.match(/\s*{{\s*\S*:/)){}
198 -var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+
199 -sanatizedStr.substring(endBraces.index+2);while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while(openBraces>0){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;}
 198+var sanatizedStr=wikitext.replace(/{{/," ");endBraces=sanatizedStr.match(/}}\s*$/);if(endBraces){sanatizedStr=sanatizedStr.substring(0,endBraces.index)+" "+
 199+sanatizedStr.substring(endBraces.index+2);}
 200+while(sanatizedStr.indexOf('{{')!=-1){startIndex=sanatizedStr.indexOf('{{')+1;openBraces=2;endIndex=startIndex;while(openBraces>0){var brace=sanatizedStr[++endIndex];openBraces+=brace=='}'?-1:brace=='{'?1:0;}
200201 sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[{}|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);}
201202 var ranges=[];var params=[];var templateNameIndex=0;var doneParsing=false;oldDivider=0;divider=sanatizedStr.indexOf('|',oldDivider);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;}
202203 nameMatch=wikitext.substring(0,divider).match(/[^{\s]+/);if(nameMatch!=undefined){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60699Fixed bug that happens when the match returns null.tparscal22:59, 5 January 2010

Status & tagging log