]> git.lyx.org Git - features.git/commitdiff
tex2lyx: simplify babel shorthands detection
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 24 Feb 2024 09:48:34 +0000 (10:48 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 24 Feb 2024 09:48:34 +0000 (10:48 +0100)
src/tex2lyx/text.cpp

index d50222a68b3a4a5244199608b644b91e72f9f574..7c63b7679f0b62eec1c1bfe7aac32435b8ee0afc 100644 (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();
                        }