From a268fe096a58a7818554a7da4da85896bb289c81 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 23 Jul 2024 15:04:49 +0200 Subject: [PATCH] Fixup 216a6fb3: fix broken xml syntax This commit addresses two issues: 1/ the embarassing one: the member SetMode::old_text_level_ was declared as bool instead of int. This means that is was definitely not a proper backup variable! 2/ a robustness issue: replace two consecutive test for isTest() by a boolean veriable that is used twice. This makes sure that cannot be output without the corresponding . Part of bug #13069. --- src/mathed/MathExtern.cpp | 6 ++++-- src/mathed/MathStream.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp index 1f9356f8f2..990d35e9d2 100644 --- a/src/mathed/MathExtern.cpp +++ b/src/mathed/MathExtern.cpp @@ -1646,11 +1646,13 @@ void mathmlize(MathData const & dat, MathMLStream & ms) } else if (ar.size() == 1) { ms << ar.front(); } else { - if (!ms.inText()) + // protect against the value changing in the second test. + bool const intext = ms.inText(); + if (!intext) ms << MTag("mrow"); for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it) (*it)->mathmlize(ms); - if (!ms.inText()) + if (!intext) ms << ETag("mrow"); } } diff --git a/src/mathed/MathStream.h b/src/mathed/MathStream.h index a9edae08c0..40bb7d3bfb 100644 --- a/src/mathed/MathStream.h +++ b/src/mathed/MathStream.h @@ -469,7 +469,7 @@ private: /// MathMLStream & ms_; /// - bool old_text_level_; + int old_text_level_; }; -- 2.39.5