mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 06:49:56 +00:00
DocBook: for MathML, refactor InsetMathScript::mathmlize to improve readability and lower redundancy.
This commit is contained in:
parent
1cbac6fcb4
commit
5eddfe509b
@ -606,31 +606,32 @@ void InsetMathScript::mathmlize(MathMLStream & ms) const
|
|||||||
{
|
{
|
||||||
bool d = hasDown() && !down().empty();
|
bool d = hasDown() && !down().empty();
|
||||||
bool u = hasUp() && !up().empty();
|
bool u = hasUp() && !up().empty();
|
||||||
// FIXME: the MathMLStream should be able to give us this information
|
// FIXME: the MathMLStream should be able to give us has_limits_
|
||||||
bool l = has_limits_;
|
|
||||||
|
|
||||||
|
if (!d && !u)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char * tag;
|
||||||
if (u && d)
|
if (u && d)
|
||||||
ms << MTag(l ? "munderover" : "msubsup");
|
tag = has_limits_ ? "munderover" : "msubsup";
|
||||||
else if (u)
|
else if (u)
|
||||||
ms << MTag(l ? "mover" : "msup");
|
tag = has_limits_ ? "mover" : "msup";
|
||||||
else if (d)
|
else if (d)
|
||||||
ms << MTag(l ? "munder" : "msub");
|
tag = has_limits_ ? "munder" : "msub";
|
||||||
|
|
||||||
|
ms << MTag(tag);
|
||||||
|
|
||||||
if (!nuc().empty())
|
if (!nuc().empty())
|
||||||
ms << nuc();
|
ms << nuc();
|
||||||
else
|
else
|
||||||
ms << "<" << from_ascii(ms.namespacedTag("mrow")) << " />";
|
ms << "<" << from_ascii(ms.namespacedTag("mrow")) << " />";
|
||||||
|
|
||||||
if (u && d)
|
if (d)
|
||||||
ms << MTag("mrow") << down() << ETag("mrow")
|
ms << MTag("mrow") << down() << ETag("mrow");
|
||||||
<< MTag("mrow") << up() << ETag("mrow")
|
if (u)
|
||||||
<< ETag(l ? "munderover" : "msubsup");
|
ms << MTag("mrow") << up() << ETag("mrow");
|
||||||
else if (u)
|
|
||||||
ms << MTag("mrow") << up() << ETag("mrow")
|
ms << ETag(tag);
|
||||||
<< ETag(l ? "mover" : "msup");
|
|
||||||
else if (d)
|
|
||||||
ms << MTag("mrow") << down() << ETag("mrow")
|
|
||||||
<< ETag(l ? "munder" : "msub");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user