commit be03d699463fba896f90e3046b0814d527368771 Author: Thibaut Cuvelier <tcuvel...@lyx.org> Date: Mon Mar 11 01:30:48 2024 +0100
MathML: don't output delimiters in InsetMathBinom and InsetMathDelim if the delimiter is a space. --- src/mathed/InsetMathDelim.cpp | 23 ++++++++++++++--------- src/mathed/InsetMathFrac.cpp | 21 +++++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp index 78d26fceea..d32029b818 100644 --- a/src/mathed/InsetMathDelim.cpp +++ b/src/mathed/InsetMathDelim.cpp @@ -189,15 +189,20 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const void InsetMathDelim::mathmlize(MathMLStream & ms) const { - ms << MTag("mrow") - << MTagInline("mo", "form='prefix' fence='true' stretchy='true' symmetric='true'") - << convertDelimToXMLEscape(left_) - << ETagInline("mo") - << cell(0) - << MTagInline("mo", "form='postfix' fence='true' stretchy='true' symmetric='true'") - << convertDelimToXMLEscape(right_) - << ETagInline("mo") - << ETag("mrow"); + // Ignore the delimiter if: it is empty or only a space (one character). + if (!left_.empty() && ((left_.size() == 1 && left_[0] != ' ') || left_.size() > 1)) { + ms << MTag("mrow") + << MTagInline("mo", "form='prefix' fence='true' stretchy='true' symmetric='true'") + << convertDelimToXMLEscape(left_) + << ETagInline("mo"); + } + ms << cell(0); + if (!right_.empty() && ((right_.size() == 1 && right_[0] != ' ') || right_.size() > 1)) { + ms << MTagInline("mo", "form='postfix' fence='true' stretchy='true' symmetric='true'") + << convertDelimToXMLEscape(right_) + << ETagInline("mo") + << ETag("mrow"); + } } diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp index f6f2f95b0a..b0ff55bc4d 100644 --- a/src/mathed/InsetMathFrac.cpp +++ b/src/mathed/InsetMathFrac.cpp @@ -768,15 +768,20 @@ void InsetMathBinom::mathmlize(MathMLStream & ms) const rdelim = ']'; break; } - ms << MTagInline("mo", "fence='true' stretchy='true' form='prefix'") - << ldelim - << ETagInline("mo") - << MTagInline("mfrac", "linethickness='0'") + + if (ldelim != ' ') { + ms << MTagInline("mo", "fence='true' stretchy='true' form='prefix'") + << ldelim + << ETagInline("mo"); + } + ms << MTagInline("mfrac", "linethickness='0'") << cell(0) << cell(1) - << ETagInline("mfrac") - << MTagInline("mo", "fence='true' stretchy='true' form='postfix'") - << rdelim - << ETagInline("mo"); + << ETagInline("mfrac"); + if (rdelim != ' ') { + ms << MTagInline("mo", "fence='true' stretchy='true' form='postfix'") + << rdelim + << ETagInline("mo"); + } } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs