+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>
* lyx_main.C (LyX): remove call to setDisplayTranslator().
} else if (cmdName == "printindex") {
inset = new InsetPrintIndex(inscmd);
} else {
- lyxerr << "unknown CommandInset '" << cmdName << "'" << std::endl;
- BOOST_ASSERT(false);
+ lyxerr << "unknown CommandInset '" << cmdName
+ << "'" << std::endl;
+ while (lex.isOK() && lex.getString() != "\\end_inset")
+ lex.next();
+ return 0;
}
} else {
if (tmptok == "Quotes") {
} else if (tmptok == "FloatList") {
inset = new InsetFloatList;
} else {
- lyxerr << "unknown Inset type '" << tmptok << "'" << std::endl;
- BOOST_ASSERT(false);
+ lyxerr << "unknown Inset type '" << tmptok
+ << "'" << std::endl;
+ while (lex.isOK() && lex.getString() != "\\end_inset")
+ lex.next();
+ return 0;
}
inset->read(buf, lex);
<< "Missing \\begin_inset?.\n";
} else if (token == "\\begin_inset") {
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") {
lex.next();
font.setLyXFamily(lex.getString());
token, lex.getString());
buf.error(ErrorItem(_("Unknown token"), s,
- par.id(), 0, par.size()));
+ buf.paragraphs().back().id(),
+ 0, par.size()));
return 1;
}
return 0;