]> git.lyx.org Git - lyx.git/commitdiff
LyXHTML: switch the doctype to (X)HTML5 and only output XML entities.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Fri, 23 Dec 2022 01:16:08 +0000 (02:16 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sun, 25 Dec 2022 19:48:14 +0000 (20:48 +0100)
This is a new take on c8e2c17a that was reverted at da67bde61af 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 &quot; 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.

31 files changed:
lib/RELEASE-NOTES
src/Buffer.cpp
src/LaTeXFeatures.cpp
src/LaTeXFeatures.h
src/Layout.cpp
src/Paragraph.cpp
src/insets/InsetLayout.cpp
src/insets/InsetListingsParams.cpp
src/insets/InsetQuotes.cpp
src/insets/InsetQuotes.h
src/insets/InsetSpace.cpp
src/insets/InsetSpecialChar.cpp
src/mathed/InsetMathBig.cpp
src/mathed/InsetMathChar.cpp
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDelim.cpp
src/mathed/InsetMathDots.cpp
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathMatrix.cpp
src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathSpace.cpp
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathSymbol.cpp
src/mathed/InsetMathXArrow.cpp
src/mathed/MacroTable.cpp
src/mathed/MacroTable.h
src/mathed/MathFactory.cpp
src/mathed/MathParser.h
src/mathed/MathStream.cpp
src/mathed/MathStream.h

index 2c6f80e4561e6fff6af31790954ef52957c082bc..39d5e8fa1530efc29ee723d3931b193de9dacea7 100644 (file)
 * 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 &#45;
+  instead of &quot;).
+
 * 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),
index c7e479a489f0bb89988a5ecf3c08c2563db28ef6..b1d14d245c5b520d75d199b5672e653ca346875f 100644 (file)
@@ -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() + '"'
-                                               + " 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\"";
+               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";
 
index 0bed75a07363e708fa6e4a7e52593cc081db99a5..364a4921e1ac13799cd76ab7853de9fa41f32ef0 100644 (file)
@@ -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 \"-&gt;\">" << '\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:"
index a19d2ab68a4dcb4d4115884b19eedd5bea5ff2a3..10f7c320f075e5cf0acd53dec48b32c75f829258 100644 (file)
@@ -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.
index 515226da3e1f677003eea62bbd5c3eccb9377334..716da3f78c16327aa464303c26e238297c972881 100644 (file)
@@ -515,7 +515,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
 
                case LT_LATEXPARAM:
                        lex >> latexparam_;
-                       latexparam_ = subst(latexparam_, "&quot;", "\"");
+                       latexparam_ = subst(latexparam_, "&#34;", "\"");
                        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_, "\"", "&quot;")
+               os << "\tLatexParam \"" << subst(latexparam_, "\"", "&#34;")
                   << "\"\n";
        if (!leftdelim_.empty())
                os << "\tLeftDelim "
index 8f5f6f371d4cf399565d0aee3c953cb317b0a8fb..e2338ba6a1f4972525a5d0b634d0bd9de6719283 100644 (file)
@@ -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 << "&nbsp;";
+                               xs << XMLStream::ESCAPE_NONE << "&#160;";
                        else if (c == '\'')
                                xs << XMLStream::ESCAPE_NONE << "&#8217;";
                        else
index 0d1322aa7fbeee1e0393ea2707ff0a82b00766c5..6c4c0286a062de47302406d3beed9ff45116d556 100644 (file)
@@ -312,7 +312,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
                        break;
                case IL_LATEXPARAM:
                        lex >> tmp;
-                       latexparam_ = subst(tmp, "&quot;", "\"");
+                       latexparam_ = subst(tmp, "&#34;", "\"");
                        break;
                case IL_LEFTDELIM:
                        lex >> leftdelim_;
index 9390d6bbe4549867005cfe5e2ed3b2c8add7cecf..e017d523527f7a9b2b4d17a275e946c327a164f1 100644 (file)
@@ -1139,10 +1139,10 @@ string InsetListingsParams::encodedString() const
        // '"' is handled differently because it will
        // terminate a lyx token.
        string par = params();
-       // '"' is now &quot;  ==> '"' is now &amp;quot;
+       // '"' is now &#34;  ==> '"' is now &amp;#34;
        par = subst(par, "&", "&amp;");
-       // '"' is now &amp;quot; ==> '&quot;' is now &amp;quot;
-       par = subst(par, "\"", "&quot;");
+       // '"' is now &amp;#34; ==> '&#34;' is now &amp;#34;
+       par = subst(par, "\"", "&#34;");
        return par;
 }
 
