Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/131345

Change subject: add support for AsciiMath input; use STIX SVG font
......................................................................

add support for AsciiMath input; use STIX SVG font

Change-Id: I15cb2d1cb0533a2fa0e21012198387501a3b42ea
---
M engine.js
M index.html
M main.js
3 files changed, 19 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mathoid 
refs/changes/45/131345/1

diff --git a/engine.js b/engine.js
index 0dc39f2..a3c6c28 100644
--- a/engine.js
+++ b/engine.js
@@ -2,6 +2,7 @@
 window.engine = (new (function() {
 
   this.Q = MathJax.Hub.queue;
+  this.asciimath = null;
   this.tex = null;
   this.mml = null;
   this.buffer = [];
@@ -33,6 +34,12 @@
   // Initialize engine.
   this._init = function() {
     this.Q.Push(this.bind(function () {
+      this.asciimath = {
+        div: document.getElementById("math-asciimath"),
+        jax: MathJax.Hub.getAllJax("math-asciimath")[0],
+        last_width: null,
+        last_q: ''
+      }
       this.tex = {
         div: document.getElementById("math-tex"),
         jax: MathJax.Hub.getAllJax("math-tex")[0],
diff --git a/index.html b/index.html
index 812704d..aecedba 100644
--- a/index.html
+++ b/index.html
@@ -5,14 +5,17 @@
 <head>
     <script type="text/javascript">
         MathJax = {
-            jax: ["input/TeX",
+            jax: ["input/TeX", "input/AsciiMath",
                 "input/MathML","output/SVG","output/NativeMML"],
-            extensions: ["mml2jax.js",
+            extensions: ["mml2jax.js", "asciimath2jax.js",
                 "tex2jax.js","toMathML.js", 
"TeX/noErrors.js","TeX/noUndefined.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
             showProcessingMessages: false,
             messageStyle: "none",
             tex2jax: {
                 inlineMath: [["$","$"]]
+            },
+            SVG: {
+                font: 'STIX-Web'
             }
         };
     </script>
@@ -24,11 +27,13 @@
     <h1>svgtex bench file</h1>
     <p>TeX equation:</p>
     <div id="math-tex">${\frac{x}{2}}$</div>
+    <p>AsciiMath equation:</p>
+    <div id="math-asciimath">`x/2`</div>
     <p>MathML equation:</p>
     <div id="math-mml">
       <math>
         <mfrac>
-          <mi>y</mi>
+          <mi>x</mi>
           <mn>2</mn>
         </mfrac>
       </math>
diff --git a/main.js b/main.js
index 8813a28..df84399 100644
--- a/main.js
+++ b/main.js
@@ -189,6 +189,10 @@
               mml = '';
               src = 'mathml';
           }
+          else if (query.type == 'asciimath'){
+              mml = '';
+              src = 'asciimath';
+          }
           //End of fix
           out = JSON.stringify({input:src,
               svg:svg_or_error,

-- 
To view, visit https://gerrit.wikimedia.org/r/131345
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I15cb2d1cb0533a2fa0e21012198387501a3b42ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to