On Sun, Jul 27, 2003 at 10:39:54PM +0200, Lars Gullik Bjønnes wrote:
> José Abílio Oliveira Matos <[EMAIL PROTECTED]> writes:
> 
> \\end_layout should have an explicit test, not an inveted one. and it
> should imho also give an error message for the wrongly placed/not
> handled \\end_layout.

  Is the following ok?
  
> -- 
>       Lgb

-- 
José Abílio Matos
LyX and docbook a perfect match. :-)
? lib/doc/UserGuide-1.lyx
? lib/doc/UserGuide.lyx
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.290
diff -u -r1.290 paragraph.C
--- src/paragraph.C     27 Jul 2003 10:42:11 -0000      1.290
+++ src/paragraph.C     27 Jul 2003 20:54:07 -0000
@@ -240,6 +240,8 @@
        }
        Changes::lyxMarkChange(os, column, curtime,
                running_change, Change(Change::UNCHANGED));
+
+       os << "\n\\end_layout\n";
 }
 
 
Index: src/paragraph_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v
retrieving revision 1.51
diff -u -r1.51 paragraph_funcs.C
--- src/paragraph_funcs.C       27 Jul 2003 15:09:13 -0000      1.51
+++ src/paragraph_funcs.C       27 Jul 2003 20:54:07 -0000
@@ -826,13 +826,12 @@
 
                par.params().read(lex);
 
+       } else if (token == "\\end_layout") {
+               lyxerr << "Solitary \\end_layout in line " << lex.getLineNo() << "\n"
+                      << "Missing \\layout?.\n";
        } else if (token == "\\end_inset") {
                lyxerr << "Solitary \\end_inset in line " << lex.getLineNo() << "\n"
                       << "Missing \\begin_inset?.\n";
-               // Simply ignore this. The insets do not have
-               // to read this.
-               // But insets should read it, it is a part of
-               // the inset isn't it? Lgb.
        } else if (token == "\\begin_inset") {
                InsetOld * inset = readInset(lex, buf);
                par.insertInset(par.size(), inset, font, change);
@@ -982,16 +981,20 @@
                if (token.empty())
                        continue;
 
+               if (token == "\\end_layout") {
+                       //Ok, paragraph finished
+                       break;
+               }
+
                lyxerr[Debug::PARSER] << "Handling paragraph token: `"
                                      << token << '\'' << endl;
-
-               // reached the next paragraph. FIXME: really we should
-               // change the file format to indicate the end of a par
-               // clearly, but for now, this hack will do
                if (token == "\\layout" || token == "\\the_end"
                    || token == "\\end_inset" || token == "\\begin_deeper"
                    || token == "\\end_deeper") {
                        lex.pushToken(token);
+                       lyxerr << "Paragraph ended in line "
+                              << lex.getLineNo() << "\n"
+                              << "Missing \\end_layout.\n";
                        break;
                }
        }

Reply via email to