@@ -1160,9 +1160,9 @@ void InsetListingsParams::fromEncodedString(string const & in)
 {
        // Decode string! Reversal of encodedString
        string par = in;
-       // '&quot;' is now &amp;quot; ==> '"' is now &amp;quot;
-       par = subst(par, "&quot;", "\"");
-       //  '"' is now &amp;quot; ==> '"' is now &quot;
+       // '&#34;' is now &amp;#34; ==> '"' is now &amp;#34;
+       par = subst(par, "&#34;", "\"");
+       //  '"' is now &amp;#34; ==> '"' is now &#34;
        par = subst(par, "&amp;", "&");
        setParams(par);
 }
index 19eb846baabc358107533a81cacb372c7fa8d557..6fcc755d816e7ee44029afc62caf1fa20b49b2de 100644 (file)
@@ -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 = "&sbquo;";
-               break;
-       case 0x2019: // '
-               res = "&rsquo;";
-               break;
-       case 0x2018: // `
-               res = "&lsquo;";
-               break;
-       case 0x2039: // <
-               res = "&lsaquo;";
-               break;
-       case 0x203a: // >
-               res = "&rsaquo;";
-               break;
-       case 0x0027: // ' (plain)
-               res = "&#x27;";
-               break;
-       case 0x201e: // ,,
-               res = "&bdquo;";
-               break;
-       case 0x201d: // ''
-               res = "&rdquo;";
-               break;
-       case 0x201c: // ``
-               res = "&ldquo;";
-               break;
-       case 0x00ab: // <<
-               res = "&laquo;";
-               break;
-       case 0x00bb: // >>
-               res = "&raquo;";
-               break;
-       case 0x0022: // "
-               res = "&quot;";
-               break;
-       case 0x300c: // LEFT CORNER BRACKET
-               res = "&#x300c;";
-               break;
-       case 0x300d: // RIGHT CORNER BRACKET
-               res = "&#x300d;";
-               break;
-       case 0x300e: // LEFT WHITE CORNER BRACKET
-               res = "&#x300e;";
-               break;
-       case 0x300f: // RIGHT WHITE CORNER BRACKET
-               res = "&#x300f;";
-               break;
-       case 0x300a: // LEFT DOUBLE ANGLE BRACKET
-               res = "&#x300a;";
-               break;
-       case 0x300b: // RIGHT DOUBLE ANGLE BRACKET
-               res = "&#x300b;";
-               break;
-       case 0x3008: // LEFT ANGLE BRACKET
-               res = "&#x3008;";
-               break;
-       case 0x3009: // RIGHT ANGLE BRACKET
-               res = "&#x3009;";
-               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();
 }
 
index c4b525ce8c8de6757364af799779eb8cf26fd28a..5541af4a6793a45c411b83263e619617e4fe7de4 100644 (file)
@@ -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 &);
 
index b7323b61629d7a2a683399ca6a98e0f67a84301e..71c73951db5393704123d1acdfeae18d5d45f3ef 100644 (file)
@@ -860,9 +860,9 @@ docstring InsetSpace::xhtml(XMLStream & xs, OutputParams const &) const
        case InsetSpaceParams::NEGTHIN:
        case InsetSpaceParams::NEGMEDIUM:
        case InsetSpaceParams::NEGTHICK:
-               output ="&nbsp;";
+               output ="&#160;";
                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 ="&#x2423;";
                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 ="&nbsp;";
+               output ="&#160;";
                break;
        }
        // don't escape the entities!
index 88af6538f68b6b44110ac5fdefb7c3f95098ba7c..1dcc3daf5003045e0531f9f7bd3e0cac4b0e3840 100644 (file)
@@ -530,96 +530,55 @@ int InsetSpecialChar::plaintext(odocstringstream & os,
 }
 
 
