r112594 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112593‎ | r112594 | r112595 >
Date:13:48, 28 February 2012
Author:gwicke
Status:deferred
Tags:
Comment:
Finish color highlighting for dump grepper / fix broken commit r112592.
Modified paths:
  • /trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js
@@ -27,6 +27,11 @@
2828 description: 'Case-insensitive matching',
2929 'boolean': true,
3030 'default': false
 31+ },
 32+ 'color': {
 33+ description: 'Highlight matched substring using color',
 34+ 'boolean': true,
 35+ 'default': true
3136 }
3237 } ).argv;
3338
@@ -43,12 +48,14 @@
4449 reader.on( 'revision', grepper.grepRev.bind( grepper ) );
4550 grepper.on( 'match', function ( revision, bits ) {
4651 console.log( 'Match:' + revision.page.title );
47 - for ( var i = 0, l = bits.length; i < l-1; i++ ) {
48 - var m = bits[i+1].match( re )[0];
49 - console.log( 'm: ' + m );
50 - console.log( bits[i].substr(-40) + m.green + bits[i+1].substr( m.length, 40 ) );
 52+ for ( var i = 0, l = bits.length; i < l-1; i += 2 ) {
 53+ var m = bits[i+1];
 54+ if ( argv.color ) {
 55+ console.log( bits[i].substr(-40) + m.green + bits[i+2].substr( 0, 40 ) );
 56+ } else {
 57+ console.log( bits[i].substr(-40) + m + bits[i+2].substr( 0, 40 ) );
 58+ }
5159 }
52 - //console.log( bits.map( function ( s ) { return s.substr(0, 40) } ) );
5360 } );
5461 process.stdin.setEncoding('utf8');
5562 process.stdin.on('data', reader.push.bind(reader) );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112592Implement onlyinclude transformer. 254 tests passing.gwicke13:21, 28 February 2012

Status & tagging log