GWicke has submitted this change and it was merged.

Change subject: Merge recent changes from MathJax
......................................................................


Merge recent changes from MathJax

Fixes problems with align environment and
invalid XML markup (bcc2390).

Bug: 66572
Change-Id: If6739965b4c7d9110f489e5c973a7bfa0e8d329f
---
M MathJaxNode/mathjax/unpacked/extensions/toMathML.js
M MathJaxNode/mathjax/unpacked/jax/element/mml/jax.js
M MathJaxNode/mathjax/unpacked/jax/output/NativeMML/jax.js
M mathoid-worker.js
4 files changed, 66 insertions(+), 65 deletions(-)

Approvals:
  Frédéric Wang: Looks good to me, but someone else must approve
  GWicke: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MathJaxNode/mathjax/unpacked/extensions/toMathML.js 
b/MathJaxNode/mathjax/unpacked/extensions/toMathML.js
index 61fb02a..aae34f7 100644
--- a/MathJaxNode/mathjax/unpacked/extensions/toMathML.js
+++ b/MathJaxNode/mathjax/unpacked/extensions/toMathML.js
@@ -52,13 +52,14 @@
 
     toMathMLattributes: function () {
       var attr = [], defaults = this.defaults;
-      var copy = (this.attrNames||MML.copyAttributeNames), skip = 
MML.skipAttributes;
+      var names = (this.attrNames||MML.copyAttributeNames),
+          skip = MML.skipAttributes, copy = MML.copyAttributes;
 
       if (this.type === "math" && (!this.attr || !this.attr.xmlns))
         {attr.push('xmlns="http://www.w3.org/1998/Math/MathML";')}
       if (!this.attrNames) {
         if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
-        for (var id in defaults) {if (!skip[id] && 
defaults.hasOwnProperty(id)) {
+        for (var id in defaults) {if (!skip[id] && !copy[id] && 
defaults.hasOwnProperty(id)) {
           if (this[id] != null && this[id] !== defaults[id]) {
             var value = this[id]; delete this[id];
             if (this.Get(id) !== value) 
{attr.push(id+'="'+this.toMathMLattribute(value)+'"')}
@@ -66,10 +67,10 @@
           }
         }}
       }
-      for (var i = 0, m = copy.length; i < m; i++) {
-        if (copy[i] === "class") continue;  // this is handled separately below
-        value = (this.attr||{})[copy[i]]; if (value == null) {value = 
this[copy[i]]}
-        if (value != null) 
{attr.push(copy[i]+'="'+this.toMathMLquote(value)+'"')}
+      for (var i = 0, m = names.length; i < m; i++) {
+        if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) 
continue;
+        value = (this.attr||{})[names[i]]; if (value == null) {value = 
this[names[i]]}
+        if (value != null) 
{attr.push(names[i]+'="'+this.toMathMLquote(value)+'"')}
       }
       this.toMathMLclass(attr);
       if (attr.length) {return " "+attr.join(" ")} else {return ""}
diff --git a/MathJaxNode/mathjax/unpacked/jax/element/mml/jax.js 
b/MathJaxNode/mathjax/unpacked/jax/element/mml/jax.js
index bff6b2f..c7c0ac6 100644
--- a/MathJaxNode/mathjax/unpacked/jax/element/mml/jax.js
+++ b/MathJaxNode/mathjax/unpacked/jax/element/mml/jax.js
@@ -4,21 +4,21 @@
 /*************************************************************
  *
  *  MathJax/jax/element/mml/jax.js
- *
+ *  
  *  Implements the MML ElementJax that holds the internal represetation
  *  of the mathematics on the page.  Various InputJax will produce this
  *  format, and the OutputJax will display it in various formats.
  *
  *  ---------------------------------------------------------------------
- *
+ *  
  *  Copyright (c) 2009-2014 The MathJax Consortium
- *
+ * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -214,14 +214,17 @@
     NONE:   -1
   },
   TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", 
"INNER", "VCENTER"],
+  skipAttributes: {
+    texClass:true, useHeight:true, texprimestyle:true
+  },
   copyAttributes: {
+    displaystyle:1, scriptlevel:1, open:1, close:1, form:1,
     fontfamily:true, fontsize:true, fontweight:true, fontstyle:true,
     color:true, background:true,
-    id:true, "class":true, href:true, style:true
+    id:true, "class":1, href:true, style:true
   },
-  skipAttributes: {texClass: true, useHeight: true, texprimestyle: true},
   copyAttributeNames: [
-    "open", "close", "form",  // force these to be copied
+    "displaystyle", "scriptlevel", "open", "close", "form",  // force these to 
be copied
     "fontfamily", "fontsize", "fontweight", "fontstyle",
     "color", "background",
     "id", "class", "href", "style"
@@ -254,7 +257,7 @@
       texClass: true
     },
     linebreakContainer: false,
-
+    
     Init: function () {
       this.data = [];
       if (this.inferRow && !(arguments.length === 1 && arguments[0].inferred))
@@ -435,7 +438,7 @@
       return this;
     }
   });
-
+  
   MML.mi = MML.mbase.Subclass({
     type: "mi", isToken: true,
     texClass: MML.TEXCLASS.ORD,
@@ -466,7 +469,7 @@
       return this;
     }
   });
-
+  
   MML.mn = MML.mbase.Subclass({
     type: "mn", isToken: true,
     texClass: MML.TEXCLASS.ORD,
@@ -478,7 +481,7 @@
       dir: MML.INHERIT
     }
   });
-
+  
   MML.mo = MML.mbase.Subclass({
     type: "mo", isToken: true,
     defaults: {
@@ -675,7 +678,7 @@
       return this;
     }
   });
-
+  
   MML.mtext = MML.mbase.Subclass({
     type: "mtext", isToken: true,
     isSpacelike: function () {return true},
@@ -1047,7 +1050,7 @@
     },
     setTeXclass: MML.mbase.setBaseTeXclasses
   });
-
+  
   MML.msub = MML.msubsup.Subclass({type: "msub"});
   MML.msup = MML.msubsup.Subclass({type: "msup", sub:2, sup:1});
   MML.mmultiscripts = MML.msubsup.Subclass({
@@ -1059,7 +1062,7 @@
   });
   MML.mprescripts = MML.mbase.Subclass({type: "mprescripts"});
   MML.none = MML.mbase.Subclass({type: "none"});
-
+  
   MML.munderover = MML.mbase.Subclass({
     type: "munderover",
     base: 0, under: 1, over: 2, sub: 1, sup: 2,
@@ -1103,7 +1106,7 @@
     },
     setTeXclass: MML.mbase.setBaseTeXclasses
   });
-
+  
   MML.munder = MML.munderover.Subclass({type: "munder"});
   MML.mover = MML.munderover.Subclass({
     type: "mover", over: 1, under: 2, sup: 1, sub: 2,
@@ -1136,6 +1139,9 @@
       texClass: MML.TEXCLASS.ORD,
       useHeight: 1
     },
+    adjustChild_displaystyle: function () {
+      return (this.displaystyle != null ? this.displaystyle : 
this.defaults.displaystyle);
+    },
     inheritFromMe: true,
     noInherit: {
       mover: {align: true},
@@ -1145,7 +1151,7 @@
         align: true, rowalign: true, columnalign: true, groupalign: true,
         alignmentscope: true, columnwidth: true, width: true, rowspacing: true,
         columnspacing: true, rowlines: true, columnlines: true, frame: true,
-        framespacing: true, equalrows: true, equalcolumns: true,
+        framespacing: true, equalrows: true, equalcolumns: true, displaystyle: 
true,
         side: true, minlabelspacing: true, texClass: true, useHeight: 1
       }
     },
@@ -1231,7 +1237,7 @@
   MML.mlabeledtr = MML.mtr.Subclass({
     type: "mlabeledtr"
   });
-
+  
   MML.maction = MML.mbase.Subclass({
     type: "maction",
     defaults: {
@@ -1253,7 +1259,7 @@
       return this.selected().setTeXclass(prev);
     }
   });
-
+  
   MML.semantics = MML.mbase.Subclass({
     type: "semantics", notParent: true,
     isEmbellished: MML.mbase.childEmbellished,
@@ -1345,14 +1351,14 @@
       return this.data[0].getAnnotation(name);
     }
   });
-
+  
   MML.chars = MML.mbase.Subclass({
     type: "chars",
     Append: function () {this.data.push.apply(this.data,arguments)},
     value: function () {return this.data.join("")},
     toString: function () {return this.data.join("")}
   });
-
+  
   MML.entity = MML.mbase.Subclass({
     type: "entity",
     Append: function () {this.data.push.apply(this.data,arguments)},
@@ -1369,7 +1375,7 @@
            + String.fromCharCode((n&0x3FF)+0xDC00);
     }
   });
-
+  
   MML.xml = MML.mbase.Subclass({
     type: "xml",
     Init: function () {
@@ -1412,7 +1418,7 @@
     value: function () {return this.div},
     toString: function () {return this.div.innerHTML}
   });
-
+  
   MML.TeXAtom = MML.mbase.Subclass({
     type: "texatom",
     inferRow: true, notParent: true,
@@ -1426,11 +1432,11 @@
     },
     adjustTeXclass: MML.mo.prototype.adjustTeXclass
   });
-
+  
   MML.NULL = MML.mbase().With({type:"null"});
 
   var TEXCLASS = MML.TEXCLASS;
-
+  
   var MO = {
     ORD:        [0,0,TEXCLASS.ORD],
     ORD11:      [1,1,TEXCLASS.ORD],
@@ -1751,7 +1757,7 @@
   },{
     OPTYPES: MO
   });
-
+  
   //
   //  These are not in the W3C table, but FF works this way,
   //  and it makes sense, so add it here
@@ -1763,7 +1769,7 @@
   OPTABLE.prefix["\u2225"] = MO.OPEN;
   OPTABLE.postfix["\u2223"] = MO.CLOSE;
   OPTABLE.postfix["\u2225"] = MO.CLOSE;
-
+  
 })(MathJax.ElementJax.mml);
 
 MathJax.ElementJax.mml.loadComplete("jax.js");
diff --git a/MathJaxNode/mathjax/unpacked/jax/output/NativeMML/jax.js 
b/MathJaxNode/mathjax/unpacked/jax/output/NativeMML/jax.js
index 45fbc74..dd87723 100644
--- a/MathJaxNode/mathjax/unpacked/jax/output/NativeMML/jax.js
+++ b/MathJaxNode/mathjax/unpacked/jax/output/NativeMML/jax.js
@@ -7,17 +7,17 @@
  *
  *  Implements the NativeMML OutputJax that displays mathematics
  *  using a browser's native MathML capabilities (if any).
- *
+ *  
  *  ---------------------------------------------------------------------
- *
+ *  
  *  Copyright (c) 2010-2014 The MathJax Consortium
- *
+ * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,11 +27,11 @@
 
 (function (nMML,HUB,AJAX,HTML) {
   var MML, isMSIE = HUB.Browser.isMSIE;
-
+  
   var EVENT, TOUCH, HOVER, ZOOM; // filled in later
 
   HUB.Register.StartupHook("MathZoom Ready",function () {ZOOM = 
MathJax.Extension.MathZoom});
-
+  
   var NOPADDING = function (side,obj) {
     var span = HTML.Element("span"); side = "padding"+side;
     if (obj) {
@@ -41,7 +41,7 @@
       }
     }
   };
-
+  
   var CELLSPACING = function (obj,rowSpacing,columnSpacing) {
     //
     // Webkit default padding on mtd cells is simply
@@ -79,7 +79,7 @@
       obj.setAttribute("style",span.style.cssText);
     }
   };
-
+ 
   nMML.Augment({
     //
     //  User can configure styles
@@ -105,15 +105,15 @@
           "min-width": 0, "min-height": 0,
           border: 0, padding: 0, margin: 0
         },
-
+        
         "span.MathJax_MathML": {
           display: "inline!important"
         },
-
+        
         "div.MathJax_MathML": {
           display: "block!important"
         },
-
+        
         ".MathJax_mmlExBox": {
           display:"block!important", overflow:"hidden",
           height:"1px", width:"60ex",
@@ -126,7 +126,7 @@
     settings: HUB.config.menuSettings,
     ex: 1, scale: 1,  // filled in later
     adjustWidths: [], // array of elements to have their widths adjusted
-
+    
     Config: function () {
       this.SUPER(arguments).Config.call(this);
       if (this.settings.scale) {this.config.scale = this.settings.scale}
@@ -221,7 +221,7 @@
         document.body.removeChild(this.EmExSpan);
       }
     },
-
+    
     preTranslate: function (state) {
       var scripts = state.jax[this.id], i, m = scripts.length,
           script, prev, span, test, math, jax, ex, mex, scale;
@@ -286,7 +286,7 @@
 
     //
     //  Add a SPAN to use as a container, and render the math into it
-    //
+    //  
     Translate: function (script) {
       if (!script.parentNode) return;
       //
@@ -343,7 +343,7 @@
         sheet.disabled = true; sheet.disabled = false;
       }
     },
-
+    
     //
     //  Remove MathML preceeding the script
     //
@@ -540,13 +540,13 @@
         return math;
       }
     });
-
+    
     MML.mrow.Augment({
       //
       //  Make inferred rows not include an mrow tag
       //
       toNativeMML: function (parent) {
-        var i, m;
+        var i, m; 
        if (this.inferred  && this.parent.inferRow) {
          for (i = 0, m = this.data.length; i < m; i++) {
            if (this.data[i]) {this.data[i].toNativeMML(parent)}
@@ -827,7 +827,7 @@
           parent.appendChild(mtr);
         }
       });
-
+      
       MML.mtd.Augment({
         toNativeMML: function (parent) {
           var tag = parent.appendChild(this.NativeMMLelement(this.type));
@@ -842,7 +842,7 @@
           }
         }
       });
-
+      
       MML.mspace.Augment({
         toNativeMML: function (parent) {
           this.SUPER(arguments).toNativeMML.call(this,parent);
@@ -915,7 +915,7 @@
         });
       }
     }
-
+    
     MML.math.Augment({
       toNativeMML: function (parent,jax) {
         var tag = this.NativeMMLelement(this.type), math = tag;
@@ -975,7 +975,7 @@
         parent.appendChild(math);
         //
         //  Firefox can't seem to get the width of <math> elements right, so
-        //  use an <mrow> to get the actual width and set the style on the
+        //  use an <mrow> to get the actual width and set the style on the 
         //  parent element to match.  Even if we set the <math> width properly,
         //  it doesn't seem to propagate up to the <span> correctly.
         //
@@ -1086,7 +1086,7 @@
         if (!isOpera) {
           //
           // Append the opening fence
-          //
+          // 
           operator = this.NativeMMLelement("mo");
           operator.setAttribute("fence", "true");
           operator.textContent = values.open;
@@ -1152,7 +1152,7 @@
        parent.appendChild(document.createTextNode(this.toString()));
       }
     });
-
+    
     MML.xml.Augment({
       //
       //  Insert the XML verbatim
@@ -1312,7 +1312,7 @@
     //
     setTimeout(MathJax.Callback(["loadComplete",nMML,"jax.js"]),0);
   });
-
+  
 
   //
   //  Determine browser characteristics
@@ -1362,7 +1362,7 @@
       nMML.mmultiscriptsBug = true;
     }
   });
-
+  
 
   HUB.Register.StartupHook("End Cookie",function () {
     if (HUB.config.menuSettings.zoom !== "None")
diff --git a/mathoid-worker.js b/mathoid-worker.js
index 7daa3eb..21cbfd1 100644
--- a/mathoid-worker.js
+++ b/mathoid-worker.js
@@ -101,12 +101,6 @@
             data.log = "success";
         }
 
-        // Temporary work-around for a duplicate attribute (invalid XML)
-        // returned by MathJax.
-        if (data.mml) {
-            data.mml = data.mml.replace(/<mstyle displaystyle="[^"]+" 
(?=displaystyle)/g, '<mstyle ');
-        }
-
         // Strip some styling returned by MathJax
         if (data.svg) {
             data.svg = data.svg.replace(/style="([^"]+)"/, function(match, 
style) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6739965b4c7d9110f489e5c973a7bfa0e8d329f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Frédéric Wang <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to