\layout -> \begin_layout and missing \end_layout

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7420 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2003-07-28 15:17:11 +00:00
parent 8721e76079
commit 131eabe56c
14 changed files with 53 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2003-07-28 José Matos <jamatos@fep.up.pt>
* lyx2lyx/lyx_convert224.py (layout2begin_layout):
\layout -> \begin_layout.
2003-07-28 José Matos <jamatos@fep.up.pt>
* lyx2lyx/lyx_convert224.py (add_end_layout): fix logic.

View File

@ -68,19 +68,19 @@ def add_end_layout(lines):
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

View File

@ -179,6 +179,7 @@ src/mathed/ref_inset.C
src/paragraph.C
src/paragraph_funcs.C
src/rowpainter.C
src/support/path_defines.C
src/text.C
src/text2.C
src/text3.C

View File

@ -1,3 +1,9 @@
2003-07-28 José Matos <jamatos@fep.up.pt>
* buffer.C (readParagraph):
* params_func (readParToken, readParagraph):
* paragraph.C (write): \layout -> \begin_layout.
2003-07-28 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyxlex_pimpl.C (setFile): clean up slightly.

View File

@ -348,7 +348,7 @@ int Buffer::readParagraph(LyXLex & lex, string const & token,
static Change current_change;
int unknown = 0;
if (token == "\\layout") {
if (token == "\\begin_layout") {
lex.pushToken(token);
Paragraph par;

View File

@ -1,3 +1,8 @@
2003-07-28 José Matos <jamatos@fep.up.pt>
* insetert.C (write): \layout -> \begin_layout.
Add missing \end_layout.
2003-07-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insettabular.C (write): remove extra space

View File

@ -205,7 +205,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
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);
@ -227,6 +227,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
break;
}
}
os << "\n\\end_layout\n";
}
}

View File

@ -156,7 +156,7 @@ void Paragraph::write(Buffer const * buf, ostream & os,
}
// First write the layout
os << "\n\\layout " << layout()->name() << '\n';
os << "\n\\begin_layout " << layout()->name() << '\n';
params().write(os);

View File

@ -793,7 +793,7 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
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 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
} 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 @@ int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex)
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);

View File

@ -1,3 +1,10 @@
2003-07-28 José Matos <jamatos@lyx.org>
* text.C:
* tex2lyx.C:
* preamble.C:
* table.C: \layout -> \begin_layout.
2003-07-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (parse_text): read environment from layout file too. Now,

View File

@ -166,7 +166,7 @@ void end_preamble(ostream & os, LyXTextClass const & textclass)
<< "\\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";
}

View File

@ -490,7 +490,7 @@ void handle_tabular(Parser & p, ostream & os,
os << " 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"
<< "</cell>\n";

View File

@ -121,7 +121,7 @@ void clean_layouts(istream & is, ostream & os)
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;

View File

@ -100,7 +100,7 @@ void skip_braces(Parser & p)
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 @@ void handle_par(ostream & os)
{
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 @@ void output_layout(ostream & os, LyXLayout_ptr const & layout_ptr,
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
@ -327,7 +327,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
}
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);
@ -344,7 +344,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|| s == "lyxlist";
if (deeper)
os << "\n\\begin_deeper";
os << "\n\\layout " << layout_ptr->name()
os << "\n\\begin_layout " << layout_ptr->name()
<< "\n\n";
switch (layout_ptr->latextype) {
case LATEX_LIST_ENVIRONMENT:
@ -438,7 +438,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
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);
}
@ -453,7 +453,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
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);
}
@ -523,7 +523,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
}
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";
}