r61212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61211‎ | r61212 | r61213 >
Date:20:26, 18 January 2010
Author:nimishg
Status:ok
Tags:
Comment:
handles HTML comments inside templates somewhat reasonably
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
@@ -429,6 +429,16 @@
430430 sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " +
431431 sanatizedStr.substring( endBraces.index + 2 );
432432 }
 433+
 434+ //treat HTML comments like whitespace
 435+ while ( sanatizedStr.indexOf( '<!' ) != -1 ) {
 436+ startIndex = sanatizedStr.indexOf( '<!' );
 437+ endIndex = sanatizedStr.indexOf('-->') + 3;
 438+ sanatizedSegment = sanatizedStr.substring( startIndex,endIndex ).replace( /\S/g , ' ' );
 439+ sanatizedStr =
 440+ sanatizedStr.substring( 0, startIndex ) + sanatizedSegment + sanatizedStr.substring( endIndex );
 441+ }
 442+
433443 // Match the open braces we just found with equivalent closing braces note, works for any level of braces
434444 while ( sanatizedStr.indexOf( '{{' ) != -1 ) {
435445 startIndex = sanatizedStr.indexOf( '{{' ) + 1;

Status & tagging log