-void InsetSpecialChar::docbook(XMLStream & xs, OutputParams const &) const
-{
-       switch (kind_) {
-    case HYPHENATION:
-       // Soft hyphen.
-        xs << XMLStream::ESCAPE_NONE << "&#xAD;";
-        break;
-    case ALLOWBREAK:
-       // Zero-width space
-        xs << XMLStream::ESCAPE_NONE << "&#x200B;";
-        break;
-       case LIGATURE_BREAK:
+namespace {
+string specialCharKindToXMLEntity(InsetSpecialChar::Kind kind) {
+       switch (kind) {
+       case InsetSpecialChar::Kind::HYPHENATION:
+               // Soft hyphen.
+               return "&#xAD;";
+       case InsetSpecialChar::Kind::ALLOWBREAK:
+               // Zero-width space
+               return "&#x200B;";
+       case InsetSpecialChar::Kind::LIGATURE_BREAK:
                // Zero width non-joiner
-               xs << XMLStream::ESCAPE_NONE << "&#x200C;";
-               break;
-       case END_OF_SENTENCE:
-               xs << '.';
-               break;
-       case LDOTS:
+               return "&#x200C;";
+       case InsetSpecialChar::Kind::END_OF_SENTENCE:
+               return ".";
+       case InsetSpecialChar::Kind::LDOTS:
                // &hellip;
-               xs << XMLStream::ESCAPE_NONE << "&#x2026;";
-               break;
-       case MENU_SEPARATOR:
+               return "&#x2026;";
+       case InsetSpecialChar::Kind::MENU_SEPARATOR:
                // &rArr;, right arrow.
-               xs << XMLStream::ESCAPE_NONE << "&#x21D2;";
-               break;
-       case SLASH:
+               return "&#x21D2;";
+       case InsetSpecialChar::Kind::SLASH:
                // &frasl;, fractional slash.
-               xs << XMLStream::ESCAPE_NONE << "&#x2044;";
-               break;
+               return "&#x2044;";
+       case InsetSpecialChar::Kind::NOBREAKDASH:
                // Non-breaking hyphen.
-       case NOBREAKDASH:
-               xs << XMLStream::ESCAPE_NONE << "&#x2011;";
-               break;
-       case PHRASE_LYX:
-               xs << "LyX";
-               break;
-       case PHRASE_TEX:
-               xs << "TeX";
-               break;
-       case PHRASE_LATEX2E:
+               return "&#x2011;";
+       case InsetSpecialChar::Kind::PHRASE_LYX:
+               return "LyX";
+       case InsetSpecialChar::Kind::PHRASE_TEX:
+               return "TeX";
+       case InsetSpecialChar::Kind::PHRASE_LATEX2E:
                // Lower-case epsilon.
-               xs << "LaTeX2" << XMLStream::ESCAPE_NONE << "&#x03b5;";
-               break;
-       case PHRASE_LATEX:
-               xs << "LaTeX";
-               break;
+               return "LaTeX2&#x03b5;";
+       case InsetSpecialChar::Kind::PHRASE_LATEX:
+               return "LaTeX";
        }
 }
+}
+
+
+void InsetSpecialChar::docbook(XMLStream & xs, OutputParams const &) const
+{
+       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 << "&#8203;";
-               break;
-       case LIGATURE_BREAK:
-               xs << XMLStream::ESCAPE_NONE << "&#8204;";
-               break;
-       case END_OF_SENTENCE:
-               xs << '.';
-               break;
-       case LDOTS:
-               xs << XMLStream::ESCAPE_NONE << "&hellip;";
-               break;
-       case MENU_SEPARATOR:
-               xs << XMLStream::ESCAPE_NONE << "&rArr;";
-               break;
-       case SLASH:
-               xs << XMLStream::ESCAPE_NONE << "&frasl;";
-               break;
-       case NOBREAKDASH:
-               xs << XMLStream::ESCAPE_NONE << "&#8209;";
-               break;
-       case PHRASE_LYX:
-               xs << "LyX";
-               break;
-       case PHRASE_TEX:
-               xs << "TeX";
-               break;
-       case PHRASE_LATEX2E:
-               xs << "LaTeX2" << XMLStream::ESCAPE_NONE << "&#x3b5;";
-               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();
 }
 
index 0ddb6c8fe85b54fd5ae933d22ff5761b6f941b43..4972911b7589cd915beed900fe798389db68f018 100644 (file)
@@ -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");
 }
 
index 57bd8162a5162f4f7bbf157e24ab887a578ef790..a5001fc2843ae7e9073b00a0a4ad2ce932bbdf0c 100644 (file)
@@ -234,10 +234,7 @@ void InsetMathChar::mathmlize(MathMLStream & ms) const
                case '>': entity = "&gt;"; break;
                case '&': entity = "&amp;"; break;
                case ' ': {
-                       if (ms.xmlMode())
-                               ms << from_ascii("&#0160;");
-                       else
-                               ms << from_ascii("&nbsp;");
+                       ms << from_ascii("&#0160;");
                        return;
                }
                default: break;
@@ -278,7 +275,7 @@ void InsetMathChar::htmlize(HtmlStream & ms) const
                case '<': entity = "&lt;"; break;
                case '>': entity = "&gt;"; break;
                case '&': entity = "&amp;"; break;
-               case ' ': entity = "&nbsp;"; break;
+               case ' ': entity = "&#160;"; break;
                default: break;
        }
 
