Fix bug 1323

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7918 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-10-14 12:49:15 +00:00
parent 4e136e6f41
commit 5705714920
3 changed files with 31 additions and 6 deletions

View File

@ -1,3 +1,12 @@
2003-10-14 Alfredo Braunstein <abraunst@libero.it>
* paragraph_funcs.C (readParToken): report unknown insets as error
boxes. Use the outer paragraph as location (also for unknown
tokens).
* factory.C (readInset): do not abort on reading an unknown inset.
Eat it and return 0.
2003-10-13 Angus Leeming <leeming@lyx.org> 2003-10-13 Angus Leeming <leeming@lyx.org>
* lyx_main.C (LyX): remove call to setDisplayTranslator(). * lyx_main.C (LyX): remove call to setDisplayTranslator().

View File

@ -366,8 +366,11 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
} else if (cmdName == "printindex") { } else if (cmdName == "printindex") {
inset = new InsetPrintIndex(inscmd); inset = new InsetPrintIndex(inscmd);
} else { } else {
lyxerr << "unknown CommandInset '" << cmdName << "'" << std::endl; lyxerr << "unknown CommandInset '" << cmdName
BOOST_ASSERT(false); << "'" << std::endl;
while (lex.isOK() && lex.getString() != "\\end_inset")
lex.next();
return 0;
} }
} else { } else {
if (tmptok == "Quotes") { if (tmptok == "Quotes") {
@ -430,8 +433,11 @@ InsetOld * readInset(LyXLex & lex, Buffer const & buf)
} else if (tmptok == "FloatList") { } else if (tmptok == "FloatList") {
inset = new InsetFloatList; inset = new InsetFloatList;
} else { } else {
lyxerr << "unknown Inset type '" << tmptok << "'" << std::endl; lyxerr << "unknown Inset type '" << tmptok
BOOST_ASSERT(false); << "'" << std::endl;
while (lex.isOK() && lex.getString() != "\\end_inset")
lex.next();
return 0;
} }
inset->read(buf, lex); inset->read(buf, lex);

View File

@ -865,7 +865,16 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
<< "Missing \\begin_inset?.\n"; << "Missing \\begin_inset?.\n";
} else if (token == "\\begin_inset") { } else if (token == "\\begin_inset") {
InsetOld * inset = readInset(lex, buf); InsetOld * inset = readInset(lex, buf);
par.insertInset(par.size(), inset, font, change); if (inset)
par.insertInset(par.size(), inset, font, change);
else {
lex.eatLine();
string line = lex.getString();
buf.error(ErrorItem(_("Unknown Inset"), line,
buf.paragraphs().back().id(),
0, par.size()));
return 1;
}
} else if (token == "\\family") { } else if (token == "\\family") {
lex.next(); lex.next();
font.setLyXFamily(lex.getString()); font.setLyXFamily(lex.getString());
@ -986,7 +995,8 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
token, lex.getString()); token, lex.getString());
buf.error(ErrorItem(_("Unknown token"), s, buf.error(ErrorItem(_("Unknown token"), s,
par.id(), 0, par.size())); buf.paragraphs().back().id(),
0, par.size()));
return 1; return 1;
} }
return 0; return 0;