mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Encodings::fromLaTeXCommand: if the command directly maps an entry of unicodesymbols, use it and bypass most of the logic.
This is important for commands like !`, that are equivalent to \textexclamdown. However, ! is matched earlier, because the logic works with prefixes, hence the output doesn't make sense.
This commit is contained in:
parent
0cde3dce12
commit
4cab1a77d2
@ -4,4 +4,5 @@
|
||||
<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
|
||||
<title>ERT Conversions</title>
|
||||
<para>These should be <code>&#192;</code>: À À À</para>
|
||||
<para>This one should be <code>&#161;</code>: ¡ ¡</para>
|
||||
</article>
|
@ -381,6 +381,30 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, int cmdtype,
|
||||
rem = empty_docstring();
|
||||
bool const mathmode = cmdtype & MATH_CMD;
|
||||
bool const textmode = cmdtype & TEXT_CMD;
|
||||
|
||||
// Easy case: the command is a complete entry of unicodesymbols.
|
||||
for (const auto & unicodeSymbol : unicodesymbols) {
|
||||
if (mathmode) {
|
||||
for (const auto & command : unicodeSymbol.second.mathCommands()) {
|
||||
if (command == cmd) {
|
||||
docstring value;
|
||||
value += unicodeSymbol.first;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (textmode) {
|
||||
for (const auto & command : unicodeSymbol.second.textCommands()) {
|
||||
if (command == cmd) {
|
||||
docstring value;
|
||||
value += unicodeSymbol.first;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, try to map as many commands as possible, matching prefixes of the command.
|
||||
docstring symbols;
|
||||
size_t const cmdend = cmd.size();
|
||||
size_t prefix = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user