Simple characters.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33937 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-29 23:03:37 +00:00
parent 30b18aec37
commit 5ef3c828b2
2 changed files with 35 additions and 0 deletions

View File

@ -201,6 +201,39 @@ void InsetMathChar::mathmlize(MathStream & ms) const
}
void InsetMathChar::htmlize(HtmlStream & ms) const
{
std::string entity;
switch (char_) {
case '<': entity = "&lt;"; break;
case '>': entity = "&gt;"; break;
case '&': entity = "&amp;"; break;
default: break;
}
bool have_entity = entity.empty();
if (ms.inText() || have_entity) {
if (have_entity)
ms << from_ascii(entity);
else
ms.os().put(char_);
return;
}
if (!entity.empty()) {
ms << ' ' << from_ascii(entity) << ' ';
return;
}
char const * space =
(isalpha(char_) || Encodings::isMathAlpha(char_))
? "" : " ";
// we don't use MTag and ETag because we do not want the spacing
ms << space << char_type(char_) << space;
}
bool InsetMathChar::isRelOp() const
{
return char_ == '=' || char_ == '<' || char_ == '>';

View File

@ -42,6 +42,8 @@ public:
void octave(OctaveStream & os) const;
///
void mathmlize(MathStream & ms) const;
///
void htmlize(HtmlStream & ms) const;
/// identifies Charinsets
InsetMathChar const * asCharInset() const { return this; }
///