[LyX/master] MathML: fix validity for fractions with units.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Apr 3 01:04:45 UTC 2022


commit 26300c565fd3eeca9ee398b17c2bceedef31b5f5
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Apr 2 04:03:12 2022 +0200

    MathML: fix validity for fractions with units.
    
    https://www.lyx.org/trac/ticket/12513
    
    Contributed by lynx.
---
 src/mathed/InsetMathFrac.cpp |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp
index e58a787..3ad0dfe 100644
--- a/src/mathed/InsetMathFrac.cpp
+++ b/src/mathed/InsetMathFrac.cpp
@@ -543,17 +543,20 @@ void InsetMathFrac::mathmlize(MathMLStream & ms) const
 		break;
 
 	case UNIT:
-		// FIXME This is not right, because we still output mi, etc,
-		// when we output the cell. So we need to prevent that somehow.
-		if (nargs() == 2)
-			ms << cell(0)
-			   << MTag("mstyle mathvariant='normal'") 
-			   << cell(1) 
-			   << ETag("mstyle");
-		else
-			ms << MTag("mstyle mathvariant='normal'")
-			   << cell(0)
-			   << ETag("mstyle");
+		if (nargs() == 2) {
+			ms << MTag("mrow");
+			ms << cell(0);
+			SetMode textmode(ms, true);
+			ms << MTagInline("mstyle mathvariant='normal'");
+			ms << cell(1);
+			ms << ETagInline("mstyle");
+			ms << ETag("mrow");
+		} else {
+			SetMode textmode(ms, true);
+			ms << MTag("mstyle mathvariant='normal'");
+			ms << cell(0);
+			ms << ETag("mstyle");
+		}
 	}
 }
 


More information about the lyx-cvs mailing list