-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforminput.js
40 lines (36 loc) · 1.22 KB
/
forminput.js
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
/* https://github.com/mathjax/MathJax/issues/2210 */
(() => {
const {Configuration} = MathJax._.input.tex.Configuration;
const {CommandMap} = MathJax._.input.tex.SymbolMap;
const TEXCLASS = MathJax._.core.MmlTree.MmlNode.TEXCLASS;
new CommandMap("input", {input: "Input"}, {
Input(parser, token) {
const size = parser.GetBrackets(token);
const cls = parser.GetBrackets(token);
const value = parser.GetBrackets(token);
const name = parser.GetArgument(token);
const xml = parser.create("node", "XML");
xml.setXML(MathJax.startup.adaptor.node("input", {
class: cls,
id: name,
name,
size,
value,
xmlns: "http://www.w3.org/1999/xhtml"
}), MathJax.startup.adaptor);
xml.getSerializedXML = function () {
return this.adaptor.outerHTML(this.xml) + "</input>";
};
parser.Push(
parser.create("node", "TeXAtom", [
parser.create("node", "semantics", [
parser.create("node", "annotation-xml", [
xml
], {encoding: "application/xhtml+xml"})
])
], {texClass: TEXCLASS.ORD})
);
}
});
Configuration.create("input", {handler: {macro: ["input"]}});
})();