mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
XHTML for InsetMathSize.
We now have nice output of the User's Guide. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33145 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
faeb63ce68
commit
a36607b800
@ -42,9 +42,6 @@ Math
|
||||
- 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. At least, we have to output
|
||||
the cell.
|
||||
- Space: Needs checking.
|
||||
- SpecialChar: Needs checking.
|
||||
- Split: There are some alignment issues here, but it basically works.
|
||||
|
@ -15,11 +15,14 @@
|
||||
#include "MathData.h"
|
||||
#include "MathParser.h"
|
||||
#include "MathStream.h"
|
||||
#include "output_xhtml.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -57,6 +60,30 @@ void InsetMathSize::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
// From the MathML documentation:
|
||||
// MathML uses two attributes, displaystyle and scriptlevel, to control
|
||||
// orthogonal presentation features that TeX encodes into one "style"
|
||||
// attribute with values \displaystyle, \textstyle, \scriptstyle, and
|
||||
// \scriptscriptstyle. The corresponding values of displaystyle and scriptlevel
|
||||
// for those TeX styles would be "true" and "0", "false" and "0", "false" and "1",
|
||||
// and "false" and "2", respectively.
|
||||
void InsetMathSize::mathmlize(MathStream & ms) const
|
||||
{
|
||||
string const & name = to_utf8(key_->name);
|
||||
bool dispstyle = (name == "displaystyle");
|
||||
int scriptlevel = 0;
|
||||
if (name == "scriptstyle")
|
||||
scriptlevel = 1;
|
||||
else if (name == "scriptscriptstyle")
|
||||
scriptlevel = 2;
|
||||
stringstream attrs;
|
||||
attrs << "displaystyle='" << (dispstyle ? "true" : "false")
|
||||
<< "' scriptlevel='" << scriptlevel << "'";
|
||||
ms << "<mstyle " << from_ascii(attrs.str()) << ">"
|
||||
<< cell(0) << "</mstyle>";
|
||||
}
|
||||
|
||||
|
||||
void InsetMathSize::normalize(NormalStream & os) const
|
||||
{
|
||||
os << '[' << key_->name << ' ' << cell(0) << ']';
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
void mathmlize(MathStream &) const;
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_SIZE_CODE; }
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user