break;
}
docstring const name = subst(lexrc.getDocString(), '_', ' ');
+ bool const validating = (rt == VALIDATION);
if (name.empty()) {
string s = "Could not read name for InsetLayout: `$$Token' "
+ lexrc.getString() + " is probably not valid UTF-8!";
// Since we couldn't read the name, we just scan the rest
// of the style and discard it.
il.read(lexrc, *this);
- // Let's try to continue rather than abort.
- // error = true;
+ // Let's try to continue rather than abort, unless we're validating
+ // in which case we want to report the error
+ if (validating)
+ error = true;
} else if (hasInsetLayout(name)) {
InsetLayout & il = insetlayoutlist_[name];
- error = !il.read(lexrc, *this);
+ error = !il.read(lexrc, *this, validating);
} else {
InsetLayout il;
il.setName(name);
- error = !il.read(lexrc, *this);
+ error = !il.read(lexrc, *this, validating);
if (!error)
insetlayoutlist_[name] = il;
}
} // namespace
-bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
+bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
+ bool validating)
{
enum {
IL_ADDTOTOC,
switch (le) {
case Lexer::LEX_UNDEF:
lex.printError("Unknown InsetLayout tag");
+ if (validating)
+ return false;
continue;
default:
break;
LYXERR0("Flex insets must have names of the form `Flex:<name>'.\n"
"This one has the name `" << to_utf8(name_) << "'\n"
"Ignoring LyXType declaration.");
+ // this is not really a reason to abort
+ if (validating)
+ return false;
break;
}
string lt;
lex >> lt;
lyxtype_ = translateLyXType(lt);
- if (lyxtype_ == NOLYXTYPE)
+ if (lyxtype_ == NOLYXTYPE) {
LYXERR0("Unknown LyXType `" << lt << "'.");
+ // this is not really a reason to abort
+ if (validating)
+ return false;
+ }
if (lyxtype_ == CHARSTYLE) {
// by default, charstyles force the plain layout
multipar_ = false;
string lt;
lex >> lt;
latextype_ = translateLaTeXType(lt);
- if (latextype_ == ILT_ERROR)
+ if (latextype_ == ILT_ERROR) {
LYXERR0("Unknown LaTeXType `" << lt << "'.");
+ // this is not really a reason to abort
+ if (validating)
+ return false;
+ }
break;
}
case IL_LABELSTRING:
tclass.insetLayouts().end();
for (; lit != len; ++lit)
lyxerr << lit->second.name() << "\n";
+ // this is not really a reason to abort
+ if (validating)
+ return false;
}
break;
}
tclass.insetLayouts().end();
for (; lit != len; ++lit)
lyxerr << lit->second.name() << "\n";
+ // this is not really a reason to abort
+ if (validating)
+ return false;
}
break;
}
ILT_ERROR
};
///
- bool read(Lexer & lexrc, TextClass const & tclass);
+ bool read(Lexer & lexrc, TextClass const & tclass,
+ bool validating = false);
///
docstring name() const { return name_; }
///