]> git.lyx.org Git - features.git/commitdiff
Fix "stray '}' in text" warnings: When parsing with FLAG_ITEM the braces need
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Sat, 12 Nov 2011 18:43:13 +0000 (18:43 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Sat, 12 Nov 2011 18:43:13 +0000 (18:43 +0000)
to occur in pairs.
If you change something in tex2lyx please don't commit without running the
tests and ensuring that no warnings or errors are written on stderr.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40178 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/text.cpp

index c1572f0bc03695cc6e1730636bf5a157ce8e3bea..6247fce81dbb6e06d308302222b17afa182be846 100644 (file)
@@ -891,6 +891,13 @@ void parse_box(Parser & p, ostream & os, unsigned outer_flags,
                        // the inner env
                        if (!inner_type.empty() && (inner_flags & FLAG_END))
                                active_environments.pop_back();
+       
+                       // Ensure that the end of the outer box is parsed correctly:
+                       // The opening brace has been eaten by parse_outer_box()
+                       if (!outer_type.empty() && (outer_flags & FLAG_ITEM)) {
+                               outer_flags &= ~FLAG_ITEM;
+                               outer_flags |= FLAG_BRACE_LAST;
+                       }
                        parse_text(p, os, outer_flags, outer, parent_context);
                        if (outer_flags & FLAG_END)
                                handle_ert(os, "\\end{" + outer_type + '}',
@@ -3458,14 +3465,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                }
 
                //\makebox() is part of the picture environment and different from \makebox{}
-               //\makebox{} will be parsed by parse_box when bug 2956 is fixed
+               //\makebox{} will be parsed by parse_box
                else if (t.cs() == "makebox") {
                        string arg = t.asInput();
                        if (p.next_token().character() == '(') {
                                //the syntax is: \makebox(x,y)[position]{content}
                                arg += p.getFullParentheseArg();
                                arg += p.getFullOpt();
-                               handle_ert(os, arg + p.get_token().asInput(), context);
+                               eat_whitespace(p, os, context, false);
+                               handle_ert(os, arg + '{', context);
+                               eat_whitespace(p, os, context, false);
+                               parse_text(p, os, FLAG_ITEM, outer, context);
+                               handle_ert(os, "}", context);
                        } else
                                //the syntax is: \makebox[width][position]{content}
                                parse_box(p, os, 0, FLAG_ITEM, outer, context,