mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Introduce a return value for mathmlize(). We will need this to be able
to defer labels. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32684 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
28e9474f7a
commit
8a0134cc8c
@ -52,37 +52,36 @@ These insets work but still need work:
|
||||
Math
|
||||
We have a fair bit of math now working via MathML output, but there are still some
|
||||
isues, and not all the insets work. Here are the ones I know still need work:
|
||||
- AMSArray
|
||||
- Array
|
||||
- Big: Not sure if we can actually do anything here. Probably they should
|
||||
just be treated as delimiters.
|
||||
- BoldSymbol: Should be easy.
|
||||
- Box
|
||||
- Cases
|
||||
- Diff: Code exists, but I do not know if it is right.
|
||||
- Font
|
||||
- Binom (in Frac): None of these tags exist in MathML 2.0. We'll
|
||||
just output a fraction with delimiters.
|
||||
- Lefteqn
|
||||
- MBox: Use <mtext>.
|
||||
- Overset: Use <mover>.
|
||||
- Par?
|
||||
- Phantom: There is some support for this in MathML....
|
||||
- Ref: Probably needs to be deferred somehow, which is a hassle, because it
|
||||
means the whole MathML output business needs a new argument.
|
||||
- Size: Unclear if we want to do anything here, though we could. See
|
||||
lib/symbols for the commands supported, of course.
|
||||
- Space: Needs checking.
|
||||
- SpecialChar: Needs checking.
|
||||
- Split
|
||||
- Stackrel: Use <mover>, probably.
|
||||
- Substack: This is a stack of however many cells, all in a smaller style.
|
||||
Probably do something with <mover>, again.
|
||||
- Tabular: This is more or less a text-like table in math. Probably output it
|
||||
as a table, but set the font.
|
||||
- Underset: Use <munder>.
|
||||
- XArrow: Contents above and below an arrow. Use...?
|
||||
- XYMatrix: Not sure how this differs from ordinary ones.
|
||||
- AMSArray
|
||||
- Array
|
||||
- Big: Not sure if we can actually do anything here. Probably they should
|
||||
just be treated as delimiters.
|
||||
- BoldSymbol: Should be easy.
|
||||
- Box
|
||||
- Cases
|
||||
- Diff: Code exists, but I do not know if it is right.
|
||||
- Font
|
||||
- Binom (in Frac): None of these tags exist in MathML 2.0. We'll
|
||||
just output a fraction with delimiters.
|
||||
- Lefteqn
|
||||
- MBox: Use <mtext>.
|
||||
- Overset: Use <mover>.
|
||||
- Par?
|
||||
- Phantom: There is some support for this in MathML....
|
||||
- Ref: Needs to be deferred.
|
||||
- Size: Unclear if we want to do anything here, though we could. See
|
||||
lib/symbols for the commands supported, of course.
|
||||
- Space: Needs checking.
|
||||
- SpecialChar: Needs checking.
|
||||
- Split
|
||||
- Stackrel: Use <mover>, probably.
|
||||
- Substack: This is a stack of however many cells, all in a smaller style.
|
||||
Probably do something with <mover>, again.
|
||||
- Tabular: This is more or less a text-like table in math. Probably output it
|
||||
as a table, but set the font.
|
||||
- Underset: Use <munder>.
|
||||
- XArrow: Contents above and below an arrow. Use...?
|
||||
- XYMatrix: Not sure how this differs from ordinary ones.
|
||||
|
||||
|
||||
These insets do not work and are not yet scheduled to work:
|
||||
|
@ -120,12 +120,13 @@ void InsetMath::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMath::mathmlize(MathStream & os) const
|
||||
docstring InsetMath::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("mi");
|
||||
NormalStream ns(os.os());
|
||||
normalize(ns);
|
||||
os << ETag("mi");
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
/// write content as something readable by Mathematica
|
||||
virtual void mathematica(MathematicaStream &) const;
|
||||
/// write content as something resembling MathML
|
||||
virtual void mathmlize(MathStream &) const;
|
||||
virtual docstring mathmlize(MathStream &) const;
|
||||
/// write content as something readable by Octave
|
||||
virtual void octave(OctaveStream &) const;
|
||||
|
||||
|
@ -52,7 +52,7 @@ void InsetMathBox::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBox::mathmlize(MathStream & ms) const
|
||||
docstring InsetMathBox::mathmlize(MathStream & ms) const
|
||||
{
|
||||
// FIXME This doesn't actually work yet. We need to be able to signal
|
||||
// that we are in text mode and then just call ms << cell(0). So we
|
||||
@ -60,6 +60,7 @@ void InsetMathBox::mathmlize(MathStream & ms) const
|
||||
ms << MTag("mtext");
|
||||
ms.os() << cell(0);
|
||||
ms << ETag("mtext");
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
///
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void mathmlize(MathStream & ms) const;
|
||||
docstring mathmlize(MathStream & ms) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
@ -66,7 +66,7 @@ public:
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
//void mathmlize(MathStream & ms) const;
|
||||
//docstring mathmlize(MathStream & ms) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
@ -89,7 +89,7 @@ public:
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
//void mathmlize(MathStream & ms) const;
|
||||
//docstring mathmlize(MathStream & ms) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
@ -116,7 +116,7 @@ public:
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
//void mathmlize(MathStream & ms) const;
|
||||
//docstring mathmlize(MathStream & ms) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "InsetMathBrace.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
@ -94,9 +95,12 @@ void InsetMathBrace::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBrace::mathmlize(MathStream & os) const
|
||||
docstring InsetMathBrace::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("mrow") << cell(0) << ETag("mrow");
|
||||
os << MTag("mrow");
|
||||
docstring const rv = lyx::mathmlize(cell(0), os);
|
||||
os << ETag("mrow");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
|
@ -165,12 +165,12 @@ void InsetMathChar::octave(OctaveStream & os) const
|
||||
// mathalpha, then we'll treat it as an identifier, otherwise as an
|
||||
// operator.
|
||||
// Worst case: We get bad spacing, or bad italics.
|
||||
void InsetMathChar::mathmlize(MathStream & ms) const
|
||||
docstring InsetMathChar::mathmlize(MathStream & ms) const
|
||||
{
|
||||
switch (char_) {
|
||||
case '<': ms << "<mo><</mo>"; return;
|
||||
case '>': ms << "<mo>></mo>"; return;
|
||||
case '&': ms << "<mo>&</mo>"; return;
|
||||
case '<': ms << "<mo><</mo>"; return docstring();
|
||||
case '>': ms << "<mo>></mo>"; return docstring();
|
||||
case '&': ms << "<mo>&</mo>"; return docstring();
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -179,6 +179,7 @@ void InsetMathChar::mathmlize(MathStream & ms) const
|
||||
? "mi" : "mo";
|
||||
// we don't use MTag and ETag because we do not want the spacing
|
||||
ms << "<" << type << ">" << char(char_) << "</" << type << ">";
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream & os) const;
|
||||
///
|
||||
void mathmlize(MathStream & ms) const;
|
||||
docstring mathmlize(MathStream & ms) const;
|
||||
/// identifies Charinsets
|
||||
InsetMathChar const * asCharInset() const { return this; }
|
||||
///
|
||||
|
@ -86,9 +86,10 @@ void InsetMathComment::octave(OctaveStream &) const
|
||||
{}
|
||||
|
||||
|
||||
void InsetMathComment::mathmlize(MathStream & os) const
|
||||
docstring InsetMathComment::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("comment") << cell(0) << cell(1) << ETag("comment");
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "InsetMathDecoration.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathParser.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MathStream.h"
|
||||
@ -205,16 +206,18 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
void InsetMathDecoration::mathmlize(MathStream & os) const
|
||||
docstring InsetMathDecoration::mathmlize(MathStream & os) const
|
||||
{
|
||||
Translator const & t = translator();
|
||||
Translator::const_iterator cur = t.find(to_utf8(key_->name));
|
||||
LASSERT(cur != t.end(), return);
|
||||
LASSERT(cur != t.end(), return docstring());
|
||||
char const * const outag = cur->second.over ? "mover" : "munder";
|
||||
os << MTag(outag)
|
||||
<< MTag("mrow") << cell(0) << ETag("mrow")
|
||||
os << MTag(outag) << MTag("mrow");
|
||||
docstring const rv = lyx::mathmlize(cell(0), os);
|
||||
os << ETag("mrow")
|
||||
<< from_ascii("<mo stretchy=\"true\">" + cur->second.tag + "</mo>")
|
||||
<< ETag(outag);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_DECORATION_CODE; }
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "InsetMathDelim.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
@ -161,10 +162,12 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDelim::mathmlize(MathStream & os) const
|
||||
docstring InsetMathDelim::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>"
|
||||
<< cell(0) << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>";
|
||||
os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>";
|
||||
docstring const rv = lyx::mathmlize(cell(0),os);
|
||||
os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>";
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "InsetMathDiff.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
@ -95,15 +96,17 @@ void InsetMathDiff::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDiff::mathmlize(MathStream & os) const
|
||||
docstring InsetMathDiff::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << "diff(";
|
||||
docstring rv;
|
||||
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
||||
if (idx != 0)
|
||||
os << ',';
|
||||
os << cell(idx);
|
||||
rv += lyx::mathmlize(cell(idx), os);
|
||||
}
|
||||
os << ')';
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void maxima(MaximaStream &) const;
|
||||
///
|
||||
|
@ -85,7 +85,7 @@ void InsetMathDots::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDots::mathmlize(MathStream & os) const
|
||||
docstring InsetMathDots::mathmlize(MathStream & os) const
|
||||
{
|
||||
// which symbols we support is decided by what is listed in
|
||||
// lib/symbols as generating a dots inset
|
||||
@ -106,6 +106,7 @@ void InsetMathDots::mathmlize(MathStream & os) const
|
||||
else
|
||||
LASSERT(false, ent = "…");
|
||||
os << MTag("mi") << from_ascii(ent) << ETag("mi");
|
||||
return docstring();
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_DOTS_CODE; }
|
||||
///
|
||||
void mathmlize(MathStream & os) const;
|
||||
docstring mathmlize(MathStream & os) const;
|
||||
protected:
|
||||
/// cache for the thing's height
|
||||
mutable int dh_;
|
||||
|
@ -13,8 +13,9 @@
|
||||
|
||||
#include "InsetMathEnsureMath.h"
|
||||
|
||||
#include "MathStream.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
@ -67,9 +68,9 @@ void InsetMathEnsureMath::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathEnsureMath::mathmlize(MathStream & os) const
|
||||
docstring InsetMathEnsureMath::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << cell(0);
|
||||
return lyx::mathmlize(cell(0), os);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "InsetMathExFunc.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
@ -122,10 +123,10 @@ void InsetMathExFunc::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathExFunc::mathmlize(MathStream & os) const
|
||||
docstring InsetMathExFunc::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << "<mi>" << name_ << "</mi><mo>⁡</mo>";
|
||||
os << cell(0);
|
||||
return lyx::mathmlize(cell(0), os);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "InsetMathExInt.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathStream.h"
|
||||
#include "InsetMathSymbol.h"
|
||||
@ -122,7 +123,7 @@ void InsetMathExInt::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathExInt::mathmlize(MathStream & os) const
|
||||
docstring InsetMathExInt::mathmlize(MathStream & os) const
|
||||
{
|
||||
// At the moment, we are not extracting sums and the like for MathML.
|
||||
// If we should decide to do so later, then we'll need to re-merge
|
||||
@ -150,9 +151,11 @@ void InsetMathExInt::mathmlize(MathStream & os) const
|
||||
os << ETag("msub");
|
||||
else if (upper)
|
||||
os << ETag("msup");
|
||||
os << cell(0) << "<mo> ⁢ </mo>"
|
||||
docstring rv = lyx::mathmlize(cell(0), os);
|
||||
os << "<mo> ⁢ </mo>"
|
||||
<< MTag("mrow") << "<mo> ⅆ </mo>"
|
||||
<< cell(1) << ETag("mrow");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Cursor.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
@ -384,12 +385,14 @@ void InsetMathFrac::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrac::mathmlize(MathStream & os) const
|
||||
docstring InsetMathFrac::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("mfrac")
|
||||
<< MTag("mrow") << cell(0) << ETag("mrow")
|
||||
<< MTag("mrow") << cell(1) << ETag("mrow")
|
||||
<< ETag("mfrac");
|
||||
os << MTag("mfrac") << MTag("mrow");
|
||||
docstring rv = lyx::mathmlize(cell(0), os);
|
||||
os << ETag("mrow") << MTag("mrow");
|
||||
rv += lyx::mathmlize(cell(1), os);
|
||||
os << ETag("mrow") << ETag("mfrac");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -533,8 +536,9 @@ void InsetMathBinom::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBinom::mathmlize(MathStream & os) const
|
||||
docstring InsetMathBinom::mathmlize(MathStream & os) const
|
||||
{
|
||||
// FIXME This all needs fixing
|
||||
switch (kind_) {
|
||||
case BINOM:
|
||||
os << MTag("mbinom") << cell(0) << cell(1) << ETag("mbinom");
|
||||
@ -547,6 +551,7 @@ void InsetMathBinom::mathmlize(MathStream & os) const
|
||||
os << MTag("mdbinom") << cell(0) << cell(1) << ETag("mdbinom");
|
||||
break;
|
||||
}
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
public:
|
||||
@ -121,7 +121,7 @@ public:
|
||||
///
|
||||
bool extraBraces() const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "InsetMathGrid.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathParser.h"
|
||||
#include "MathStream.h"
|
||||
#include "MetricsInfo.h"
|
||||
@ -967,19 +968,21 @@ void InsetMathGrid::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathGrid::mathmlize(MathStream & os) const
|
||||
docstring InsetMathGrid::mathmlize(MathStream & os) const
|
||||
{
|
||||
bool const havetable = nrows() > 1;
|
||||
if (havetable)
|
||||
os << MTag("mtable");
|
||||
docstring rv;
|
||||
for (row_type row = 0; row < nrows(); ++row) {
|
||||
os << MTag("mrow");
|
||||
for (col_type col = 0; col < ncols(); ++col)
|
||||
os << cell(index(row, col));
|
||||
rv += lyx::mathmlize(cell(index(row, col)), os);
|
||||
os << ETag("mrow");
|
||||
}
|
||||
if (havetable)
|
||||
os << ETag("mtable");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
///
|
||||
//void maple(MapleStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
//void octave(OctaveStream &) const;
|
||||
|
||||
|
@ -1092,9 +1092,9 @@ void InsetMathHull::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathHull::mathmlize(MathStream & os) const
|
||||
docstring InsetMathHull::mathmlize(MathStream & os) const
|
||||
{
|
||||
InsetMathGrid::mathmlize(os);
|
||||
return InsetMathGrid::mathmlize(os);
|
||||
}
|
||||
|
||||
|
||||
@ -1782,9 +1782,9 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
xs << StartTag("math",
|
||||
"display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
|
||||
MathStream ms(xs.os());
|
||||
InsetMathGrid::mathmlize(ms);
|
||||
docstring const rv = InsetMathGrid::mathmlize(ms);
|
||||
xs << EndTag("math");
|
||||
return docstring();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void normalize(NormalStream &) const;
|
||||
///
|
||||
|
@ -73,4 +73,10 @@ void InsetMathKern::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetMathKern::mathmlize(MathStream &) const
|
||||
{
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
///
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const { }
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_KERN_CODE; }
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "InsetMathLim.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
@ -71,13 +72,16 @@ void InsetMathLim::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathLim::mathmlize(MathStream & os) const
|
||||
docstring InsetMathLim::mathmlize(MathStream & os) const
|
||||
{
|
||||
// FIXME XHTML We need a form of MTag that takes attributes.
|
||||
os << "<munder>"
|
||||
<< "<mo form='prefix'>" << "lim" << "</mo>"
|
||||
<< "<mrow>" << cell(1) << "<mo>→</mo>" << cell(2) << "</mrow></munder>"
|
||||
<< "<mo>(</mo>" << cell(0) << "<mo>)</mo>" ;
|
||||
<< "<mrow>" << cell(1) << "<mo>→</mo>" << cell(2)
|
||||
<< "</mrow></munder>" << "<mo>(</mo>";
|
||||
docstring const rv = lyx::mathmlize(cell(0), os);
|
||||
os << "<mo>)</mo>";
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "InsetMathMatrix.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
|
||||
|
||||
@ -89,20 +90,25 @@ void InsetMathMatrix::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMatrix::mathmlize(MathStream & os) const
|
||||
docstring InsetMathMatrix::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
|
||||
<< left_ << "</mo>";
|
||||
os << MTag("mtable");
|
||||
docstring rv;
|
||||
for (row_type row = 0; row < nrows(); ++row) {
|
||||
os << MTag("mtr");
|
||||
for (col_type col = 0; col < ncols(); ++col)
|
||||
os << MTag("mtd") << cell(index(row, col)) << ETag("mtd");
|
||||
for (col_type col = 0; col < ncols(); ++col) {
|
||||
os << MTag("mtd");
|
||||
rv += lyx::mathmlize(cell(index(row, col)), os);
|
||||
os << ETag("mtd");
|
||||
}
|
||||
os << ETag("mtr");
|
||||
}
|
||||
os << ETag("mtable");
|
||||
os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
|
||||
<< right_ << "</mo>";
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
@ -67,9 +67,10 @@ void InsetMathNumber::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathNumber::mathmlize(MathStream & os) const
|
||||
docstring InsetMathNumber::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << "<mn> " << str_ << " </mn>";
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "InsetMathRoot.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "Cursor.h"
|
||||
|
||||
@ -112,9 +113,13 @@ void InsetMathRoot::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathRoot::mathmlize(MathStream & os) const
|
||||
docstring InsetMathRoot::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("mroot") << cell(1) << cell(0) << ETag("mroot");
|
||||
os << MTag("mroot");
|
||||
docstring rv = lyx::mathmlize(cell(1), os);
|
||||
rv += lyx::mathmlize(cell(0), os);
|
||||
os << ETag("mroot");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
///
|
||||
void normalize(NormalStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void maple(MapleStream &) const;
|
||||
///
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "InsetMathScript.h"
|
||||
#include "InsetMathSymbol.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
|
||||
@ -616,7 +617,7 @@ void InsetMathScript::mathematica(MathematicaStream & os) const
|
||||
// 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
|
||||
docstring InsetMathScript::mathmlize(MathStream & os) const
|
||||
{
|
||||
bool d = hasDown() && down().size();
|
||||
bool u = hasUp() && up().size();
|
||||
@ -628,9 +629,12 @@ void InsetMathScript::mathmlize(MathStream & os) const
|
||||
else if (d)
|
||||
os << MTag("msub");
|
||||
|
||||
if (nuc().size())
|
||||
os << MTag("mrow") << nuc() << ETag("mrow");
|
||||
else
|
||||
docstring rv;
|
||||
if (nuc().size()) {
|
||||
os << MTag("mrow");
|
||||
rv = lyx::mathmlize(nuc(), os);
|
||||
os << ETag("mrow");
|
||||
} else
|
||||
os << "<mrow />";
|
||||
|
||||
if (u && d)
|
||||
@ -641,6 +645,7 @@ void InsetMathScript::mathmlize(MathStream & os) const
|
||||
os << MTag("mrow") << up() << ETag("mrow") << ETag("msup");
|
||||
else if (d)
|
||||
os << MTag("mrow") << down() << ETag("mrow") << ETag("msub");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
/// write content as something readable by Mathematica
|
||||
void mathematica(MathematicaStream &) const;
|
||||
/// write content as something resembling MathML
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
/// write content as something readable by Octave
|
||||
void octave(OctaveStream &) const;
|
||||
|
||||
|
@ -192,11 +192,11 @@ void InsetMathSpace::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathSpace::mathmlize(MathStream & ms) const
|
||||
docstring InsetMathSpace::mathmlize(MathStream & ms) const
|
||||
{
|
||||
SpaceInfo const & si = space_info[space_];
|
||||
if (si.negative || !si.visible)
|
||||
return;
|
||||
return docstring();
|
||||
string l;
|
||||
if (si.custom)
|
||||
l = length_.asHTMLString();
|
||||
@ -210,6 +210,7 @@ void InsetMathSpace::mathmlize(MathStream & ms) const
|
||||
if (!l.empty())
|
||||
ms << " width=\"" << from_ascii(l) << "\"";
|
||||
ms << " />";
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream & ms) const;
|
||||
docstring mathmlize(MathStream & ms) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// generate something that will be understood by the Dialogs.
|
||||
|
@ -147,7 +147,7 @@ void InsetMathSpecialChar::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathSpecialChar::mathmlize(MathStream & ms) const
|
||||
docstring InsetMathSpecialChar::mathmlize(MathStream & ms) const
|
||||
{
|
||||
switch (char_) {
|
||||
case '&':
|
||||
@ -157,6 +157,7 @@ void InsetMathSpecialChar::mathmlize(MathStream & ms) const
|
||||
ms.os().put(char_);
|
||||
break;
|
||||
}
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream & ms) const;
|
||||
docstring mathmlize(MathStream & ms) const;
|
||||
/// identifies SpecialChar insets
|
||||
InsetMathSpecialChar const * asSpecialCharInset() const { return this; }
|
||||
///
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "InsetMathSqrt.h"
|
||||
#include "MathData.h"
|
||||
#include "MathExtern.h"
|
||||
#include "MathStream.h"
|
||||
#include "TextPainter.h"
|
||||
#include "frontends/Painter.h"
|
||||
@ -107,9 +108,12 @@ void InsetMathSqrt::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathSqrt::mathmlize(MathStream & os) const
|
||||
docstring InsetMathSqrt::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("msqrt") << cell(0) << ETag("msqrt");
|
||||
os << MTag("msqrt");
|
||||
docstring const rv = lyx::mathmlize(cell(0), os);
|
||||
os << ETag("msqrt");
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_SQRT_CODE; }
|
||||
|
||||
|
@ -89,13 +89,6 @@ void InsetMathString::octave(OctaveStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathString::mathmlize(MathStream & /*os*/) const
|
||||
{
|
||||
// useless, no doubt, but we should not be here
|
||||
LASSERT(false, /* */);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathString::write(WriteStream & os) const
|
||||
{
|
||||
if (!os.latex() || os.lockedMode()) {
|
||||
|
@ -47,8 +47,6 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_STRING_CODE; }
|
||||
|
@ -184,7 +184,7 @@ char const * MathMLtype(docstring const & s)
|
||||
}
|
||||
|
||||
|
||||
void InsetMathSymbol::mathmlize(MathStream & os) const
|
||||
docstring InsetMathSymbol::mathmlize(MathStream & os) const
|
||||
{
|
||||
// FIXME To get this working properly, we need to do add the
|
||||
// XML entity definitions to lib/symbols. And probably do more
|
||||
@ -197,6 +197,7 @@ void InsetMathSymbol::mathmlize(MathStream & os) const
|
||||
else
|
||||
os << sym_->xmlname;
|
||||
os << " </" << type << '>';
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
@ -86,9 +86,10 @@ void InsetMathUnknown::mathematica(MathematicaStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathUnknown::mathmlize(MathStream & os) const
|
||||
docstring InsetMathUnknown::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << MTag("mi") << name_ << ETag("mi");
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
@ -1413,20 +1413,22 @@ void mathematica(MathData const & dat, MathematicaStream & os)
|
||||
}
|
||||
|
||||
|
||||
void mathmlize(MathData const & dat, MathStream & os)
|
||||
docstring mathmlize(MathData const & dat, MathStream & os)
|
||||
{
|
||||
MathData ar = dat;
|
||||
extractStructure(ar, MATHML);
|
||||
docstring retval;
|
||||
if (ar.size() == 0)
|
||||
os << "<mrow/>";
|
||||
else if (ar.size() == 1)
|
||||
os << ar.front();
|
||||
retval = ar.front()->mathmlize(os);
|
||||
else {
|
||||
os << MTag("mrow");
|
||||
for (MathData::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
||||
(*it)->mathmlize(os);
|
||||
retval += (*it)->mathmlize(os);
|
||||
os << ETag("mrow");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
// convert this inset somehow to a number
|
||||
|
@ -30,7 +30,7 @@ void normalize(MathData const &, NormalStream &);
|
||||
void maple(MathData const &, MapleStream &);
|
||||
void maxima(MathData const &, MaximaStream &);
|
||||
void mathematica(MathData const &, MathematicaStream &);
|
||||
void mathmlize(MathData const &, MathStream &);
|
||||
docstring mathmlize(MathData const &, MathStream &);
|
||||
void octave(MathData const &, OctaveStream &);
|
||||
|
||||
bool extractNumber(MathData const & ar, int & i);
|
||||
|
@ -73,7 +73,10 @@ public:
|
||||
}
|
||||
// FIXME Other external things need similar treatment.
|
||||
///
|
||||
void mathmlize(MathStream & ms) const { ms << mathMacro_.cell(idx_); }
|
||||
docstring mathmlize(MathStream & ms) const {
|
||||
ms << mathMacro_.cell(idx_);
|
||||
return docstring();
|
||||
}
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const {
|
||||
if (mathMacro_.editMetrics(pi.base.bv)) {
|
||||
@ -740,9 +743,10 @@ void MathMacro::maple(MapleStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void MathMacro::mathmlize(MathStream & os) const
|
||||
docstring MathMacro::mathmlize(MathStream & os) const
|
||||
{
|
||||
os << expanded_.cell(0);
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
///
|
||||
void maple(MapleStream &) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
docstring mathmlize(MathStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user