]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.cpp
Fix bug #7895: Do not output lines with only a single space.
[lyx.git] / src / tex2lyx / text.cpp
index 1fb0e18aa4c2573071b3d532bd1d4be13da28b76..bf3ea8c2bd4c0e032473cca8ff84d4a42ba62833 100644 (file)
@@ -674,10 +674,14 @@ void parse_arguments(string const & command,
        for (size_t i = 0; i < no_arguments; ++i) {
                switch (template_arguments[i]) {
                case required:
+               case req_group:
                        // This argument contains regular LaTeX
                        handle_ert(os, ert + '{', context);
                        eat_whitespace(p, os, context, false);
-                       parse_text(p, os, FLAG_ITEM, outer, context);
+                       if (template_arguments[i] == required)
+                               parse_text(p, os, FLAG_ITEM, outer, context);
+                       else
+                               parse_text_snippet(p, os, FLAG_ITEM, outer, context);
                        ert = "}";
                        break;
                case item:
@@ -695,6 +699,7 @@ void parse_arguments(string const & command,
                        ert += '{' + p.verbatim_item() + '}';
                        break;
                case optional:
+               case opt_group:
                        // true because we must not eat whitespace
                        // if an optional arg follows we must not strip the
                        // brackets from this one
@@ -1181,6 +1186,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
        }
 
        else if (parent_context.textclass.floats().typeExist(unstarred_name)) {
+               eat_whitespace(p, os, parent_context, false);
+               string const opt = p.hasOpt() ? p.getArg('[', ']') : string();
                eat_whitespace(p, os, parent_context, false);
                parent_context.check_layout(os);
                begin_inset(os, "Float " + unstarred_name + "\n");
@@ -1192,8 +1199,8 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                        float_type = unstarred_name;
                else
                        float_type = "";
-               if (p.hasOpt())
-                       os << "placement " << p.getArg('[', ']') << '\n';
+               if (!opt.empty())
+                       os << "placement " << opt << '\n';
                os << "wide " << convert<string>(is_starred)
                   << "\nsideways false"
                   << "\nstatus open\n\n";