mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
MathML: make InsetMathXArrow generate valid XML entities when required.
Before this, it only supported HTML entities.
This commit is contained in:
parent
8d33eb0351
commit
85a8664ba5
@ -88,40 +88,78 @@ void InsetMathXArrow::mathmlize(MathStream & ms) const
|
||||
{
|
||||
char const * arrow;
|
||||
|
||||
if (name_ == "xleftarrow")
|
||||
arrow = "←";
|
||||
else if (name_ == "xrightarrow")
|
||||
arrow = "→";
|
||||
else if (name_ == "xhookleftarrow")
|
||||
arrow = "↩";
|
||||
else if (name_ == "xhookrightarrow")
|
||||
arrow = "↪";
|
||||
else if (name_ == "xLeftarrow")
|
||||
arrow = "⇐";
|
||||
else if (name_ == "xRightarrow")
|
||||
arrow = "⇒";
|
||||
else if (name_ == "xleftrightarrow")
|
||||
arrow = "↔";
|
||||
else if (name_ == "xLeftrightarrow")
|
||||
arrow = "⇔";
|
||||
else if (name_ == "xleftharpoondown")
|
||||
arrow = "↽";
|
||||
else if (name_ == "xleftharpoonup")
|
||||
arrow = "↼";
|
||||
else if (name_ == "xleftrightharpoons")
|
||||
arrow = "⇋";
|
||||
else if (name_ == "xrightharpoondown")
|
||||
arrow = "⇁";
|
||||
else if (name_ == "xrightharpoonup")
|
||||
arrow = "⇀";
|
||||
else if (name_ == "xrightleftharpoons")
|
||||
arrow = "⇌";
|
||||
else if (name_ == "xmapsto")
|
||||
arrow = "↦";
|
||||
else {
|
||||
lyxerr << "mathmlize conversion for '" << name_ << "' not implemented" << endl;
|
||||
LASSERT(false, arrow = "→");
|
||||
if (!ms.xmlMode()) { // Use HTML entities.
|
||||
if (name_ == "xleftarrow")
|
||||
arrow = "←";
|
||||
else if (name_ == "xrightarrow")
|
||||
arrow = "→";
|
||||
else if (name_ == "xhookleftarrow")
|
||||
arrow = "↩";
|
||||
else if (name_ == "xhookrightarrow")
|
||||
arrow = "↪";
|
||||
else if (name_ == "xLeftarrow")
|
||||
arrow = "⇐";
|
||||
else if (name_ == "xRightarrow")
|
||||
arrow = "⇒";
|
||||
else if (name_ == "xleftrightarrow")
|
||||
arrow = "↔";
|
||||
else if (name_ == "xLeftrightarrow")
|
||||
arrow = "⇔";
|
||||
else if (name_ == "xleftharpoondown")
|
||||
arrow = "↽";
|
||||
else if (name_ == "xleftharpoonup")
|
||||
arrow = "↼";
|
||||
else if (name_ == "xleftrightharpoons")
|
||||
arrow = "⇋";
|
||||
else if (name_ == "xrightharpoondown")
|
||||
arrow = "⇁";
|
||||
else if (name_ == "xrightharpoonup")
|
||||
arrow = "⇀";
|
||||
else if (name_ == "xrightleftharpoons")
|
||||
arrow = "⇌";
|
||||
else if (name_ == "xmapsto")
|
||||
arrow = "↦";
|
||||
else {
|
||||
lyxerr << "mathmlize conversion for '" << name_ << "' not implemented" << endl;
|
||||
LASSERT(false, arrow = "→");
|
||||
}
|
||||
} else { // Use XML entities.
|
||||
if (name_ == "xleftarrow")
|
||||
arrow = "←";
|
||||
else if (name_ == "xrightarrow")
|
||||
arrow = "→";
|
||||
else if (name_ == "xhookleftarrow")
|
||||
arrow = "↩";
|
||||
else if (name_ == "xhookrightarrow")
|
||||
arrow = "↪";
|
||||
else if (name_ == "xLeftarrow")
|
||||
arrow = "⇐";
|
||||
else if (name_ == "xRightarrow")
|
||||
arrow = "⇒";
|
||||
else if (name_ == "xleftrightarrow")
|
||||
arrow = "↔";
|
||||
else if (name_ == "xLeftrightarrow")
|
||||
arrow = "⇔";
|
||||
else if (name_ == "xleftharpoondown")
|
||||
arrow = "↽";
|
||||
else if (name_ == "xleftharpoonup")
|
||||
arrow = "↼";
|
||||
else if (name_ == "xleftrightharpoons")
|
||||
arrow = "⇋";
|
||||
else if (name_ == "xrightharpoondown")
|
||||
arrow = "⇁";
|
||||
else if (name_ == "xrightharpoonup")
|
||||
arrow = "⇀";
|
||||
else if (name_ == "xrightleftharpoons")
|
||||
arrow = "⇌";
|
||||
else if (name_ == "xmapsto")
|
||||
arrow = "↦";
|
||||
else {
|
||||
lyxerr << "mathmlize XML conversion for '" << name_ << "' not implemented" << endl;
|
||||
LASSERT(false, arrow = "→");
|
||||
}
|
||||
}
|
||||
|
||||
ms << "<" << from_ascii(ms.namespacedTag("munderover")) << " accent='false' accentunder='false'>"
|
||||
<< arrow << cell(1) << cell(0)
|
||||
<< "</" << from_ascii(ms.namespacedTag("munderover"))<< ">";
|
||||
|
Loading…
Reference in New Issue
Block a user