Fixup b29b3eb1: 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 <mrow>
   cannot be output without the corresponding </mrow>.

Part of bug #13069.

(cherry picked from commit a268fe096a)
This commit is contained in:
Jean-Marc Lasgouttes 2024-07-23 15:04:49 +02:00
parent a0752e4dfc
commit 8ea0987644
2 changed files with 5 additions and 3 deletions

View File

@ -1646,11 +1646,13 @@ void mathmlize(MathData const & dat, MathMLStream & ms)
} else if (ar.size() == 1) { } else if (ar.size() == 1) {
ms << ar.front(); ms << ar.front();
} else { } else {
if (!ms.inText()) // protect against the value changing in the second test.
bool const intext = ms.inText();
if (!intext)
ms << MTag("mrow"); ms << MTag("mrow");
for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it) for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
(*it)->mathmlize(ms); (*it)->mathmlize(ms);
if (!ms.inText()) if (!intext)
ms << ETag("mrow"); ms << ETag("mrow");
} }
} }

View File

@ -469,7 +469,7 @@ private:
/// ///
MathMLStream & ms_; MathMLStream & ms_;
/// ///
bool old_text_level_; int old_text_level_;
}; };