From e64be587367540488a28af59cf82a71cb724d68d Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 30 Mar 2010 02:04:07 +0000 Subject: [PATCH] InsetMathBig via HTML. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33946 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathBig.cpp | 66 +++++++++++++++++++++++++++++++++++++ src/mathed/InsetMathBig.h | 4 +++ 2 files changed, 70 insertions(+) diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 463b628dbe..68203fdf47 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -12,6 +12,7 @@ #include "InsetMathBig.h" +#include "LaTeXFeatures.h" #include "MathSupport.h" #include "MathStream.h" #include "MetricsInfo.h" @@ -149,6 +150,60 @@ void InsetMathBig::mathmlize(MathStream & os) const } +void InsetMathBig::htmlize(HtmlStream & os) const +{ + std::string name; + switch (size()) { + case 0: case 1: name = "big"; break; + case 2: case 3: name = "bigg"; break; + case 4: case 5: name = "biggg"; break; + default: name = "big"; break; + } + os << MTag("span", "class='" + name + "symbol'"); + if (delim_ == "(" || delim_ == ")" + || delim_ == "[" || delim_ == "]" + || delim_ == "|" || delim_ == "/") + os << delim_; + else if (delim_ == "\\{" || delim_ == "\\lbrace") + os << "{"; + else if (delim_ == "\\}" || delim_ == "\\rbrace") + os << "}"; + else if (delim_ == "\\slash") + os << "/"; + else if (delim_ == "\\|" || delim_ == "\\vert") + os << "|"; + else if (delim_ == "\\Vert") + os << "∥"; + else if (delim_ == "\\\\" || delim_ == "\\backslash") + os <<" \\"; + else if (delim_ == "\\langle") + os << "<"; + else if (delim_ == "\\rangle") + os << ">"; + else if (delim_ == "\\lceil") + os << "⌈"; + else if (delim_ == "\\rceil") + os << "⌉"; + else if (delim_ == "\\lfloor") + os << "⌊"; + else if (delim_ == "\\rfloor") + os << "⌋"; + else if (delim_ == "\\downarrow") + os << "↓"; + else if (delim_ == "\\uparrow") + os << "↑"; + else if (delim_ == "\\Downarrow") + os << "⇓"; + else if (delim_ == "\\Uparrow") + os << "⇑"; + else if (delim_ == "\\updownarrow") + os << "↕"; + else if (delim_ == "\\Updownarrow") + os << "⇕"; + os << ETag("span"); +} + + void InsetMathBig::infoize2(odocstream & os) const { os << name_; @@ -172,4 +227,15 @@ bool InsetMathBig::isBigInsetDelim(docstring const & delim) } +void InsetMathBig::validate(LaTeXFeatures & features) const +{ + if (features.runparams().flavor == OutputParams::HTML) + features.addPreambleSnippet(""); +} + + } // namespace lyx diff --git a/src/mathed/InsetMathBig.h b/src/mathed/InsetMathBig.h index e6df71fd1c..5e511db0f4 100644 --- a/src/mathed/InsetMathBig.h +++ b/src/mathed/InsetMathBig.h @@ -37,11 +37,15 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// void infoize2(odocstream & os) const; /// static bool isBigInsetDelim(docstring const &); /// InsetCode lyxCode() const { return MATH_BIG_CODE; } + /// + void validate(LaTeXFeatures &) const; private: virtual Inset * clone() const; /// -- 2.39.2