Fix in symbols handling: parse the XML entity with \def.

This commit is contained in:
Thibaut Cuvelier 2020-06-19 02:27:31 +02:00 committed by Pavel Sanda
parent 718eede94b
commit 8f89768211
2 changed files with 17 additions and 14 deletions

View File

@ -16,9 +16,9 @@
# or # or
# \def\macroname{definition} requires # \def\macroname{definition} requires
# or # or
# \def\macroname{definition} extra xmlname # \def\macroname{definition} extra htmlname xmlname
# or # or
# \def\macroname{definition} extra xmlname requires # \def\macroname{definition} extra htmlname xmlname requires
# #
# ("" for empty strings is not supported. One would have to use x for fields # ("" for empty strings is not supported. One would have to use x for fields
# that are not set.) # that are not set.)
@ -999,12 +999,12 @@ bignplus stmry 112 0 mathop x x stmaryrd # caution: named huge
\def\Arrownot{\lyxArrownot\mathrel{\kern0.5mu}} stmaryrd \def\Arrownot{\lyxArrownot\mathrel{\kern0.5mu}} stmaryrd
\def\longarrownot{\mathrel{\kern5.5mu}\arrownot\mathrel{\kern-5.5mu}} stmaryrd \def\longarrownot{\mathrel{\kern5.5mu}\arrownot\mathrel{\kern-5.5mu}} stmaryrd
\def\Longarrownot{\mathrel{\kern5.5mu}\Arrownot\mathrel{\kern-5.5mu}} stmaryrd \def\Longarrownot{\mathrel{\kern5.5mu}\Arrownot\mathrel{\kern-5.5mu}} stmaryrd
\def\Mapsto{\Mapstochar\mathrel\Rightarrow} mathrel ⤇ stmaryrd \def\Mapsto{\Mapstochar\mathrel\Rightarrow} mathrel ⤇ ⤇ stmaryrd
\def\mapsfrom{\leftarrow\kern-9mu\mapsfromchar} mathrel ↤ stmaryrd \def\mapsfrom{\leftarrow\kern-9mu\mapsfromchar} mathrel ↤ ↤ stmaryrd
\def\Mapsfrom{\Leftarrow\kern-9mu\Mapsfromchar} mathrel ⤆ stmaryrd \def\Mapsfrom{\Leftarrow\kern-9mu\Mapsfromchar} mathrel ⤆ ⤆ stmaryrd
\def\Longmapsto{\Mapstochar\Longrightarrow} mathrel ⟾ stmaryrd \def\Longmapsto{\Mapstochar\Longrightarrow} mathrel ⟾ ⟾ stmaryrd
\def\longmapsfrom{\longleftarrow\mapsfromchar} mathrel ⟻ stmaryrd \def\longmapsfrom{\longleftarrow\mapsfromchar} mathrel ⟻ ⟻ stmaryrd
\def\Longmapsfrom{\Longleftarrow\mathrel{\kern1mu}\Mapsfromchar} mathrel ⟽ stmaryrd \def\Longmapsfrom{\Longleftarrow\mathrel{\kern1mu}\Mapsfromchar} mathrel ⟽ ⟽ stmaryrd
# symbols from the mhchem package, all of them are equivalent to a math symbol # symbols from the mhchem package, all of them are equivalent to a math symbol
# mhchem is not loaded because these commands can only be used inside # mhchem is not loaded because these commands can only be used inside
@ -1159,8 +1159,8 @@ ordinarycolon cmr 58 58 mathrel : : mathtools
\def\lnot{\neg} mathord ¬ ¬ \def\lnot{\neg} mathord ¬ ¬
\def\notin{\not\in} mathrel ∉ ∉ \def\notin{\not\in} mathrel ∉ ∉
\def\ddag{\ddagger} mathbin ‡ \def\ddag{\ddagger} mathbin ‡ ‡
\def\dag{\dagger} mathbin † \def\dag{\dagger} mathbin † †
\def\joinrel{\mathrel{\kern-3mu}} \def\joinrel{\mathrel{\kern-3mu}}
\def\relbar{\lyxbar} \def\relbar{\lyxbar}

View File

@ -186,23 +186,24 @@ void initSymbols()
// or // or
// \def\macroname{definition} requires // \def\macroname{definition} requires
// or // or
// \def\macroname{definition} extra htmlname requires // \def\macroname{definition} extra htmlname xmlname requires
istringstream is(line); istringstream is(line);
string macro; string macro;
string required; string required;
string extra; string extra;
string htmlname; string htmlname;
string xmlname;
bool hidden = false; bool hidden = false;
is >> setw(65536) >> macro >> required; is >> setw(65536) >> macro >> required;
if ((is >> htmlname)) { if ((is >> htmlname >> xmlname)) {
extra = required; extra = required;
if (!(is >> required)) if (!(is >> required))
required = ""; required = "";
} else } else
htmlname = ""; htmlname = xmlname = "";
MacroTable::iterator it = MacroTable::globalMacros().insert( MacroTable::iterator it = MacroTable::globalMacros().insert(
0, from_utf8(macro)); 0, from_utf8(macro));
if (!extra.empty() || !htmlname.empty() || !required.empty()) { if (!extra.empty() || !htmlname.empty() || !xmlname.empty() || !required.empty()) {
MathWordList::iterator wit = theMathWordList.find(it->first); MathWordList::iterator wit = theMathWordList.find(it->first);
if (wit != theMathWordList.end()) if (wit != theMathWordList.end())
LYXERR(Debug::MATHED, "readSymbols: inset " LYXERR(Debug::MATHED, "readSymbols: inset "
@ -213,6 +214,7 @@ void initSymbols()
tmp.name = it->first; tmp.name = it->first;
tmp.extra = from_utf8(extra); tmp.extra = from_utf8(extra);
tmp.htmlname = from_utf8(htmlname); tmp.htmlname = from_utf8(htmlname);
tmp.xmlname = from_utf8(xmlname);
if (required == "hiddensymbol") { if (required == "hiddensymbol") {
required = ""; required = "";
tmp.hidden = hidden = true; tmp.hidden = hidden = true;
@ -230,6 +232,7 @@ void initSymbols()
<< " draw: 0" << " draw: 0"
<< " extra: " << extra << " extra: " << extra
<< " html: " << htmlname << " html: " << htmlname
<< " xml: " << xmlname
<< " requires: " << required << " requires: " << required
<< " hidden: " << hidden << '\''); << " hidden: " << hidden << '\'');
continue; continue;