Hi, this patch renames \the_end to \end_document. The objective later is to add: \begin_document \begin_header \begin_body \end_body
The objective then is to eliminate \begin_deeper and \end_deeper, but this requires a little more work. -- José
? ex1.lyx ? ex1.lyx.gz ? lib/doc/UserGuide-1.lyx ? lib/doc/UserGuide.lyx Index: lib/lyx2lyx/lyxconvert_224.py =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyxconvert_224.py,v retrieving revision 1.3 diff -u -r1.3 lyxconvert_224.py --- lib/lyx2lyx/lyxconvert_224.py 28 Jul 2003 15:17:08 -0000 1.3 +++ lib/lyx2lyx/lyxconvert_224.py 28 Jul 2003 21:48:34 -0000 @@ -78,6 +78,13 @@ lines[i]= replace(lines[i], '\\layout', '\\begin_layout') i = i + 1 +def end_document(lines): + i = find_token(lines, "\\the_end", "\\end_document") + if i == -1: + lines.append("\\end_document") + return + lines[i] = "\\end_document" + def convert(header, body): add_end_layout(body) layout2begin_layout(body) Index: src/buffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v retrieving revision 1.504 diff -u -r1.504 buffer.C --- src/buffer.C 28 Jul 2003 15:17:09 -0000 1.504 +++ src/buffer.C 28 Jul 2003 21:48:35 -0000 @@ -295,7 +295,7 @@ // changed to be public and have one parameter // if par = 0 normal behavior // else insert behavior -// Returns false if "\the_end" is not read (Asger) +// Returns false if "\end_document" is not read (Asger) bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit) { Paragraph::depth_type depth = 0; @@ -329,7 +329,7 @@ lyxerr[Debug::PARSER] << "Handling token: `" << token << '\'' << endl; - if (token == "\\the_end") { + if (token == "\\end_document") { the_end_read = true; continue; } @@ -698,7 +698,7 @@ pit->write(this, ofs, params, depth); // Write marker that shows file is complete - ofs << "\n\\the_end" << endl; + ofs << "\n\\end_document" << endl; // Shouldn't really be needed.... //ofs.close(); Index: src/paragraph_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v retrieving revision 1.54 diff -u -r1.54 paragraph_funcs.C --- src/paragraph_funcs.C 28 Jul 2003 15:17:10 -0000 1.54 +++ src/paragraph_funcs.C 28 Jul 2003 21:48:36 -0000 @@ -988,7 +988,7 @@ lyxerr[Debug::PARSER] << "Handling paragraph token: `" << token << '\'' << endl; - if (token == "\\begin_layout" || token == "\\the_end" + if (token == "\\begin_layout" || token == "\\end_document" || token == "\\end_inset" || token == "\\begin_deeper" || token == "\\end_deeper") { lex.pushToken(token); Index: src/insets/insettext.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v retrieving revision 1.457 diff -u -r1.457 insettext.C --- src/insets/insettext.C 28 Jul 2003 20:04:43 -0000 1.457 +++ src/insets/insettext.C 28 Jul 2003 21:48:37 -0000 @@ -252,8 +252,8 @@ break; } - if (token == "\\the_end") { - lex.printError("\\the_end read in inset! Error in document!"); + if (token == "\\end_document") { + lex.printError("\\end_document read in inset! Error in document!"); return; }