From 3f798a064675a5e6e7155005c4f9ccc505100afa Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sun, 30 Sep 2012 16:18:52 -0400 Subject: [PATCH 1/3] Add branch README file --- README-branch.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 README-branch.txt diff --git a/README-branch.txt b/README-branch.txt new file mode 100644 index 000000000..4592504e2 --- /dev/null +++ b/README-branch.txt @@ -0,0 +1 @@ +This is release branch v2.1 of MathJax From 9207aa2841ab24127be30f1a119ee05a6c28ccf5 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Sun, 28 Oct 2012 18:28:36 -0400 Subject: [PATCH 2/3] Remove branch file README file (it's supposed to make the branch be separate from master) --- README-branch.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 README-branch.txt diff --git a/README-branch.txt b/README-branch.txt deleted file mode 100644 index 4592504e2..000000000 --- a/README-branch.txt +++ /dev/null @@ -1 +0,0 @@ -This is release branch v2.1 of MathJax From 8803b00446ce19a45c166d427934974fa4c2e87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Mon, 25 Mar 2013 16:57:05 +0100 Subject: [PATCH 3/3] Ignore linebreak attribute on mspace when dimensional attributes are set. Fix issue #388. --- unpacked/jax/element/mml/jax.js | 11 ++++++++++- unpacked/jax/output/HTML-CSS/autoload/multiline.js | 12 ++++++++++-- unpacked/jax/output/SVG/autoload/multiline.js | 12 ++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/unpacked/jax/element/mml/jax.js b/unpacked/jax/element/mml/jax.js index 4dad22a4d..f401a5c61 100644 --- a/unpacked/jax/element/mml/jax.js +++ b/unpacked/jax/element/mml/jax.js @@ -638,7 +638,16 @@ MathJax.ElementJax.mml.Augment({ depth: "0ex", linebreak: MML.LINEBREAK.AUTO }, - hasNewline: function () {return (this.Get("linebreak") === MML.LINEBREAK.NEWLINE)} + hasDimAttr: function () { + return (this.hasValue("width") || this.hasValue("height") || + this.hasValue("depth")); + }, + hasNewline: function () { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + return (!this.hasDimAttr() && + this.Get("linebreak") === MML.LINEBREAK.NEWLINE); + } }); MML.ms = MML.mbase.Subclass({ diff --git a/unpacked/jax/output/HTML-CSS/autoload/multiline.js b/unpacked/jax/output/HTML-CSS/autoload/multiline.js index 639d0b35e..f4ba8218a 100644 --- a/unpacked/jax/output/HTML-CSS/autoload/multiline.js +++ b/unpacked/jax/output/HTML-CSS/autoload/multiline.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/HTML-CSS/autoload/multiline.js @@ -594,6 +596,12 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { HTMLbetterBreak: function (info,state) { if (info.values && info.values.id === this.spanID) {return false} var values = this.getValues("linebreak"); + var linebreakValue = values.linebreak; + if (!linebreakValue || this.hasDimAttr()) { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + linebreakValue = MML.LINEBREAK.AUTO; + } // // Get the default penalty for this location // @@ -609,8 +617,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { // Get the penalty for this type of break and // use it to modify the default penalty // - var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]; - if (values.linebreak === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit) + var linebreak = PENALTY[linebreakValue]; + if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit) {linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]} if (!(linebreak instanceof Array)) { // for breaks past the width, don't modify penalty diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js index 3025cb044..6553c1080 100644 --- a/unpacked/jax/output/SVG/autoload/multiline.js +++ b/unpacked/jax/output/SVG/autoload/multiline.js @@ -1,3 +1,5 @@ +/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/SVG/autoload/multiline.js @@ -541,6 +543,12 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { SVGbetterBreak: function (info,state) { if (info.values && info.values.last === this) {return false} var values = this.getValues("linebreak"); + var linebreakValue = values.linebreak; + if (!linebreakValue || this.hasDimAttr()) { + // The MathML spec says that the linebreak attribute should be ignored + // if any dimensional attribute is set. + linebreakValue = MML.LINEBREAK.AUTO; + } // // Get the default penalty for this location // @@ -555,8 +563,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { // Get the penalty for this type of break and // use it to modify the default penalty // - var linebreak = PENALTY[values.linebreak||MML.LINEBREAK.AUTO]; - if (values.linebreak === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000) + var linebreak = PENALTY[linebreakValue]; + if (linebreakValue === MML.LINEBREAK.AUTO && w >= PENALTY.spacelimit*1000) {linebreak = [(w+PENALTY.spaceoffset)*PENALTY.spacefactor]} if (!(linebreak instanceof Array)) { // for breaks past the width, don't modify penalty