]> git.lyx.org Git - features.git/commitdiff
fix parsing of \def macros (was broken with the spreadsheet template support)
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Sun, 4 Dec 2011 16:00:00 +0000 (16:00 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Sun, 4 Dec 2011 16:00:00 +0000 (16:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40363 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/text.cpp

index 4c84a854ece4e441a5773e9ed3a1041cb59fe2ea..a5ffc4798a2568fc0de5bd6c27cae07ba37c0fd7 100644 (file)
@@ -2326,12 +2326,19 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
 
                else if (is_macro(p)) {
                        // catch the case of \def\inputGnumericTable
+                       bool macro = true;
                        if (t.cs() == "def") {
-                               Token second = p.get_token();
+                               Token second = p.next_token();
                                if (second.cs() == "inputGnumericTable") {
+                                       p.pushPosition();
+                                       p.get_token();
                                        skip_braces(p);
                                        Token third = p.get_token();
+                                       p.popPosition();
                                        if (third.cs() == "input") {
+                                               p.get_token();
+                                               skip_braces(p);
+                                               p.get_token();
                                                string name = normalize_filename(p.verbatim_item());
                                                string const path = getMasterFilePath();
                                                // We want to preserve relative / absolute filenames,
@@ -2357,10 +2364,11 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                                   << name << "\n";
                                                end_inset(os);
                                                context.check_layout(os);
+                                               macro = false;
                                        }
                                }
                        }
-                       if (is_macro(p))
+                       if (macro)
                                parse_macro(p, os, context);
                }