mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Add --wikidom flag to parse.js
Also remove unused import of DOMConverter Change-Id: I1eabe6bf9935970c1f049681b52e867a510ea77a
This commit is contained in:
parent
de4fb0c8c4
commit
47969e20a1
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue