commit c275962b7710c3d158504c74b80a429adaa71a31
parent 8b5de06a56040d08600af1cd90816326d9021e98
Author: Davide P. Cervone <dpvc@union.edu>
Date: Mon, 1 Apr 2013 08:24:49 -0400
Merge remote-tracking branch 'fred/issue388' into develop
Resolves issue #388.
Diffstat:
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git 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
@@ -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
@@ -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