index 2bd52f454ae17b49411cef8921cb64f48049c8c0..616d1f33d6d054f89439bb87368ecb0bb86d05cd 100644 (file)
@@ -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, "&acute;", "&#x00B4;");
-               t["bar"]   = Attributes(true, "&OverBar;", "&#x00AF;");
-               t["breve"] = Attributes(true, "&breve;", "&#x02D8;");
-               t["check"] = Attributes(true, "&caron;", "&#x02C7;");
-               t["ddddot"] = Attributes(true, "&DotDot;", "&#x20DC;");
-               t["dddot"] = Attributes(true, "&TripleDot;", "&#x20DB;");
-               t["ddot"] = Attributes(true, "&Dot;", "&#x00A8;");
-               t["dot"] = Attributes(true, "&dot;", "&#x02D9;");
-               t["grave"] = Attributes(true, "&grave;", "&#x0060;");
-               t["hat"] = Attributes(true, "&circ;", "&#x02C6;");
-               t["mathring"] = Attributes(true, "&ring;", "&#x02DA;");
-               t["overbrace"] = Attributes(true, "&OverBrace;", "&#x23DE;");
-               t["overleftarrow"] = Attributes(true, "&xlarr;", "&#x27F5;");
-               t["overleftrightarrow"] = Attributes(true, "&xharr;", "&#x27F7;");
-               t["overline"] = Attributes(true, "&macr;", "&#x00AF;");
-               t["overrightarrow"] = Attributes(true, "&xrarr;", "&#x27F6;");
-               t["tilde"] = Attributes(true, "&tilde;", "&#x02DC;");
-               t["underbar"] = Attributes(false, "&UnderBar;", "&#x0332;");
-               t["underbrace"] = Attributes(false, "&UnderBrace;", "&#x23DF;");
-               t["underleftarrow"] = Attributes(false, "&xlarr;", "&#x27F5;");
-               t["underleftrightarrow"] = Attributes(false, "&xharr;", "&#x27F7;");
+               t["acute"] = Attributes(true, "&#x00B4;");
+               t["bar"]   = Attributes(true, "&#x00AF;");
+               t["breve"] = Attributes(true, "&#x02D8;");
+               t["check"] = Attributes(true, "&#x02C7;");
+               t["ddddot"] = Attributes(true, "&#x20DC;");
+               t["dddot"] = Attributes(true, "&#x20DB;");
+               t["ddot"] = Attributes(true, "&#x00A8;");
+               t["dot"] = Attributes(true, "&#x02D9;");
+               t["grave"] = Attributes(true, "&#x0060;");
+               t["hat"] = Attributes(true, "&#x02C6;");
+               t["mathring"] = Attributes(true, "&#x02DA;");
+               t["overbrace"] = Attributes(true, "&#x23DE;");
+               t["overleftarrow"] = Attributes(true, "&#x27F5;");
+               t["overleftrightarrow"] = Attributes(true, "&#x27F7;");
+               t["overline"] = Attributes(true, "&#x00AF;");
+               t["overrightarrow"] = Attributes(true, "&#x27F6;");
+               t["tilde"] = Attributes(true, "&#x02DC;");
+               t["underbar"] = Attributes(false, "&#x0332;");
+               t["underbrace"] = Attributes(false, "&#x23DF;");
+               t["underleftarrow"] = Attributes(false, "&#x27F5;");
+               t["underleftrightarrow"] = Attributes(false, "&#x27F7;");
                // this is the macron, again, but it works
