From 1f48af5f558358cfb156e7e68fd1ff75a20fcb06 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 24 Feb 2024 10:48:34 +0100 Subject: [PATCH] tex2lyx: simplify babel shorthands detection --- src/tex2lyx/text.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index d50222a68b..7c63b7679f 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -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(); }