tex2lyx: simplify babel shorthands detection

This commit is contained in:
Juergen Spitzmueller 2024-02-24 10:48:34 +01:00
parent f72d68cd9f
commit 1f48af5f55

View File

@ -145,6 +145,9 @@ string fboxrule = "";
string fboxsep = "";
string shadow_size = "";
char const * const known_babel_shorthands[] = { "\"", "|", "-", "~", "=", "/",
"~", "*", ":", "_", "x", "'", "`", "<", ">", 0 };
char const * const known_ref_commands[] = { "ref", "pageref", "vref",
"vpageref", "prettyref", "nameref", "eqref", 0 };
@ -3345,24 +3348,10 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
// verbatim).
if (t.asInput() == "\"") {
string s = "\"";
// These are known pairs. We put them together in
// We put the known shorthand pairs together in
// one ERT inset. In other cases (such as "a), only
// the quotation mark is ERTed.
if (p.next_token().asInput() == "\""
|| p.next_token().asInput() == "|"
|| p.next_token().asInput() == "-"
|| p.next_token().asInput() == "~"
|| p.next_token().asInput() == "="
|| p.next_token().asInput() == "/"
|| p.next_token().asInput() == "~"
|| p.next_token().asInput() == "*"
|| p.next_token().asInput() == ":"
|| p.next_token().asInput() == "_"
|| p.next_token().asInput() == "x"
|| p.next_token().asInput() == "'"
|| p.next_token().asInput() == "`"
|| p.next_token().asInput() == "<"
|| p.next_token().asInput() == ">") {
if (is_known(p.next_token().asInput(), known_babel_shorthands)) {
s += p.next_token().asInput();
p.get_token();
}