-               t["underline"] = Attributes(false, "&macr;", "&#x00AF;");
-               t["underrightarrow"] = Attributes(false, "&xrarr;", "&#x27F6;");
-               t["undertilde"] = Attributes(false, "&Tilde;", "&#x223C;");
-               t["utilde"] = Attributes(false, "&Tilde;", "&#x223C;");
-               t["vec"] = Attributes(true, "&rarr;", "&#x2192;");
-               t["widehat"] = Attributes(true, "&Hat;", "&#x005E;");
-               t["widetilde"] = Attributes(true, "&Tilde;", "&#x223C;");
+               t["underline"] = Attributes(false, "&#x00AF;");
+               t["underrightarrow"] = Attributes(false, "&#x27F6;");
+               t["undertilde"] = Attributes(false, "&#x223C;");
+               t["utilde"] = Attributes(false, "&#x223C;");
+               t["vec"] = Attributes(true, "&#x2192;");
+               t["widehat"] = Attributes(true, "&#x005E;");
+               t["widetilde"] = Attributes(true, "&#x223C;");
        }
 
        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';
 }
 
index cd4f8aade5f3d8c080df31f8791ce1e28448d7f6..486ed97580d94a9233e5b2ff5a0b1e99f85021f7 100644 (file)
@@ -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_);
 }
 
 
index 63c54c950e03d96603eac45bbe4f8caca1af9b77..ed0db97de6acc24402a51e0edfe4a6604ca77e06 100644 (file)
@@ -74,60 +74,34 @@ void InsetMathDots::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetMathDots::mathmlize(MathMLStream & ms) 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 (ms.xmlMode()) {
-               if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
-                       ent = "&#x2026;";
-               else if (n == "adots" || n == "iddots")
-                       ent = "&#x22F0;";
-               else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
-                       ent = "&#x22EF;";
-               else if (n == "ddots")
-                       ent = "&#x22F1;";
-               else if (n == "vdots")
-                       ent = "&#x22EE;";
-               else LASSERT(false, ent = "&#x2026;");
-       } else {
-               if (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
-                       ent = "&hellip;";
-               else if (n == "adots" || n == "iddots")
-                       ent = "&utdot;";
-               else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
-                       ent = "&ctdot;";
-               else if (n == "ddots")
-                       ent = "&dtdot;";
-               else if (n == "vdots")
-                       ent = "&vellip;";
-               else LASSERT(false, ent = "&hellip;");
-       }
-       ms << MTagInline("mi") << from_ascii(ent) << ETagInline("mi");
-}
-
-
-void InsetMathDots::htmlize(HtmlStream & os) 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 (n == "dots" || n == "dotsc" || n == "dotso" || n == "ldots")
-               ent = "&#x02026;";
+               return "&#x2026;";
        else if (n == "adots" || n == "iddots")
-               ent = "&#x022F0;";
+               return "&#x22F0;";
        else if (n == "cdots" || n == "dotsb" || n == "dotsi" || n == "dotsm")
-               ent = "&#x022EF;";
+               return "&#x22EF;";
        else if (n == "ddots")
-               ent = "&#x022F1;";
+               return "&#x22F1;";
        else if (n == "vdots")
-               ent = "&#x022EE;";
-       else
-               LASSERT(false, ent = "#x02026;");
-       os << from_ascii(ent);
+               return "&#x22EE;";
+       else LASSERT(false, return "&#x2026;");
+}
+}
+
+
+void InsetMathDots::mathmlize(MathMLStream & ms) const
+{
+       ms << MTagInline("mi") << from_ascii(symbolToXMLEntity(key_->name)) << ETagInline("mi");
+}
+
+
+void InsetMathDots::htmlize(HtmlStream & os) const
+{
+       os << from_ascii(symbolToXMLEntity(key_->name));
 }
 
 } // namespace lyx
index 0ab06d27be34854c2272b19bb2b2f8fb7778371b..746da1d39f3ca1d5ea016bde89ef4aeabf9abfc0 100644 (file)
@@ -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.
index 6a23abf4a1877581fe3674fbeecd449f9077c697..8204aaaef00b7facd2bb3409f03d5dd034051596 100644 (file)
@@ -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;
index 72d58d3d05c376726de046fb42f651b1c40aa654..b3cbcdc57c3615328150d8e1fc68f3fc12a49b00 100644 (file)
@@ -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")) << ">";
 }
 
index 6de085fc222c0aab283e2ffa7a01975c4b270eae..3ce50f730fb67668bd320c60feaaf3e79f21adbb 100644 (file)
@@ -231,7 +231,7 @@ void InsetMathRoot::htmlize(HtmlStream & os) const
 {
        os << MTag("span", "class='root'")
           << MTag("sup") << cell(1) << ETag("sup")
-          << from_ascii("&radic;")
+          << from_ascii("&#8730;")
           << MTag("span", "class='rootof'")    << cell(0) << ETag("span")
                 << ETag("span");
 }
