-
Notifications
You must be signed in to change notification settings - Fork 107
/
convert-with-speech.html
187 lines (176 loc) · 4.23 KB
/
convert-with-speech.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width">
<title>Convert LaTeX or MathML to Speech</title>
<script>
MathJax = {
loader: {load: ['input/asciimath', 'input/mml', 'input/tex', 'output/svg', 'a11y/sre']},
tex: {inlineMath: [['$', '$'], ['\\(', '\\)']]},
startup: {
ready: function() {
MathJax.startup.defaultReady();
// Initialise convert when MathJax/SRE is fully loaded.
MathJax.startup.promise.then(function () {
Convert.init();
});
}
}
};
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js"></script>
<style>
body {
font-family: sans-serif
}
h2 {
margin: 1.5em 0 1em;
font-size: 120%;
}
h2:first-child {
margin-top: .5em;
}
.fullwidth {
width: 100%;
}
table.fullwidth tr {
vertical-align: baseline;
}
table.fullwidth td {
white-space: nowrap;
}
td.fullwidth input {
width: 100%;
box-sizing: border-box;
}
td.spacing {
width: 20%
}
.red {
color: #880000;
background-color: #FFEEEE;
}
.green {
color: #008800;
background-color: #EEFFEE;
}
#explanation {
display: inline-block;
box-sizing: border-box;
width: 100%;
min-width: 25em;
vertical-align: top;
margin-bottom: 2em;
line-height: 1.5;
padding-right: .75em;
}
.converter {
display: inline-block;
box-sizing: border-box;
width: 48%;
min-width: 25em;
vertical-align: top;
background-color: #F0F0F0;
border: 2px solid #CCC;
padding: .75em;
}
#input {
font-family: monospace;
font-size: 100%;
padding: .3em;
width: 100%;
box-sizing: border-box;
}
#configfile {
border: 1px solid #AAA;
padding: 2px;
font-family: monospace;
font-size: 100%
}
.speech {
border: 1px solid #AAA;
padding: .5em;
background-color: white;
}
.speech {
min-height: 8em;
border: 1px solid #AAA;
background-color: #F8F8F8;
padding: .5em .5em .5em 1.5em;
overflow: auto;
white-space: pre;
}
#errors code, #explanation code {
background-color: #EEE;
display: inline-block;
padding: 1px 2px;
border: 1px solid #AAA;
margin: 1px;
}
#explanation code {
padding: 0 2px;
}
</style>
<script src="./convert-with-speech.js"></script>
</head>
<body>
<h1>MathJax Speech Converter</h1>
<div id="explanation">
<p>
This tool converts math input expressions given in LaTeX, MathML or AsciiMath to
text output.
</p>
</div>
<div class="converter" id="inputpanel">
<H2>Input:</h2>
<textarea rows="15" cols="80" id="input">
</textarea>
<table class="fullwidth">
<tr>
<td><input type="radio" checked name="format" value="latex"><label for="latex">LaTeX</label></input></td>
<td><input type="radio" name="format" value="asciimath"><label for="asciimath">AsciiMath</label></input></td>
<td><input type="radio" name="format" value="mathml"><label for="mathml">MathML</label></input></td>
<td class="spacing"></td>
<td><label for="locale">Locale</label>
<select id="locale" onchange="Convert.updateLocale(value)">
</select>
</td>
<td><label for="locale">Markup</label>
<select id="markup" onchange="Convert.convertExpression()">
<option value="none">None</option>
<option value="punctuation">Punctuation</option>
<option value="ssml">SSML</option>
<option value="sable">Sable</option>
</select>
</td>
<td class="fullwidth"></td>
<td><input type="button" value="Convert"
onclick="Convert.convertExpression()"/></td>
</tr>
</table>
<h2>Expression:</h2>
<div id="rendered"></div>
</div>
<div class="converter" id="outputpanel">
<h2>Mathspeak Output:</h2>
<span><label for="locale">Style</label>
<select id="style" onchange="Convert.computeMathspeak()">
<option value="default">Verbose</option>
<option value="brief">Brief</option>
<option value="sbrief">Superbrief</option>
</select>
</span>
<pre class="speech" id="mathspeak">
</pre>
<h2>Clearspeak Output:</h2>
<pre class="speech" id="clearspeak">
</pre>
<div>
<label for="preferences">Preferences:</label>
<div id="preferences"></div>
</div>
</div>
</body>
</html>