mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
LyXHTML: switch the doctype to (X)HTML5 and only output XML entities.
This is a new take onc8e2c17a
that was reverted atda67bde61a
due to entities no more recognised by the browsers. Corresponding thread on the mailing list: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg213179.html This patch is a huge cleanup overall, by removing the distinction between HTML and XML entities (the latter arrived due to the DocBook support). In InsetListingParams, I also changed the mechanism that relied on " to use an XML entity to be consistent with the rest of the code, mostly in case someone looks for HTML entities and wonders why they are still there.
This commit is contained in:
parent
d85969b8b8
commit
bc73a85778
@ -64,11 +64,15 @@
|
||||
* Documents that use TeX fonts can only be compiled with XeTeX if the input
|
||||
encoding is set to "utf8-plain" or "ascii".
|
||||
|
||||
* With LyXHTML output, there are now different CSS classees generated for
|
||||
* With LyXHTML output, there are now different CSS classes generated for
|
||||
different depths: enumi, enumii, enumiii, and enumiv, and similarly for
|
||||
itemize: lyxitemi, etc. There is also a new HTMLClass tag, which makes it
|
||||
easier to provide specific classes for paragraphs.
|
||||
|
||||
* HTML support has been updated to output XHTML5 files. A major change is the
|
||||
use of XML entities instead of HTML ones (e.g., LyX now outputs -
|
||||
instead of ").
|
||||
|
||||
* DocBook support has been revamped and now targets DocBook 5 (i.e.
|
||||
only XML, SGML is gone). Some supporting files for the previous
|
||||
implementation have been removed: all examples (lib/examples),
|
||||
|
@ -2173,14 +2173,14 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os,
|
||||
}
|
||||
|
||||
// Directly output the root tag, based on the current type of document.
|
||||
string params = "xml:lang=\"" + params().language->code() + '"'
|
||||
string attributes = "xml:lang=\"" + params().language->code() + '"'
|
||||
+ " xmlns=\"http://docbook.org/ns/docbook\""
|
||||
+ " xmlns:xlink=\"http://www.w3.org/1999/xlink\""
|
||||
+ mathmlNamespace
|
||||
+ " xmlns:xi=\"http://www.w3.org/2001/XInclude\""
|
||||
+ " version=\"5.2\"";
|
||||
|
||||
os << "<" << from_ascii(tclass.docbookroot()) << " " << from_ascii(params) << ">\n";
|
||||
os << "<" << from_ascii(tclass.docbookroot()) << " " << from_ascii(attributes) << ">\n";
|
||||
}
|
||||
|
||||
if (output_body) {
|
||||
@ -2238,11 +2238,11 @@ Buffer::ExportStatus Buffer::writeLyXHTMLSource(odocstream & os,
|
||||
output == FullSource || output == OnlyBody || output == IncludedFile;
|
||||
|
||||
if (output_preamble) {
|
||||
os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
<< "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\">\n"
|
||||
os << "<!DOCTYPE html>\n"
|
||||
<< "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"" << from_ascii(params().language->code()) << "\">\n"
|
||||
<< "<head>\n"
|
||||
<< "<meta name=\"GENERATOR\" content=\"" << PACKAGE_STRING << "\" />\n"
|
||||
<< "<meta charset=\"UTF-8\" />\n"
|
||||
// FIXME Presumably need to set this right
|
||||
<< "<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\" />\n";
|
||||
|
||||
|
@ -2164,37 +2164,6 @@ docstring const LaTeXFeatures::getTClassI18nPreamble(bool use_babel,
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFeatures::getLyXSGMLEntities() const
|
||||
{
|
||||
// Definition of entities used in the document that are LyX related.
|
||||
odocstringstream entities;
|
||||
|
||||
if (mustProvide("lyxarrow")) {
|
||||
entities << "<!ENTITY lyxarrow \"->\">" << '\n';
|
||||
}
|
||||
|
||||
return entities.str();
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFeatures::getIncludedFiles(string const & fname) const
|
||||
{
|
||||
odocstringstream sgmlpreamble;
|
||||
// FIXME UNICODE
|
||||
docstring const basename(from_utf8(onlyPath(fname)));
|
||||
|
||||
FileMap::const_iterator end = IncludedFiles_.end();
|
||||
for (FileMap::const_iterator fi = IncludedFiles_.begin();
|
||||
fi != end; ++fi)
|
||||
// FIXME UNICODE
|
||||
sgmlpreamble << "\n<!ENTITY " << fi->first
|
||||
<< (isSGMLFileName(fi->second) ? " SYSTEM \"" : " \"")
|
||||
<< makeRelPath(from_utf8(fi->second), basename) << "\">";
|
||||
|
||||
return sgmlpreamble.str();
|
||||
}
|
||||
|
||||
|
||||
void LaTeXFeatures::showStruct() const
|
||||
{
|
||||
lyxerr << "LyX needs the following commands when LaTeXing:"
|
||||
|
@ -79,10 +79,6 @@ public:
|
||||
docstring const getTClassHTMLStyles() const;
|
||||
///
|
||||
docstring const getTClassHTMLPreamble() const;
|
||||
/// The sgml definitions needed by the document (docbook)
|
||||
docstring const getLyXSGMLEntities() const;
|
||||
/// The SGML Required to include the files added with includeFile();
|
||||
docstring const getIncludedFiles(std::string const & fname) const;
|
||||
/// Include a file for use with the SGML entities
|
||||
void includeFile(docstring const & key, std::string const & name);
|
||||
/// The float definitions.
|
||||
|
@ -515,7 +515,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
|
||||
|
||||
case LT_LATEXPARAM:
|
||||
lex >> latexparam_;
|
||||
latexparam_ = subst(latexparam_, """, "\"");
|
||||
latexparam_ = subst(latexparam_, """, "\"");
|
||||
break;
|
||||
|
||||
case LT_LEFTDELIM:
|
||||
@ -1455,7 +1455,7 @@ void Layout::write(ostream & os) const
|
||||
if (!latexname_.empty())
|
||||
os << "\tLatexName \"" << latexname_ << "\"\n";
|
||||
if (!latexparam_.empty())
|
||||
os << "\tLatexParam \"" << subst(latexparam_, "\"", """)
|
||||
os << "\tLatexParam \"" << subst(latexparam_, "\"", """)
|
||||
<< "\"\n";
|
||||
if (!leftdelim_.empty())
|
||||
os << "\tLeftDelim "
|
||||
|
@ -4046,7 +4046,7 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf,
|
||||
char_type c = getUChar(buf.masterBuffer()->params(),
|
||||
runparams, i);
|
||||
if (c == ' ' && (style.free_spacing || runparams.free_spacing))
|
||||
xs << XMLStream::ESCAPE_NONE << " ";
|
||||
xs << XMLStream::ESCAPE_NONE << " ";
|
||||
else if (c == '\'')
|
||||
xs << XMLStream::ESCAPE_NONE << "’";
|
||||
else
|
||||
|
@ -312,7 +312,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
|
||||
break;
|
||||
case IL_LATEXPARAM:
|
||||
lex >> tmp;
|
||||
latexparam_ = subst(tmp, """, "\"");
|
||||
latexparam_ = subst(tmp, """, "\"");
|
||||
break;
|
||||
case IL_LEFTDELIM:
|
||||
lex >> leftdelim_;
|
||||
|
@ -1139,10 +1139,10 @@ string InsetListingsParams::encodedString() const
|
||||
// '"' is handled differently because it will
|
||||
// terminate a lyx token.
|
||||
string par = params();
|
||||
// '"' is now " ==> '"' is now &quot;
|
||||
// '"' is now " ==> '"' is now &#34;
|
||||
par = subst(par, "&", "&");
|
||||
// '"' is now &quot; ==> '"' is now &quot;
|
||||
par = subst(par, "\"", """);
|
||||
// '"' is now &#34; ==> '"' is now &#34;
|
||||
par = subst(par, "\"", """);
|
||||
return par;
|
||||
}
|
||||
|
||||
@ -1160,9 +1160,9 @@ void InsetListingsParams::fromEncodedString(string const & in)
|
||||
{
|
||||
// Decode string! Reversal of encodedString
|
||||
string par = in;
|
||||
// '"' is now &quot; ==> '"' is now &quot;
|
||||
par = subst(par, """, "\"");
|
||||
// '"' is now &quot; ==> '"' is now "
|
||||
// '"' is now &#34; ==> '"' is now &#34;
|
||||
par = subst(par, """, "\"");
|
||||
// '"' is now &#34; ==> '"' is now "
|
||||
par = subst(par, "&", "&");
|
||||
setParams(par);
|
||||
}
|
||||
|
@ -470,79 +470,6 @@ docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotesParams::getHTMLQuote(char_type c) const
|
||||
{
|
||||
string res;
|
||||
|
||||
switch (c){
|
||||
case 0x201a: // ,
|
||||
res = "‚";
|
||||
break;
|
||||
case 0x2019: // '
|
||||
res = "’";
|
||||
break;
|
||||
case 0x2018: // `
|
||||
res = "‘";
|
||||
break;
|
||||
case 0x2039: // <
|
||||
res = "‹";
|
||||
break;
|
||||
case 0x203a: // >
|
||||
res = "›";
|
||||
break;
|
||||
case 0x0027: // ' (plain)
|
||||
res = "'";
|
||||
break;
|
||||
case 0x201e: // ,,
|
||||
res = "„";
|
||||
break;
|
||||
case 0x201d: // ''
|
||||
res = "”";
|
||||
break;
|
||||
case 0x201c: // ``
|
||||
res = "“";
|
||||
break;
|
||||
case 0x00ab: // <<
|
||||
res = "«";
|
||||
break;
|
||||
case 0x00bb: // >>
|
||||
res = "»";
|
||||
break;
|
||||
case 0x0022: // "
|
||||
res = """;
|
||||
break;
|
||||
case 0x300c: // LEFT CORNER BRACKET
|
||||
res = "「";
|
||||
break;
|
||||
case 0x300d: // RIGHT CORNER BRACKET
|
||||
res = "」";
|
||||
break;
|
||||
case 0x300e: // LEFT WHITE CORNER BRACKET
|
||||
res = "『";
|
||||
break;
|
||||
case 0x300f: // RIGHT WHITE CORNER BRACKET
|
||||
res = "』";
|
||||
break;
|
||||
case 0x300a: // LEFT DOUBLE ANGLE BRACKET
|
||||
res = "《";
|
||||
break;
|
||||
case 0x300b: // RIGHT DOUBLE ANGLE BRACKET
|
||||
res = "》";
|
||||
break;
|
||||
case 0x3008: // LEFT ANGLE BRACKET
|
||||
res = "〈";
|
||||
break;
|
||||
case 0x3009: // RIGHT ANGLE BRACKET
|
||||
res = "〉";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return from_ascii(res);
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotesParams::getXMLQuote(char_type c) const
|
||||
{
|
||||
// Directly output the character Unicode form.
|
||||
@ -959,11 +886,10 @@ int InsetQuotes::plaintext(odocstringstream & os,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotes::getQuoteEntity(bool isHTML) const {
|
||||
docstring InsetQuotes::getQuoteXMLEntity() const {
|
||||
QuoteStyle style =
|
||||
(style_ == QuoteStyle::Dynamic) ? global_style_ : style_;
|
||||
docstring res = isHTML ? quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_)) :
|
||||
quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_));
|
||||
docstring res = quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_));
|
||||
|
||||
// in French, thin spaces are added inside double guillemets
|
||||
if (prefixIs(context_lang_, "fr")
|
||||
@ -984,13 +910,13 @@ docstring InsetQuotes::getQuoteEntity(bool isHTML) const {
|
||||
|
||||
void InsetQuotes::docbook(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
xs << XMLStream::ESCAPE_NONE << getQuoteEntity(false);
|
||||
xs << XMLStream::ESCAPE_NONE << getQuoteXMLEntity();
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotes::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
xs << XMLStream::ESCAPE_NONE << getQuoteEntity(true);
|
||||
xs << XMLStream::ESCAPE_NONE << getQuoteXMLEntity();
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,6 @@ public:
|
||||
docstring getLaTeXQuote(char_type c, std::string const &,
|
||||
bool const rtl = false) const;
|
||||
///
|
||||
docstring getHTMLQuote(char_type c) const;
|
||||
///
|
||||
docstring getXMLQuote(char_type c) const;
|
||||
/// Returns a descriptive label of a style suitable for dialog and menu
|
||||
docstring const getGuiLabel(QuoteStyle const & qs,
|
||||
@ -188,7 +186,7 @@ private:
|
||||
///
|
||||
docstring displayString() const;
|
||||
///
|
||||
docstring getQuoteEntity(bool isHTML) const;
|
||||
docstring getQuoteXMLEntity() const;
|
||||
///
|
||||
QuoteStyle getStyle(std::string const &);
|
||||
|
||||
|
@ -860,9 +860,9 @@ docstring InsetSpace::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
case InsetSpaceParams::NEGTHIN:
|
||||
case InsetSpaceParams::NEGMEDIUM:
|
||||
case InsetSpaceParams::NEGTHICK:
|
||||
output =" ";
|
||||
output =" ";
|
||||
break;
|
||||
// no XHTML entity, only unicode code for space character exists
|
||||
// no XML entity, only Unicode code for space character exists
|
||||
case InsetSpaceParams::VISIBLE:
|
||||
output ="␣";
|
||||
break;
|
||||
@ -884,7 +884,7 @@ docstring InsetSpace::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||
// FIXME XHTML
|
||||
// Probably we could do some sort of blank span?
|
||||
output =" ";
|
||||
output =" ";
|
||||
break;
|
||||
}
|
||||
// don't escape the entities!
|
||||
|
@ -530,96 +530,55 @@ int InsetSpecialChar::plaintext(odocstringstream & os,
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
string specialCharKindToXMLEntity(InsetSpecialChar::Kind kind) {
|
||||
switch (kind) {
|
||||
case InsetSpecialChar::Kind::HYPHENATION:
|
||||
// Soft hyphen.
|
||||
return "­";
|
||||
case InsetSpecialChar::Kind::ALLOWBREAK:
|
||||
// Zero-width space
|
||||
return "​";
|
||||
case InsetSpecialChar::Kind::LIGATURE_BREAK:
|
||||
// Zero width non-joiner
|
||||
return "‌";
|
||||
case InsetSpecialChar::Kind::END_OF_SENTENCE:
|
||||
return ".";
|
||||
case InsetSpecialChar::Kind::LDOTS:
|
||||
// …
|
||||
return "…";
|
||||
case InsetSpecialChar::Kind::MENU_SEPARATOR:
|
||||
// ⇒, right arrow.
|
||||
return "⇒";
|
||||
case InsetSpecialChar::Kind::SLASH:
|
||||
// ⁄, fractional slash.
|
||||
return "⁄";
|
||||
case InsetSpecialChar::Kind::NOBREAKDASH:
|
||||
// Non-breaking hyphen.
|
||||
return "‑";
|
||||
case InsetSpecialChar::Kind::PHRASE_LYX:
|
||||
return "LyX";
|
||||
case InsetSpecialChar::Kind::PHRASE_TEX:
|
||||
return "TeX";
|
||||
case InsetSpecialChar::Kind::PHRASE_LATEX2E:
|
||||
// Lower-case epsilon.
|
||||
return "LaTeX2ε";
|
||||
case InsetSpecialChar::Kind::PHRASE_LATEX:
|
||||
return "LaTeX";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetSpecialChar::docbook(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case HYPHENATION:
|
||||
// Soft hyphen.
|
||||
xs << XMLStream::ESCAPE_NONE << "­";
|
||||
break;
|
||||
case ALLOWBREAK:
|
||||
// Zero-width space
|
||||
xs << XMLStream::ESCAPE_NONE << "​";
|
||||
break;
|
||||
case LIGATURE_BREAK:
|
||||
// Zero width non-joiner
|
||||
xs << XMLStream::ESCAPE_NONE << "‌";
|
||||
break;
|
||||
case END_OF_SENTENCE:
|
||||
xs << '.';
|
||||
break;
|
||||
case LDOTS:
|
||||
// …
|
||||
xs << XMLStream::ESCAPE_NONE << "…";
|
||||
break;
|
||||
case MENU_SEPARATOR:
|
||||
// ⇒, right arrow.
|
||||
xs << XMLStream::ESCAPE_NONE << "⇒";
|
||||
break;
|
||||
case SLASH:
|
||||
// ⁄, fractional slash.
|
||||
xs << XMLStream::ESCAPE_NONE << "⁄";
|
||||
break;
|
||||
// Non-breaking hyphen.
|
||||
case NOBREAKDASH:
|
||||
xs << XMLStream::ESCAPE_NONE << "‑";
|
||||
break;
|
||||
case PHRASE_LYX:
|
||||
xs << "LyX";
|
||||
break;
|
||||
case PHRASE_TEX:
|
||||
xs << "TeX";
|
||||
break;
|
||||
case PHRASE_LATEX2E:
|
||||
// Lower-case epsilon.
|
||||
xs << "LaTeX2" << XMLStream::ESCAPE_NONE << "ε";
|
||||
break;
|
||||
case PHRASE_LATEX:
|
||||
xs << "LaTeX";
|
||||
break;
|
||||
}
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(specialCharKindToXMLEntity(kind_));
|
||||
}
|
||||
|
||||
|
||||
docstring InsetSpecialChar::xhtml(XMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case HYPHENATION:
|
||||
break;
|
||||
case ALLOWBREAK:
|
||||
xs << XMLStream::ESCAPE_NONE << "​";
|
||||
break;
|
||||
case LIGATURE_BREAK:
|
||||
xs << XMLStream::ESCAPE_NONE << "‌";
|
||||
break;
|
||||
case END_OF_SENTENCE:
|
||||
xs << '.';
|
||||
break;
|
||||
case LDOTS:
|
||||
xs << XMLStream::ESCAPE_NONE << "…";
|
||||
break;
|
||||
case MENU_SEPARATOR:
|
||||
xs << XMLStream::ESCAPE_NONE << "⇒";
|
||||
break;
|
||||
case SLASH:
|
||||
xs << XMLStream::ESCAPE_NONE << "⁄";
|
||||
break;
|
||||
case NOBREAKDASH:
|
||||
xs << XMLStream::ESCAPE_NONE << "‑";
|
||||
break;
|
||||
case PHRASE_LYX:
|
||||
xs << "LyX";
|
||||
break;
|
||||
case PHRASE_TEX:
|
||||
xs << "TeX";
|
||||
break;
|
||||
case PHRASE_LATEX2E:
|
||||
xs << "LaTeX2" << XMLStream::ESCAPE_NONE << "ε";
|
||||
break;
|
||||
case PHRASE_LATEX:
|
||||
xs << "LaTeX";
|
||||
break;
|
||||
}
|
||||
xs << XMLStream::ESCAPE_NONE << from_ascii(specialCharKindToXMLEntity(kind_));
|
||||
return docstring();
|
||||
}
|
||||
|
||||
@ -636,7 +595,7 @@ void InsetSpecialChar::toString(odocstream & os) const
|
||||
break;
|
||||
}
|
||||
odocstringstream ods;
|
||||
plaintext(ods, OutputParams(0));
|
||||
plaintext(ods, OutputParams(nullptr));
|
||||
os << ods.str();
|
||||
}
|
||||
|
||||
@ -645,7 +604,7 @@ void InsetSpecialChar::forOutliner(docstring & os, size_t const,
|
||||
bool const) const
|
||||
{
|
||||
odocstringstream ods;
|
||||
plaintext(ods, OutputParams(0));
|
||||
plaintext(ods, OutputParams(nullptr));
|
||||
os += ods.str();
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void InsetMathBig::normalize(NormalStream & os) const
|
||||
void InsetMathBig::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
ms << MTagInline("mo", "fence='true' stretchy='true' symmetric='true'")
|
||||
<< convertDelimToXMLEscape(delim_, ms.xmlMode())
|
||||
<< convertDelimToXMLEscape(delim_)
|
||||
<< ETagInline("mo");
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ void InsetMathBig::htmlize(HtmlStream & os) const
|
||||
default: name = "big"; break;
|
||||
}
|
||||
os << MTag("span", "class='" + name + "symbol'")
|
||||
<< convertDelimToXMLEscape(delim_, false)
|
||||
<< convertDelimToXMLEscape(delim_)
|
||||
<< ETag("span");
|
||||
}
|
||||
|
||||
|
@ -234,10 +234,7 @@ void InsetMathChar::mathmlize(MathMLStream & ms) const
|
||||
case '>': entity = ">"; break;
|
||||
case '&': entity = "&"; break;
|
||||
case ' ': {
|
||||
if (ms.xmlMode())
|
||||
ms << from_ascii(" ");
|
||||
else
|
||||
ms << from_ascii(" ");
|
||||
return;
|
||||
}
|
||||
default: break;
|
||||
@ -278,7 +275,7 @@ void InsetMathChar::htmlize(HtmlStream & ms) const
|
||||
case '<': entity = "<"; break;
|
||||
case '>': entity = ">"; break;
|
||||
case '&': entity = "&"; break;
|
||||
case ' ': entity = " "; break;
|
||||
case ' ': entity = " "; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
@ -188,10 +188,9 @@ void InsetMathDecoration::infoize(odocstream & os) const
|
||||
namespace {
|
||||
struct Attributes {
|
||||
Attributes() : over(false) {}
|
||||
Attributes(bool o, string const & t, string const & entity)
|
||||
: over(o), tag(t), entity(entity) {}
|
||||
Attributes(bool o, string_view entity)
|
||||
: over(o), entity(entity) {}
|
||||
bool over;
|
||||
string tag;
|
||||
string entity;
|
||||
};
|
||||
|
||||
@ -199,35 +198,35 @@ namespace {
|
||||
|
||||
void buildTranslationMap(TranslationMap & t) {
|
||||
// the decorations we need to support are listed in lib/symbols
|
||||
t["acute"] = Attributes(true, "´", "´");
|
||||
t["bar"] = Attributes(true, "‾", "¯");
|
||||
t["breve"] = Attributes(true, "˘", "˘");
|
||||
t["check"] = Attributes(true, "ˇ", "ˇ");
|
||||
t["ddddot"] = Attributes(true, "⃜", "⃜");
|
||||
t["dddot"] = Attributes(true, "⃛", "⃛");
|
||||
t["ddot"] = Attributes(true, "¨", "¨");
|
||||
t["dot"] = Attributes(true, "˙", "˙");
|
||||
t["grave"] = Attributes(true, "`", "`");
|
||||
t["hat"] = Attributes(true, "ˆ", "ˆ");
|
||||
t["mathring"] = Attributes(true, "˚", "˚");
|
||||
t["overbrace"] = Attributes(true, "⏞", "⏞");
|
||||
t["overleftarrow"] = Attributes(true, "⟵", "⟵");
|
||||
t["overleftrightarrow"] = Attributes(true, "⟷", "⟷");
|
||||
t["overline"] = Attributes(true, "¯", "¯");
|
||||
t["overrightarrow"] = Attributes(true, "⟶", "⟶");
|
||||
t["tilde"] = Attributes(true, "˜", "˜");
|
||||
t["underbar"] = Attributes(false, "_", "̲");
|
||||
t["underbrace"] = Attributes(false, "⏟", "⏟");
|
||||
t["underleftarrow"] = Attributes(false, "⟵", "⟵");
|
||||
t["underleftrightarrow"] = Attributes(false, "⟷", "⟷");
|
||||
t["acute"] = Attributes(true, "´");
|
||||
t["bar"] = Attributes(true, "¯");
|
||||
t["breve"] = Attributes(true, "˘");
|
||||
t["check"] = Attributes(true, "ˇ");
|
||||
t["ddddot"] = Attributes(true, "⃜");
|
||||
t["dddot"] = Attributes(true, "⃛");
|
||||
t["ddot"] = Attributes(true, "¨");
|
||||
t["dot"] = Attributes(true, "˙");
|
||||
t["grave"] = Attributes(true, "`");
|
||||
t["hat"] = Attributes(true, "ˆ");
|
||||
t["mathring"] = Attributes(true, "˚");
|
||||
t["overbrace"] = Attributes(true, "⏞");
|
||||
t["overleftarrow"] = Attributes(true, "⟵");
|
||||
t["overleftrightarrow"] = Attributes(true, "⟷");
|
||||
t["overline"] = Attributes(true, "¯");
|
||||
t["overrightarrow"] = Attributes(true, "⟶");
|
||||
t["tilde"] = Attributes(true, "˜");
|
||||
t["underbar"] = Attributes(false, "̲");
|
||||
t["underbrace"] = Attributes(false, "⏟");
|
||||
t["underleftarrow"] = Attributes(false, "⟵");
|
||||
t["underleftrightarrow"] = Attributes(false, "⟷");
|
||||
// this is the macron, again, but it works
|
||||
t["underline"] = Attributes(false, "¯", "¯");
|
||||
t["underrightarrow"] = Attributes(false, "⟶", "⟶");
|
||||
t["undertilde"] = Attributes(false, "∼", "∼");
|
||||
t["utilde"] = Attributes(false, "∼", "∼");
|
||||
t["vec"] = Attributes(true, "→", "→");
|
||||
t["widehat"] = Attributes(true, "^", "^");
|
||||
t["widetilde"] = Attributes(true, "∼", "∼");
|
||||
t["underline"] = Attributes(false, "¯");
|
||||
t["underrightarrow"] = Attributes(false, "⟶");
|
||||
t["undertilde"] = Attributes(false, "∼");
|
||||
t["utilde"] = Attributes(false, "∼");
|
||||
t["vec"] = Attributes(true, "→");
|
||||
t["widehat"] = Attributes(true, "^");
|
||||
t["widetilde"] = Attributes(true, "∼");
|
||||
}
|
||||
|
||||
TranslationMap const & translationMap() {
|
||||
@ -244,7 +243,7 @@ void InsetMathDecoration::mathmlize(MathMLStream & ms) const
|
||||
TranslationMap::const_iterator cur = t.find(to_utf8(key_->name));
|
||||
LASSERT(cur != t.end(), return);
|
||||
char const * const outag = cur->second.over ? "mover" : "munder";
|
||||
std::string decoration = ms.xmlMode() ? cur->second.entity : cur->second.tag;
|
||||
std::string decoration = cur->second.entity;
|
||||
ms << MTag(outag)
|
||||
<< cell(0)
|
||||
<< "<" << from_ascii(ms.namespacedTag("mo")) << " stretchy=\"true\">"
|
||||
@ -277,14 +276,14 @@ void InsetMathDecoration::htmlize(HtmlStream & os) const
|
||||
<< '\n';
|
||||
|
||||
if (symontop)
|
||||
os << MTag("span", "class='symbol'") << from_ascii(cur->second.tag);
|
||||
os << MTag("span", "class='symbol'") << from_ascii(cur->second.entity);
|
||||
else
|
||||
os << MTag("span", "class='base'") << cell(0);
|
||||
os << ETag("span") << '\n';
|
||||
if (symontop)
|
||||
os << MTag("span", "class='base'") << cell(0);
|
||||
else
|
||||
os << MTag("span", "class='symbol'") << from_ascii(cur->second.tag);
|
||||
os << MTag("span", "class='symbol'") << from_ascii(cur->second.entity);
|
||||
os << ETag("span") << '\n' << ETag("span") << '\n';
|
||||
}
|
||||
|
||||
|
@ -183,11 +183,11 @@ void InsetMathDelim::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
ms << MTag("mrow")
|
||||
<< MTagInline("mo", "form='prefix' fence='true' stretchy='true' symmetric='true'")
|
||||
<< convertDelimToXMLEscape(left_, ms.xmlMode())
|
||||
<< convertDelimToXMLEscape(left_)
|
||||
<< ETagInline("mo")
|
||||
<< cell(0)
|
||||
<< MTagInline("mo", "form='postfix' fence='true' stretchy='true' symmetric='true'")
|
||||
<< convertDelimToXMLEscape(right_, ms.xmlMode())
|
||||
<< convertDelimToXMLEscape(right_)
|
||||
<< ETagInline("mo")
|
||||
<< ETag("mrow");
|
||||
}
|
||||
@ -195,9 +195,9 @@ void InsetMathDelim::mathmlize(MathMLStream & ms) const
|
||||
|
||||
void InsetMathDelim::htmlize(HtmlStream & os) const
|
||||
{
|
||||
os << convertDelimToXMLEscape(left_, false)
|
||||
os << convertDelimToXMLEscape(left_)
|
||||
<< cell(0)
|
||||
<< convertDelimToXMLEscape(right_, false);
|
||||
<< convertDelimToXMLEscape(right_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,60 +74,34 @@ void InsetMathDots::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDots::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
namespace {
|
||||
std::string symbolToXMLEntity(docstring const & n) {
|
||||
// which symbols we support is decided by what is listed in
|
||||
// lib/symbols as generating a dots inset
|
||||
docstring const & n = key_->name;
|
||||
std::string ent;
|
||||
if (ms.xmlMode()) {
|
||||
if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
|
||||
ent = "…";
|
||||
return "…";
|
||||
else if (n == "adots" || n == "iddots")
|
||||
ent = "⋰";
|
||||
return "⋰";
|
||||
else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
|
||||
ent = "⋯";
|
||||
return "⋯";
|
||||
else if (n == "ddots")
|
||||
ent = "⋱";
|
||||
return "⋱";
|
||||
else if (n == "vdots")
|
||||
ent = "⋮";
|
||||
else LASSERT(false, ent = "…");
|
||||
} else {
|
||||
if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
|
||||
ent = "…";
|
||||
else if (n == "adots" || n == "iddots")
|
||||
ent = "⋰";
|
||||
else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
|
||||
ent = "⋯";
|
||||
else if (n == "ddots")
|
||||
ent = "⋱";
|
||||
else if (n == "vdots")
|
||||
ent = "⋮";
|
||||
else LASSERT(false, ent = "…");
|
||||
}
|
||||
ms << MTagInline("mi") << from_ascii(ent) << ETagInline("mi");
|
||||
return "⋮";
|
||||
else LASSERT(false, return "…");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDots::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
ms << MTagInline("mi") << from_ascii(symbolToXMLEntity(key_->name)) << ETagInline("mi");
|
||||
}
|
||||
|
||||
|
||||
void InsetMathDots::htmlize(HtmlStream & os) const
|
||||
{
|
||||
// which symbols we support is decided by what is listed in
|
||||
// lib/symbols as generating a dots inset
|
||||
docstring const & n = key_->name;
|
||||
std::string ent;
|
||||
if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
|
||||
ent = "…";
|
||||
else if (n == "adots" || n == "iddots")
|
||||
ent = "⋰";
|
||||
else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
|
||||
ent = "⋯";
|
||||
else if (n == "ddots")
|
||||
ent = "⋱";
|
||||
else if (n == "vdots")
|
||||
ent = "⋮";
|
||||
else
|
||||
LASSERT(false, ent = "#x02026;");
|
||||
os << from_ascii(ent);
|
||||
os << from_ascii(symbolToXMLEntity(key_->name));
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -2419,7 +2419,7 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
|
||||
}
|
||||
|
||||
odocstringstream osmath;
|
||||
MathMLStream ms(osmath, mathmlNamespacePrefix, true);
|
||||
MathMLStream ms(osmath, mathmlNamespacePrefix);
|
||||
|
||||
// Output the MathML subtree.
|
||||
// TeX transcription. Avoid MTag/ETag so that there are no extraneous spaces.
|
||||
@ -2442,7 +2442,7 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
|
||||
// First, generate the MathML expression. If there is an error in the generation, this block is not fully
|
||||
// executed, and the formula is not output to the DocBook stream.
|
||||
odocstringstream ostmp;
|
||||
MathMLStream mstmp(ostmp, ms.xmlns(), ms.xmlMode());
|
||||
MathMLStream mstmp(ostmp, ms.xmlns());
|
||||
mathmlize(mstmp);
|
||||
|
||||
// Choose the display style for the formula, to be output as an attribute near the formula root.
|
||||
|
@ -1303,7 +1303,7 @@ void InsetMathMacro::mathmlize(MathMLStream & ms) const
|
||||
// macro_ is 0 if this is an unknown macro
|
||||
LATTEST(d->macro_ || d->displayMode_ != DISPLAY_NORMAL);
|
||||
if (d->macro_) {
|
||||
docstring const xmlname = (ms.xmlMode()) ? d->macro_->xmlname() : d->macro_->htmlname();
|
||||
docstring const xmlname = d->macro_->xmlname();
|
||||
if (!xmlname.empty()) {
|
||||
char const * type = d->macro_->MathMLtype();
|
||||
ms << "<" << from_ascii(ms.namespacedTag(type)) << ">"
|
||||
@ -1325,7 +1325,7 @@ void InsetMathMacro::htmlize(HtmlStream & os) const
|
||||
// macro_ is 0 if this is an unknown macro
|
||||
LATTEST(d->macro_ || d->displayMode_ != DISPLAY_NORMAL);
|
||||
if (d->macro_) {
|
||||
docstring const xmlname = d->macro_->htmlname();
|
||||
docstring const xmlname = d->macro_->xmlname();
|
||||
if (!xmlname.empty()) {
|
||||
os << ' ' << xmlname << ' ';
|
||||
return;
|
||||
|
@ -95,7 +95,7 @@ void InsetMathMatrix::mathematica(MathematicaStream & os) const
|
||||
void InsetMathMatrix::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
ms << "<" << from_ascii(ms.namespacedTag("mo")) << " form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
|
||||
<< convertDelimToXMLEscape(left_, ms.xmlMode())
|
||||
<< convertDelimToXMLEscape(left_)
|
||||
<< "</" << from_ascii(ms.namespacedTag("mo")) << ">"
|
||||
<< MTag("mtable");
|
||||
for (row_type row = 0; row < nrows(); ++row) {
|
||||
@ -114,7 +114,7 @@ void InsetMathMatrix::mathmlize(MathMLStream & ms) const
|
||||
}
|
||||
ms << ETag("mtable")
|
||||
<< "<" << from_ascii(ms.namespacedTag("mo")) << " form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
|
||||
<< convertDelimToXMLEscape(right_, ms.xmlMode())
|
||||
<< convertDelimToXMLEscape(right_)
|
||||
<< "</" << from_ascii(ms.namespacedTag("mo")) << ">";
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ void InsetMathRoot::htmlize(HtmlStream & os) const
|
||||
{
|
||||
os << MTag("span", "class='root'")
|
||||
<< MTag("sup") << cell(1) << ETag("sup")
|
||||
<< from_ascii("√")
|
||||
<< from_ascii("√")
|
||||
<< MTag("span", "class='rootof'") << cell(0) << ETag("span")
|
||||
<< ETag("span");
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ void InsetMathSpace::htmlize(HtmlStream & ms) const
|
||||
ms << from_ascii(" ");
|
||||
break;
|
||||
case InsetSpaceParams::MEDIUM:
|
||||
ms << from_ascii(" ");
|
||||
ms << from_ascii(" ");
|
||||
break;
|
||||
case InsetSpaceParams::THICK:
|
||||
ms << from_ascii(" ");
|
||||
@ -248,12 +248,12 @@ void InsetMathSpace::htmlize(HtmlStream & ms) const
|
||||
case InsetSpaceParams::CUSTOM_PROTECTED: {
|
||||
string l = length_.asHTMLString();
|
||||
ms << MTag("span", "width='" + l + "'")
|
||||
<< from_ascii(" ") << ETag("span");
|
||||
<< from_ascii(" ") << ETag("span");
|
||||
break;
|
||||
}
|
||||
case InsetSpaceParams::NORMAL:
|
||||
case InsetSpaceParams::PROTECTED:
|
||||
ms << from_ascii(" ");
|
||||
ms << from_ascii(" ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -107,7 +107,7 @@ void InsetMathSqrt::mathmlize(MathMLStream & ms) const
|
||||
void InsetMathSqrt::htmlize(HtmlStream & os) const
|
||||
{
|
||||
os << MTag("span", "class='sqrt'")
|
||||
<< from_ascii("√")
|
||||
<< from_ascii("√")
|
||||
<< MTag("span", "class='sqrtof'") << cell(0) << ETag("span")
|
||||
<< ETag("span");
|
||||
}
|
||||
|
@ -162,13 +162,11 @@ void InsetMathSymbol::mathmlize(MathMLStream & ms) const
|
||||
// with MathMLtype.
|
||||
docstring tag = from_ascii(ms.namespacedTag(sym_->MathMLtype()));
|
||||
ms << '<' << tag << ">";
|
||||
if ((ms.xmlMode() && sym_->xmlname == "x") || (!ms.xmlMode() && sym_->htmlname == "x"))
|
||||
if (sym_->xmlname == "x")
|
||||
// unknown so far
|
||||
ms << name();
|
||||
else if (ms.xmlMode())
|
||||
ms << sym_->xmlname;
|
||||
else
|
||||
ms << sym_->htmlname;
|
||||
ms << sym_->xmlname;
|
||||
ms << "</" << tag << '>';
|
||||
}
|
||||
|
||||
@ -180,13 +178,13 @@ void InsetMathSymbol::htmlize(HtmlStream & os, bool spacing) const
|
||||
char const * type = sym_->MathMLtype();
|
||||
bool op = (std::string(type) == "mo");
|
||||
|
||||
if (sym_->htmlname == "x")
|
||||
if (sym_->xmlname == "x")
|
||||
// unknown so far
|
||||
os << ' ' << name() << ' ';
|
||||
else if (op && spacing)
|
||||
os << ' ' << sym_->htmlname << ' ';
|
||||
os << ' ' << sym_->xmlname << ' ';
|
||||
else
|
||||
os << sym_->htmlname;
|
||||
os << sym_->xmlname;
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,25 +84,6 @@ void InsetMathXArrow::normalize(NormalStream & os) const
|
||||
}
|
||||
|
||||
|
||||
static std::map<string, string> latex_to_html_entities = {
|
||||
{"xleftarrow", "←"},
|
||||
{"xrightarrow", "→"},
|
||||
{"xhookleftarrow", "↩"},
|
||||
{"xhookrightarrow", "↪"},
|
||||
{"xLeftarrow", "⇐"},
|
||||
{"xRightarrow", "⇒"},
|
||||
{"xleftrightarrow", "↔"},
|
||||
{"xLeftrightarrow", "⇔"},
|
||||
{"xleftharpoondown", "↽"},
|
||||
{"xleftharpoonup", "↼"},
|
||||
{"xleftrightharpoons", "⇋"},
|
||||
{"xrightharpoondown", "⇁"},
|
||||
{"xrightharpoonup", "⇀"},
|
||||
{"xrightleftharpoons", "⇌"},
|
||||
{"xmapsto", "↦"},
|
||||
};
|
||||
|
||||
|
||||
static std::map<string, string> latex_to_xml_entities = {
|
||||
{"xleftarrow", "←"},
|
||||
{"xrightarrow", "→"},
|
||||
@ -122,17 +103,14 @@ static std::map<string, string> latex_to_xml_entities = {
|
||||
};
|
||||
|
||||
|
||||
docstring map_latex_to(docstring latex, bool xml = false)
|
||||
docstring map_latex_to(docstring latex)
|
||||
{
|
||||
auto dict = (xml) ? latex_to_xml_entities : latex_to_html_entities;
|
||||
|
||||
auto mapping = dict.find(to_ascii(latex));
|
||||
if (mapping != dict.end()) {
|
||||
auto mapping = latex_to_xml_entities.find(to_ascii(latex));
|
||||
if (mapping != latex_to_xml_entities.end()) {
|
||||
return from_ascii(mapping->second);
|
||||
} else {
|
||||
std::string format = (xml) ? "XML" : "HTML";
|
||||
lyxerr << "mathmlize " << format << " conversion for '" << latex << "' not implemented" << endl;
|
||||
LASSERT(false, return from_ascii(dict["xrightarrow"]));
|
||||
lyxerr << "mathmlize conversion for '" << latex << "' not implemented" << endl;
|
||||
LASSERT(false, return from_ascii(latex_to_xml_entities["xrightarrow"]));
|
||||
return docstring();
|
||||
}
|
||||
}
|
||||
@ -140,7 +118,7 @@ docstring map_latex_to(docstring latex, bool xml = false)
|
||||
|
||||
void InsetMathXArrow::mathmlize(MathMLStream & ms) const
|
||||
{
|
||||
docstring arrow = map_latex_to(name_, ms.xmlMode());
|
||||
docstring arrow = map_latex_to(name_);
|
||||
ms << "<" << from_ascii(ms.namespacedTag("munderover")) << " accent='false' accentunder='false'>"
|
||||
<< MTagInline("mo") << arrow << ETagInline("mo")
|
||||
<< cell(1) << cell(0)
|
||||
|
@ -121,14 +121,6 @@ bool MacroData::hidden() const
|
||||
}
|
||||
|
||||
|
||||
docstring const MacroData::htmlname() const
|
||||
{
|
||||
if (sym_)
|
||||
return sym_->htmlname;
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
docstring const MacroData::xmlname() const
|
||||
{
|
||||
if (sym_)
|
||||
|
@ -63,8 +63,6 @@ public:
|
||||
///
|
||||
bool hidden() const;
|
||||
///
|
||||
docstring const htmlname() const;
|
||||
///
|
||||
docstring const xmlname() const;
|
||||
///
|
||||
char const * MathMLtype() const;
|
||||
|
@ -188,11 +188,12 @@ void initSymbols()
|
||||
// \def\macroname{definition} requires
|
||||
// or
|
||||
// \def\macroname{definition} extra htmlname xmlname requires
|
||||
// TODO: remove htmlname
|
||||
istringstream is(line);
|
||||
string macro;
|
||||
string required;
|
||||
string extra;
|
||||
string htmlname;
|
||||
string htmlname; // Ignored. TODO: remove.
|
||||
string xmlname;
|
||||
bool hidden = false;
|
||||
is >> setw(65536) >> macro >> required;
|
||||
@ -201,10 +202,10 @@ void initSymbols()
|
||||
if (!(is >> required))
|
||||
required = "";
|
||||
} else
|
||||
htmlname = xmlname = "";
|
||||
xmlname = "";
|
||||
MacroTable::iterator it = MacroTable::globalMacros().insert(
|
||||
nullptr, from_utf8(macro));
|
||||
if (!extra.empty() || !htmlname.empty() || !xmlname.empty() || !required.empty()) {
|
||||
if (!extra.empty() || !xmlname.empty() || !required.empty()) {
|
||||
MathWordList::iterator wit = theMathWordList.find(it->first);
|
||||
if (wit != theMathWordList.end())
|
||||
LYXERR(Debug::MATHED, "readSymbols: inset "
|
||||
@ -214,7 +215,6 @@ void initSymbols()
|
||||
tmp.inset = "macro";
|
||||
tmp.name = it->first;
|
||||
tmp.extra = from_utf8(extra);
|
||||
tmp.htmlname = from_utf8(htmlname);
|
||||
tmp.xmlname = from_utf8(xmlname);
|
||||
if (required == "hiddensymbol") {
|
||||
required = "";
|
||||
@ -232,7 +232,6 @@ void initSymbols()
|
||||
<< " inset: macro"
|
||||
<< " draw: 0"
|
||||
<< " extra: " << extra
|
||||
<< " html: " << htmlname
|
||||
<< " xml: " << xmlname
|
||||
<< " requires: " << required
|
||||
<< " hidden: " << hidden << '\'');
|
||||
@ -245,7 +244,7 @@ void initSymbols()
|
||||
is >> tmp.name >> help;
|
||||
tmp.inset = to_ascii(help);
|
||||
if (isFontName(tmp.inset)) {
|
||||
is >> help >> fallbackid >> tmp.extra >> tmp.htmlname >> tmp.xmlname;
|
||||
is >> help >> fallbackid >> tmp.extra >> tmp.xmlname;
|
||||
docstring cid, dsp_cid;
|
||||
idocstringstream is2(subst(help, '|', ' '));
|
||||
is2 >> charid >> dsp_charid;
|
||||
@ -338,7 +337,6 @@ void initSymbols()
|
||||
<< " inset: " << tmp.inset
|
||||
<< " draw: " << int(tmp.draw.empty() ? 0 : tmp.draw[0])
|
||||
<< " extra: " << to_utf8(tmp.extra)
|
||||
<< " html: " << to_utf8(tmp.htmlname)
|
||||
<< " xml: " << to_utf8(tmp.xmlname)
|
||||
<< " requires: " << tmp.required
|
||||
<< " hidden: " << tmp.hidden << '\'');
|
||||
|
@ -57,8 +57,6 @@ public:
|
||||
docstring dsp_draw;
|
||||
/// operator/..., fontname e
|
||||
docstring extra;
|
||||
/// how is this called as HTML entity in MathML?
|
||||
docstring htmlname;
|
||||
/// how is this called as XML entity in MathML?
|
||||
docstring xmlname;
|
||||
/// required LaTeXFeatures
|
||||
|
@ -288,8 +288,8 @@ TeXMathStream & operator<<(TeXMathStream & ws, unsigned int i)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns, bool xmlMode)
|
||||
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns), xml_mode_(xmlMode)
|
||||
MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns)
|
||||
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns)
|
||||
{
|
||||
if (in_text_)
|
||||
font_math_style_ = TEXT_STYLE;
|
||||
@ -751,9 +751,8 @@ OctaveStream & operator<<(OctaveStream & os, string const & s)
|
||||
}
|
||||
|
||||
|
||||
docstring convertDelimToXMLEscape(docstring const & name, bool xmlmode)
|
||||
docstring convertDelimToXMLEscape(docstring const & name)
|
||||
{
|
||||
// For the basic symbols, no difference between XML and HTML.
|
||||
if (name.size() == 1) {
|
||||
char_type const c = name[0];
|
||||
if (c == '<')
|
||||
@ -772,8 +771,7 @@ docstring convertDelimToXMLEscape(docstring const & name, bool xmlmode)
|
||||
MathWordList const & words = mathedWordList();
|
||||
MathWordList::const_iterator it = words.find(name);
|
||||
if (it != words.end()) {
|
||||
// Only difference between XML and HTML, based on the contents read by MathFactory.
|
||||
docstring const escape = xmlmode ? it->second.xmlname : it->second.htmlname;
|
||||
docstring const escape = it->second.xmlname;
|
||||
return escape;
|
||||
}
|
||||
LYXERR0("Unable to find `" << name <<"' in the mathWordList.");
|
||||
|
@ -377,7 +377,7 @@ class MathExportException : public std::exception {};
|
||||
class MathMLStream {
|
||||
public:
|
||||
/// Builds a stream proxy for os; the MathML namespace is given by xmlns (supposed to be already defined elsewhere in the document).
|
||||
explicit MathMLStream(odocstream & os, std::string const & xmlns = "", bool xmlMode = false);
|
||||
explicit MathMLStream(odocstream & os, std::string const & xmlns = "");
|
||||
///
|
||||
void cr();
|
||||
///
|
||||
@ -398,8 +398,6 @@ public:
|
||||
bool inText() const { return in_text_; }
|
||||
///
|
||||
std::string xmlns() const { return xmlns_; }
|
||||
///
|
||||
bool xmlMode() const { return xml_mode_; }
|
||||
/// Returns the tag name prefixed by the name space if needed.
|
||||
std::string namespacedTag(std::string const & tag) const {
|
||||
return (xmlns().empty() ? "" : xmlns() + ":") + tag;
|
||||
@ -423,8 +421,6 @@ private:
|
||||
odocstringstream deferred_;
|
||||
///
|
||||
std::string xmlns_;
|
||||
///
|
||||
bool xml_mode_;
|
||||
/// The only important part of a FontInfo object.
|
||||
MathStyle font_math_style_;
|
||||
///
|
||||
@ -699,7 +695,7 @@ OctaveStream & operator<<(OctaveStream &, char);
|
||||
OctaveStream & operator<<(OctaveStream &, int);
|
||||
|
||||
|
||||
docstring convertDelimToXMLEscape(docstring const & name, bool xmlmode);
|
||||
docstring convertDelimToXMLEscape(docstring const & name);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user