#include "MathSupport.h"
#include "support/debug.h"
+#include "support/gettext.h"
#include "support/lassert.h"
InsetMathScript::InsetMathScript(Buffer * buf, MathAtom const & at, bool up)
: InsetMathNest(buf, 2), cell_1_is_up_(up), limits_(0)
{
- LASSERT(nargs() >= 1, /**/);
+ LATTEST(nargs() >= 1);
cell(0).push_back(at);
}
{
if (nargs() == 3)
return cell(2);
- LASSERT(nargs() > 1, /**/);
+ LBUFERR(nargs() > 1);
return cell(1);
}
{
if (nargs() == 3)
return cell(2);
- LASSERT(nargs() > 1, /**/);
+ LBUFERR(nargs() > 1);
return cell(1);
}
MathData const & InsetMathScript::up() const
{
- LASSERT(nargs() > 1, /**/);
+ LBUFERR(nargs() > 1);
return cell(1);
}
MathData & InsetMathScript::up()
{
- LASSERT(nargs() > 1, /**/);
+ LBUFERR(nargs() > 1);
return cell(1);
}
int InsetMathScript::dx0(BufferView const & bv) const
{
- LASSERT(hasDown(), /**/);
+ LASSERT(hasDown(), return 0);
Dimension const dim = dimension(bv);
return hasLimits() ? (dim.wid - down().dimension(bv).width()) / 2 : nwid(bv);
}
int InsetMathScript::dx1(BufferView const & bv) const
{
- LASSERT(hasUp(), /**/);
+ LASSERT(hasUp(), return 0);
Dimension const dim = dimension(bv);
return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2 : nwid(bv) + nker(&bv);
}
return (cell_1_is_up_ == up) ? 1 : 0;
if (nargs() == 3)
return up ? 1 : 2;
- LASSERT(false, /**/);
- // Silence compiler
- return 0;
+ LASSERT(false, return 0);
}
}
-// FIXME XHTML
-// It may be worth trying to output munder, mover, and munderover
-// in certain cases, e.g., for display formulas. But then we would
-// need to know if we're in a display formula.
void InsetMathScript::mathmlize(MathStream & os) const
{
bool d = hasDown() && !down().empty();
bool u = hasUp() && !up().empty();
+ bool l = hasLimits();
if (u && d)
- os << MTag("msubsup");
+ os << MTag(l ? "munderover" : "msubsup");
else if (u)
- os << MTag("msup");
+ os << MTag(l ? "mover" : "msup");
else if (d)
- os << MTag("msub");
+ os << MTag(l ? "munder" : "msub");
if (!nuc().empty())
os << MTag("mrow") << nuc() << ETag("mrow");
if (u && d)
os << MTag("mrow") << down() << ETag("mrow")
<< MTag("mrow") << up() << ETag("mrow")
- << ETag("msubsup");
+ << ETag(l ? "munderover" : "msubsup");
else if (u)
- os << MTag("mrow") << up() << ETag("mrow") << ETag("msup");
+ os << MTag("mrow") << up() << ETag("mrow") << ETag(l ? "mover" : "msup");
else if (d)
- os << MTag("mrow") << down() << ETag("mrow") << ETag("msub");
+ os << MTag("mrow") << down() << ETag("mrow") << ETag(l ? "munder" : "msub");
}