]> git.lyx.org Git - lyx.git/commitdiff
Simplify logic
authorGeorg Baum <baum@lyx.org>
Fri, 27 Nov 2015 19:35:13 +0000 (20:35 +0100)
committerGeorg Baum <baum@lyx.org>
Fri, 27 Nov 2015 19:35:13 +0000 (20:35 +0100)
The old code was more complicated than needed, we have unstarred_name to make
our live easier. The test proves that the new code works as before.

src/tex2lyx/text.cpp

index ecf6bf211055a19e8456a8cbe4fd3ccb015896d9..73a8d6976596bc0989a5b46829f1c6a701231d1a 100644 (file)
@@ -1555,25 +1555,17 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                preamble.registerAutomaticallyLoadedPackage("verbatim");
        }
 
-       else if (unstarred_name == "verbatim" || name == "verbatim*") {
+       else if (unstarred_name == "verbatim") {
                // FIXME: this should go in the generic code that
                // handles environments defined in layout file that
                // have "PassThru 1". However, the code over there is
                // already too complicated for my taste.
-               string ascii_name;
-               string env_name;
-               if (unstarred_name == "verbatim") {
-                       ascii_name = "Verbatim";
-                       env_name = "verbatim";
-               }
-               if (name == "verbatim*") {
-                       ascii_name = "Verbatim*";
-                       env_name = name;
-               }
+               string const ascii_name =
+                       (name == "verbatim*") ? "Verbatim*" : "Verbatim";
                parent_context.new_paragraph(os);
                Context context(true, parent_context.textclass,
                                &parent_context.textclass[from_ascii(ascii_name)]);
-               string s = p.verbatimEnvironment(env_name);
+               string s = p.verbatimEnvironment(name);
                output_ert(os, s, context);
                p.skip_spaces();
        }