From 47969e20a160d5e34791140aa06f00350b249f2d Mon Sep 17 00:00:00 2001 From: Catrope Date: Thu, 5 Apr 2012 18:30:18 -0700 Subject: [PATCH] Add --wikidom flag to parse.js Also remove unused import of DOMConverter Change-Id: I1eabe6bf9935970c1f049681b52e867a510ea77a --- modules/parser/parse.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/parser/parse.js b/modules/parser/parse.js index 3cc7fbe053..d031f52710 100644 --- a/modules/parser/parse.js +++ b/modules/parser/parse.js @@ -8,10 +8,9 @@ var ParserPipeline = require('./mediawiki.parser.js').ParserPipeline, ParserEnv = require('./mediawiki.parser.environment.js').MWParserEnvironment, - DOMConverter = require('./mediawiki.DOMConverter.js').DOMConverter, optimist = require('optimist'); -( function() { +( function() { var opts = optimist.usage( 'Usage: echo wikitext | $0', { 'help': { description: 'Show this message', @@ -23,6 +22,11 @@ var ParserPipeline = require('./mediawiki.parser.js').ParserPipeline, 'boolean': true, 'default': false }, + 'wikidom': { + description: 'Output WikiDOM instead of HTML', + 'boolean': true, + 'default': false + }, 'debug': { description: 'Debug mode', 'boolean': true, @@ -91,6 +95,8 @@ var ParserPipeline = require('./mediawiki.parser.js').ParserPipeline, // Print out the html if ( argv.linearmodel ) { process.stdout.write( parser.getLinearModel( document ) ); + } else if ( argv.wikidom ) { + process.stdout.write( parser.getWikiDom( document ) ); } else { process.stdout.write( document.body.innerHTML ); }