]> git.lyx.org Git - features.git/commitdiff
Fix bug #6762. Silly mistake.
authorRichard Heck <rgheck@comcast.net>
Wed, 9 Jun 2010 15:08:04 +0000 (15:08 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 9 Jun 2010 15:08:04 +0000 (15:08 +0000)
Also, disable corresponding code for required arguments. tex2lyx does
not produce a high enough file format yet for this to make sense, I
don't think.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34635 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/text.cpp

index ab6a101706cfea57ac55488cfede2c58c0dafdff..4f5b60e6092292b0f6053ca9d451cc961591f5e9 100644 (file)
@@ -457,29 +457,34 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
        unsigned int optargs = 0;
        while (optargs < context.layout->optargs) {
                eat_whitespace(p, os, context, false);
-               if (p.next_token().character() == '[') {
-                       p.get_token(); // eat '['
-                       begin_inset(os, "OptArg\n");
-                       os << "status collapsed\n\n";
-                       parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
-                       end_inset(os);
-                       eat_whitespace(p, os, context, false);
-                       optargs++;
-               }
+               if (p.next_token().character() != '[') 
+                       break;
+               p.get_token(); // eat '['
+               begin_inset(os, "OptArg\n");
+               os << "status collapsed\n\n";
+               parse_text_in_inset(p, os, FLAG_BRACK_LAST, outer, context);
+               end_inset(os);
+               eat_whitespace(p, os, context, false);
+               optargs++;
        }
+#if 0
+       // This is the code needed to parse required arguments, but 
+       // required arguments come into being only much later than the
+       // file format tex2lyx is presently outputting.
        unsigned int reqargs = 0;
        while (reqargs < context.layout->reqargs) {
                eat_whitespace(p, os, context, false);
-               if (p.next_token().character() == '{') {
-                       p.get_token(); // eat '['
-                       begin_inset(os, "OptArg\n");
-                       os << "status collapsed\n\n";
-                       parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
-                       end_inset(os);
-                       eat_whitespace(p, os, context, false);
-                       reqargs++;
-               }
+               if (p.next_token().character() != '{') 
+                       break;
+               p.get_token(); // eat '{'
+               begin_inset(os, "OptArg\n");
+               os << "status collapsed\n\n";
+               parse_text_in_inset(p, os, FLAG_BRACE_LAST, outer, context);
+               end_inset(os);
+               eat_whitespace(p, os, context, false);
+               reqargs++;
        }
+#endif
        parse_text(p, os, FLAG_ITEM, outer, context);
        context.check_end_layout(os);
        if (parent_context.deeper_paragraph) {