Debian Codegraph @

unpacked/extensions/a11y/semantic-enrich.js

raw
1 MathJax.Extension["semantic-enrich"] = {
2 version: "1.6.0",
3 config: MathJax.Hub.CombineConfig("semantic-enrich", {
4 disabled: !1
5 }),
6 dependents: [],
7 running: !1,
8 mstyleLookup: {
9 mi: [ "mathvariant" ],
10 mo: [ "mathvariant", "accent", "largeop", "form", "fence", "separator", "movablelimits" ],
11 mn: [ "mathvariant" ],
12 mtext: [ "mathvariant" ],
13 ms: [ "mathvariant" ],
14 mfrac: [ "linethickness" ],
15 mfenced: [ "open", "close", "separators" ],
16 menclose: [ "notation" ],
17 munder: [ "accentunder" ],
18 mover: [ "accent" ],
19 munderover: [ "accent", "accentunder" ]
20 },
21 Filter: function(t, a, e) {
22 if (delete t.enriched, !this.config.disabled) try {
23 this.running = !0;
24 var n = sre.Enrich.semanticMathmlSync(t.root.toMathML());
25 t.root = MathJax.InputJax.MathML.Parse.prototype.MakeMML(n), t.root.inputID = e.id,
26 t.enriched = !0, this.running = !1;
27 } catch (t) {
28 throw this.running = !1, t;
29 }
30 },
31 Enable: function(t, a) {
32 this.config.disabled = !1, t && MathJax.Hub.Queue([ "Reprocess", MathJax.Hub ]);
33 },
34 Disable: function(t, a) {
35 this.config.disabled = !0;
36 for (var e = this.dependents.length - 1; 0 <= e; e--) {
37 var n = this.dependents[e];
38 n.Disable && n.Disable(!1, a);
39 }
40 t && MathJax.Hub.Queue([ "Reprocess", MathJax.Hub ]);
41 },
42 Dependent: function(t) {
43 this.dependents.push(t);
44 }
45 }, function() {
46 var t = MathJax.Ajax.config.path;
47 t.a11y || (t.a11y = HUB.config.root + "/extensions/a11y"), t.SRE || (t.SRE = MathJax.Ajax.fileURL(t.a11y)),
48 MathJax.Ajax.Load("[SRE]/mathjax-sre.js"), MathJax.Hub.Register.StartupHook("Sre Ready", [ "loadComplete", MathJax.Ajax, "[SRE]/mathjax-sre.js" ]);
49 }(), MathJax.Callback.Queue([ "Require", MathJax.Ajax, "[MathJax]/jax/element/mml/jax.js" ], [ "Require", MathJax.Ajax, "[MathJax]/jax/input/MathML/config.js" ], [ "Require", MathJax.Ajax, "[MathJax]/jax/input/MathML/jax.js" ], [ "Require", MathJax.Ajax, "[MathJax]/extensions/toMathML.js" ], MathJax.Hub.Register.StartupHook("Sre Ready", function() {
50 var l = MathJax.ElementJax.mml, c = MathJax.Extension["semantic-enrich"];
51 l.mbase.Augment({
52 toMathMLattributes: function() {
53 var t = "mstyle" === this.type ? l.math.prototype.defaults : this.defaults, a = this.attrNames || l.copyAttributeNames, e = l.skipAttributes, n = l.copyAttributes, s = c.running && c.mstyleLookup[this.type] || [], i = [], h = this.attr || {};
54 if ("math" !== this.type || this.attr && "xmlns" in this.attr || i.push('xmlns="http://www.w3.org/1998/Math/MathML"'),
55 !this.attrNames) for (var r in t) e[r] || n[r] || !t.hasOwnProperty(r) || null != this[r] && this[r] !== t[r] && this.Get(r, null, 1) !== this[r] && this.toMathMLaddAttr(i, r, this[r]);
56 for (var o = 0, u = a.length; o < u; o++) 1 === n[a[o]] && !t.hasOwnProperty(a[o]) || (value = h[a[o]],
57 null == value && (value = this[a[o]]), null != value && this.toMathMLaddAttr(i, a[o], value));
58 for (o = 0, u = s.length; o < u; o++) r = s[o], t.hasOwnProperty(r) && !i["_" + r] && (value = this.Get(r, 1),
59 null != value && this.toMathMLaddAttr(i, r, value));
60 return this.toMathMLclass(i), i.length ? " " + i.join(" ") : "";
61 },
62 toMathMLaddAttr: function(t, a, e) {
63 t.push(a + '="' + this.toMathMLquote(e) + '"'), t["_" + a] = 1;
64 }
65 });
66 var a = l.mo.prototype.setTeXclass;
67 l.mo.Augment({
68 setTeXclass: function(t) {
69 this.getValues("form", "lspace", "rspace");
70 return this.useMMLspacing ? (this.texClass = l.TEXCLASS.NONE, this) : this.attr && this.attr["data-semantic-added"] ? (this.texClass = this.prevClass = l.TEXCLASS.NONE,
71 t) : a.apply(this, arguments);
72 }
73 });
74 }), function() {
75 MathJax.Hub.postInputHooks.Add([ "Filter", MathJax.Extension["semantic-enrich"] ], 50),
76 MathJax.Hub.Startup.signal.Post("Semantic Enrich Ready"), MathJax.Ajax.loadComplete("[a11y]/semantic-enrich.js");
77 });