@@ -22,7 +22,7 @@ const sre = require('speech-rule-engine');
22
22
23
23
24
24
const optionsDefault = {
25
- speak : true ,
25
+ speakText : true ,
26
26
speakRules : "mathspeak" ,
27
27
speakStyle : "default" ,
28
28
format : "TeX" ,
@@ -52,8 +52,7 @@ const sreconfig = function(data) {
52
52
style : data . speakStyle || 'default' ,
53
53
// TODO: What does that do?
54
54
minSTree : data . minSTree ,
55
- semantic : data . semantic ,
56
- speakText : true
55
+ semantic : data . semantic
57
56
} ;
58
57
if ( data . sre ) {
59
58
for ( let i = 0 , key ; key = data . sre [ i ] ; i ++ ) {
@@ -82,11 +81,12 @@ const main = function (data, callback) {
82
81
data . mml = true ;
83
82
84
83
mathjax . typeset ( data , function ( result , input ) {
85
- postprocessor ( speechConfig , result , input , callback ) ;
84
+ postprocessor ( data , result , input , callback ) ;
86
85
} )
87
86
} ;
88
87
89
- const postprocessor = function ( speechConfig , result , input , callback ) {
88
+ const postprocessor = function ( data , result , input , callback ) {
89
+ let speechConfig = sreconfig ( data ) ;
90
90
if ( result . error ) throw result . error ;
91
91
if ( ! result . mml && ! result . mmlNode ) throw new Error ( 'No MathML found. Please check the mathjax-node configuration' ) ;
92
92
if ( ! result . svgNode && ! result . htmlNode && ! result . mmlNode ) throw new Error ( 'No suitable output found. Either svgNode, htmlNode or mmlNode are required.' ) ;
@@ -99,7 +99,7 @@ const postprocessor = function (speechConfig, result, input, callback) {
99
99
result . streeXml = speechConfig . minSTree ? xml : sre . pprintXML ( xml ) ;
100
100
}
101
101
// return if no speakText is requested
102
- if ( ! speechConfig . speakText ) {
102
+ if ( ! data . speakText ) {
103
103
callback ( result , input ) ;
104
104
return
105
105
}
0 commit comments