File size: 654 Bytes
f56a29b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { parse, stringifyDoc } from './parse-stringify'
import { walker } from './walker.js'
class MML2OMML {
constructor(mmlString, options = {}) {
this.inString = mmlString
this.inXML = parse(mmlString, options)
this.outXML = false
this.outString = false
}
run() {
const outXML = {}
walker({ children: this.inXML, type: 'root' }, outXML)
this.outXML = outXML
}
getResult() {
this.outString = stringifyDoc([this.outXML])
return this.outString
}
}
export const mml2omml = (mmlString, options) => {
const converter = new MML2OMML(mmlString, options)
converter.run()
return converter.getResult()
}
|