Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -334,7 +334,8 @@ |
335 | 335 | ParserTests.prototype.normalizeOut = function ( out ) { |
336 | 336 | // TODO: Do not strip newlines in pre and nowiki blocks! |
337 | 337 | return out.replace(/[\r\n]| data-mw-[a-zA-Z-]+="[^">]*"/g, '') |
338 | | - .replace(/<!--.*?-->\n?/gm, ''); |
| 338 | + .replace(/<!--.*?-->\n?/gm, '') |
| 339 | + .replace(/<\/?meta[^>]*>/g, ''); |
339 | 340 | }; |
340 | 341 | |
341 | 342 | ParserTests.prototype.formatHTML = function ( source ) { |
Index: trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | var dumpReader = require('./dumpReader.js'), |
3 | 3 | events = require('events'), |
4 | | - optimist = require('optimist'); |
| 4 | + optimist = require('optimist'), |
| 5 | + colors = require('colors'); |
5 | 6 | |
6 | 7 | function DumpGrepper ( regexp ) { |
7 | 8 | // inherit from EventEmitter |
— | — | @@ -16,7 +17,7 @@ |
17 | 18 | if ( bits.length > 1 ) { |
18 | 19 | this.emit( 'match', revision, bits ); |
19 | 20 | } |
20 | | -} |
| 21 | +}; |
21 | 22 | |
22 | 23 | module.exports.DumpGrepper = DumpGrepper; |
23 | 24 | |
— | — | @@ -34,14 +35,20 @@ |
35 | 36 | flags += 'i'; |
36 | 37 | } |
37 | 38 | |
| 39 | + var re = new RegExp( '(' + argv._[0] + ')', flags ); |
| 40 | + |
38 | 41 | var reader = new dumpReader.DumpReader(), |
39 | | - grepper = new DumpGrepper( new RegExp( '(' + argv._[0] + ')', flags ) ); |
| 42 | + grepper = new DumpGrepper( re ); |
40 | 43 | |
41 | 44 | reader.on( 'revision', grepper.grepRev.bind( grepper ) ); |
42 | 45 | grepper.on( 'match', function ( revision, bits ) { |
43 | | - console |
44 | | - console.log( 'Match:' + revision.page.title ) |
45 | | - console.log( bits.map( function ( s ) { return s.substr(0, 40) } ) ); |
| 46 | + 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 ) ); |
| 51 | + } |
| 52 | + //console.log( bits.map( function ( s ) { return s.substr(0, 40) } ) ); |
46 | 53 | } ); |
47 | 54 | process.stdin.setEncoding('utf8'); |
48 | 55 | process.stdin.on('data', reader.push.bind(reader) ); |