Hi, now that we have \end_layout the next step to maintain the coherency I would like to replace \layout with \begin_layout.
The patch follows attached. Is it ok? -- José
? 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.2 diff -u -r1.2 lyxconvert_224.py --- lib/lyx2lyx/lyxconvert_224.py 28 Jul 2003 13:09:39 -0000 1.2 +++ lib/lyx2lyx/lyxconvert_224.py 28 Jul 2003 13:58:10 -0000 @@ -68,19 +68,19 @@ lines.insert(i, "\\end_layout") return -## def layout2begin_layout(lines): -## i = 0 -## while 1: -## i = find_token(lines, '\\layout', i) -## if i == -1: -## return +def layout2begin_layout(lines): + i = 0 + while 1: + i = find_token(lines, '\\layout', i) + if i == -1: + return -## lines[i]= replace(lines[i], '\\layout', '\\begin_layout') -## i = i + 1 + lines[i]= replace(lines[i], '\\layout', '\\begin_layout') + i = i + 1 def convert(header, body): add_end_layout(body) -## layout2begin_layout(body) + layout2begin_layout(body) if __name__ == "__main__": pass Index: src/buffer.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v retrieving revision 1.501 diff -u -r1.501 buffer.C --- src/buffer.C 27 Jul 2003 23:40:06 -0000 1.501 +++ src/buffer.C 28 Jul 2003 13:58:11 -0000 @@ -348,7 +348,7 @@ static Change current_change; int unknown = 0; - if (token == "\\layout") { + if (token == "\\begin_layout") { lex.pushToken(token); Paragraph par; Index: src/paragraph.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v retrieving revision 1.293 diff -u -r1.293 paragraph.C --- src/paragraph.C 28 Jul 2003 12:51:24 -0000 1.293 +++ src/paragraph.C 28 Jul 2003 13:58:11 -0000 @@ -156,7 +156,7 @@ } // First write the layout - os << "\n\\layout " << layout()->name() << '\n'; + os << "\n\\begin_layout " << layout()->name() << '\n'; params().write(os); Index: src/paragraph_funcs.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v retrieving revision 1.53 diff -u -r1.53 paragraph_funcs.C --- src/paragraph_funcs.C 27 Jul 2003 21:59:03 -0000 1.53 +++ src/paragraph_funcs.C 28 Jul 2003 13:58:13 -0000 @@ -793,7 +793,7 @@ for (; cit != token.end(); ++cit) { par.insertChar(par.size(), (*cit), font, change); } - } else if (token == "\\layout") { + } else if (token == "\\begin_layout") { lex.eatLine(); string layoutname = lex.getString(); @@ -828,7 +828,7 @@ } else if (token == "\\end_layout") { lyxerr << "Solitary \\end_layout in line " << lex.getLineNo() << "\n" - << "Missing \\layout?.\n"; + << "Missing \\begin_layout?.\n"; } else if (token == "\\end_inset") { lyxerr << "Solitary \\end_inset in line " << lex.getLineNo() << "\n" << "Missing \\begin_inset?.\n"; @@ -988,7 +988,7 @@ lyxerr[Debug::PARSER] << "Handling paragraph token: `" << token << '\'' << endl; - if (token == "\\layout" || token == "\\the_end" + if (token == "\\begin_layout" || token == "\\the_end" || token == "\\end_inset" || token == "\\begin_deeper" || token == "\\end_deeper") { lex.pushToken(token); Index: src/insets/insetert.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v retrieving revision 1.142 diff -u -r1.142 insetert.C --- src/insets/insetert.C 25 Jul 2003 21:20:19 -0000 1.142 +++ src/insets/insetert.C 28 Jul 2003 13:58:14 -0000 @@ -205,7 +205,7 @@ ParagraphList::iterator par = inset.paragraphs.begin(); ParagraphList::iterator end = inset.paragraphs.end(); for (; par != end; ++par) { - os << "\n\\layout " << layout << "\n"; + os << "\n\\begin_layout " << layout << "\n"; pos_type siz = par->size(); for (pos_type i = 0; i < siz; ++i) { Paragraph::value_type c = par->getChar(i); Index: src/tex2lyx/preamble.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/preamble.C,v retrieving revision 1.7 diff -u -r1.7 preamble.C --- src/tex2lyx/preamble.C 26 Jul 2003 00:15:38 -0000 1.7 +++ src/tex2lyx/preamble.C 28 Jul 2003 13:58:14 -0000 @@ -166,7 +166,7 @@ << "\\papersides " << h_papersides << "\n" << "\\paperpagestyle " << h_paperpagestyle << "\n" << "\\tracking_changes " << h_tracking_changes << "\n" - << "\\end_header\n\n\\layout Standard\n"; + << "\\end_header\n\n\\begin_layout Standard\n"; } Index: src/tex2lyx/table.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/table.C,v retrieving revision 1.10 diff -u -r1.10 table.C --- src/tex2lyx/table.C 26 Jul 2003 00:15:38 -0000 1.10 +++ src/tex2lyx/table.C 28 Jul 2003 13:58:14 -0000 @@ -484,7 +484,7 @@ << " usebox=\"none\"" << ">" << "\n\\begin_inset Text" - << "\n\n\\layout Standard\n\n" + << "\n\n\\begin_layout Standard\n\n" << cell.content << "\n\\end_inset\n\n" << "</cell>\n"; Index: src/tex2lyx/tex2lyx.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/tex2lyx.C,v retrieving revision 1.40 diff -u -r1.40 tex2lyx.C --- src/tex2lyx/tex2lyx.C 27 Jul 2003 19:26:36 -0000 1.40 +++ src/tex2lyx/tex2lyx.C 28 Jul 2003 13:58:15 -0000 @@ -121,7 +121,7 @@ bool eating = false; while (getline(is, line)) { string tline = trim(line, " "); - if (line.substr(0, 8) == "\\layout ") { + if (line.substr(0, 8) == "\\begin_layout ") { //cerr << "layout: " << line << "\n"; last = line; eating = true; Index: src/tex2lyx/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/text.C,v retrieving revision 1.10 diff -u -r1.10 text.C --- src/tex2lyx/text.C 27 Jul 2003 18:25:58 -0000 1.10 +++ src/tex2lyx/text.C 28 Jul 2003 13:58:15 -0000 @@ -100,7 +100,7 @@ void handle_ert(ostream & os, string const & s) { begin_inset(os, "ERT"); - os << "\nstatus Collapsed\n\n\\layout Standard\n\n"; + os << "\nstatus Collapsed\n\n\\begin_layout Standard\n\n"; for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) { if (*it == '\\') os << "\n\\backslash\n"; @@ -115,7 +115,7 @@ { if (active_environments.empty()) return; - os << "\n\\layout "; + os << "\n\\begin_layout "; string s = active_environment(); if (s == "document" || s == "table") os << "Standard\n\n"; @@ -156,19 +156,19 @@ Parser & p, bool outer, LyXTextClass const & textclass) { string name = layout_ptr->name(); - os << "\n\n\\layout " << name << "\n\n"; + os << "\n\n\\begin_layout " << name << "\n\n"; if (layout_ptr->optionalargs > 0) { string s; if (p.next_token().character() == '[') { p.get_token(); // eat '[' begin_inset(os, "OptArg\n"); - os << "collapsed true\n\n\\layout Standard\n\n"; + os << "collapsed true\n\n\\begin_layout Standard\n\n"; parse_text(p, os, FLAG_BRACK_LAST, outer, textclass); end_inset(os); } } parse_text(p, os, FLAG_ITEM, outer, textclass); - os << "\n\n\\layout Standard\n\n"; + os << "\n\n\\begin_layout Standard\n\n"; } } // anonymous namespace @@ -332,7 +332,7 @@ } os << "wide " << tostr(is_starred) << "\ncollapsed false\n\n" - << "\\layout Standard\n"; + << "\\begin_layout Standard\n"; parse_text(p, os, FLAG_END, outer, textclass); end_inset(os); @@ -348,7 +348,7 @@ || s == "lyxlist"; if (deeper) os << "\n\\begin_deeper"; - os << "\n\\layout " << cap(name) << "\n\n"; + os << "\n\\begin_layout " << cap(name) << "\n\n"; if (name == "lyxlist") p.verbatim_item(); // swallow next arg parse_text(p, os, FLAG_END, outer, textclass); @@ -358,7 +358,7 @@ } else if (name == "thebibliography") { p.verbatim_item(); // swallow next arg parse_text(p, os, FLAG_END, outer, textclass); - os << "\n\\layout Bibliography\n\n"; + os << "\n\\begin_layout Bibliography\n\n"; } else { handle_par(os); parse_text(p, os, FLAG_END, outer, textclass); @@ -435,7 +435,7 @@ else if (t.cs() == "footnote") { begin_inset(os, "Foot\n"); - os << "collapsed true\n\n\\layout Standard\n\n"; + os << "collapsed true\n\n\\begin_layout Standard\n\n"; parse_text(p, os, FLAG_ITEM, false, textclass); end_inset(os); } @@ -450,7 +450,7 @@ else if (t.cs() == "marginpar") { begin_inset(os, "Marginal\n"); - os << "collapsed true\n\n\\layout Standard\n\n"; + os << "collapsed true\n\n\\begin_layout Standard\n\n"; parse_text(p, os, FLAG_ITEM, false, textclass); end_inset(os); } @@ -515,7 +515,7 @@ } else if (t.cs() == "bibitem") { - os << "\n\\layout Bibliography\n\\bibitem "; + os << "\n\\begin_layout Bibliography\n\\bibitem "; os << p.getOpt(); os << '{' << p.verbatim_item() << '}' << "\n\n"; }