mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Merge "Add --wikidom flag to parse.js"
This commit is contained in:
commit
28e44b1d0f
|
@ -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,
|
||||
|
@ -103,6 +107,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 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue