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 ); }