index f4c4d25f1ce117ab5fdbe58df7b9e7b0ea3109a2..874012df12970eb6a1143ca34fc66ed1bcc61414 100644 (file)
@@ -225,7 +225,7 @@ void InsetMathSpace::htmlize(HtmlStream & ms) const
                ms << from_ascii("&thinsp;");
                break;
        case InsetSpaceParams::MEDIUM:
-               ms << from_ascii("&nbsp;");
+               ms << from_ascii("&#160;");
                break;
        case InsetSpaceParams::THICK:
                ms << from_ascii("&emsp;");
@@ -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("&nbsp;") << ETag("span");
+                  << from_ascii("&#160;") << ETag("span");
                break;
        }
        case InsetSpaceParams::NORMAL:
        case InsetSpaceParams::PROTECTED:
-               ms << from_ascii("&nbsp;");
+               ms << from_ascii("&#160;");
                break;
        default:
                break;
index 7cfe028c242cec0c09ba42083db3f9a1ecba29ff..7a9db4a99c2efdcb8b160d6df7fd8486889f2a3e 100644 (file)
@@ -107,7 +107,7 @@ void InsetMathSqrt::mathmlize(MathMLStream & ms) const
 void InsetMathSqrt::htmlize(HtmlStream & os) const
 {
        os << MTag("span", "class='sqrt'")
-          << from_ascii("&radic;")
+          << from_ascii("&#8730;")
           << MTag("span", "class='sqrtof'")    << cell(0) << ETag("span")
                 << ETag("span");
 }
index 291dabb3b9d037e85d1ce57b8ea69dfb7295abc6..10fb087cfeb2f2fb8417ea6828e2929b26db3467 100644 (file)
@@ -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;
 }
 
 
index cd36fe19814c0b9738344d12892b5faa90b94001..f9b215dc621f439b9e393b4f75b3dfec810686ca 100644 (file)
@@ -84,25 +84,6 @@ void InsetMathXArrow::normalize(NormalStream & os) const
 }
 
 
-static std::map<string, string> latex_to_html_entities = {
-               {"xleftarrow", "&larr;"},
-               {"xrightarrow", "&rarr;"},
-               {"xhookleftarrow", "&larrhk;"},
-               {"xhookrightarrow", "&rarrhk;"},
-               {"xLeftarrow", "&lArr;"},
-               {"xRightarrow", "&rArr;"},
-               {"xleftrightarrow", "&leftrightarrow;"},
-               {"xLeftrightarrow", "&Leftrightarrow;"},
-               {"xleftharpoondown", "&leftharpoondown;"},
-               {"xleftharpoonup", "&leftharpoonup;"},
-               {"xleftrightharpoons", "&leftrightharpoons;"},
-               {"xrightharpoondown", "&rightharpoondown;"},
-               {"xrightharpoonup", "&rightharpoonup;"},
-               {"xrightleftharpoons", "&rightleftharpoons;"},
-               {"xmapsto", "&mapsto;"},
-};
-
-
 static std::map<string, string> latex_to_xml_entities = {
                {"xleftarrow", "&#x2190;"},
                {"xrightarrow", "&#x2192;"},
@@ -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)
index 1cc5a1521fe2992169a2697bcddee5ea3e225643..2793728cf5ec1367a09363bb78f859d128738961 100644 (file)
@@ -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_)
index 77b306fccdd8bc41f8d28e2c39140e4e8ef655e0..6c17d634709bfe7079ee06c805156914f9103046 100644 (file)
@@ -63,8 +63,6 @@ public:
        ///
        bool hidden() const;
        ///
-       docstring const htmlname() const;
-       ///
        docstring const xmlname() const;
        ///
        char const * MathMLtype() const;
index 08f0b01e392157de8546663066a5f9366c4aaa60..f16b623c18a358227827f8253218a97891270473 100644 (file)
@@ -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 << '\'');
index 20403de5fb66fa11ed1683eef07889d7fd3d8f34..d69c78a11a5a2ba3370fd41e14ab855f15993de2 100644 (file)
@@ -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
index a05e54aacd80b2e8fc0bb6250128d1491e259bba..4a006e4809672e88e5f3f0f3252a22ec4a07d9e2 100644 (file)
@@ -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.");
index 6d0399e4c8e2bca0b902caf2c16de4f4505a613d..ca7543101ff09ea65121fd81ff265645eb2aff82 100644 (file)
@@ -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