}
-bool Layout::read(Lexer & lex, TextClass const & tclass)
+bool Layout::read(Lexer & lex, TextClass const & tclass, bool validating)
{
// If this is an empty layout, or if no force local version is set,
// we know that we will not discard the stuff to read
if (forcelocal == 0)
- return readIgnoreForcelocal(lex, tclass);
+ return readIgnoreForcelocal(lex, tclass, validating);
Layout tmp(*this);
tmp.forcelocal = 0;
- bool const ret = tmp.readIgnoreForcelocal(lex, tclass);
+ bool const ret = tmp.readIgnoreForcelocal(lex, tclass, validating);
// Keep the stuff if
// - the read version is higher
// - both versions are infinity (arbitrary decision)
}
-bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
+bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
+ bool validating)
{
// This table is sorted alphabetically [asierra 30March96]
LexerKeyword layoutTags[] = {
break;
case LT_ARGUMENT:
- readArgument(lex);
+ readArgument(lex, validating);
break;
case LT_NEED_PROTECT:
error = true;
}
}
- if (arg.labelstring.empty())
+ if (!validating && arg.labelstring.empty()) {
LYXERR0("Incomplete Argument definition!");
// remove invalid definition
lam.erase(id);
void setUnknown(bool unknown) { unknown_ = unknown; }
/// Reads a layout definition from file
/// \return true on success.
- bool read(Lexer &, TextClass const &);
+ bool read(Lexer &, TextClass const &, bool validating = false);
///
void readAlign(Lexer &);
///
///
void readSpacing(Lexer &);
///
- void readArgument(Lexer &);
+ void readArgument(Lexer &, bool);
/// Write a layout definition in utf8 encoding
void write(std::ostream &) const;
///
private:
/// Reads a layout definition from file
/// \return true on success.
- bool readIgnoreForcelocal(Lexer &, TextClass const &);
+ bool readIgnoreForcelocal(Lexer &, TextClass const &, bool validating);
/// generates the default CSS for this layout
void makeDefaultCSS() const;
///
}
-bool TextClass::readStyle(Lexer & lexrc, Layout & lay) const
+bool TextClass::readStyle(Lexer & lexrc, Layout & lay, ReadType rt) const
{
LYXERR(Debug::TCLASS, "Reading style " << to_utf8(lay.name()));
- if (!lay.read(lexrc, *this)) {
+ if (!lay.read(lexrc, *this, rt == VALIDATION)) {
LYXERR0("Error parsing style `" << to_utf8(lay.name()) << '\'');
return false;
}
Layout lay;
// Since we couldn't read the name, we just scan the rest
// of the style and discard it.
- error = !readStyle(lexrc, lay);
+ error = !readStyle(lexrc, lay, rt);
break;
}
// block.
if (have_layout && !providestyle) {
Layout & lay = operator[](name);
- error = !readStyle(lexrc, lay);
+ error = !readStyle(lexrc, lay, rt);
}
// If the layout does not exist, then we want to create a new
// one, but not if we are in a ModifyStyle block.
else if (!have_layout && !modifystyle) {
Layout layout;
layout.setName(name);
- error = !readStyle(lexrc, layout);
+ error = !readStyle(lexrc, layout, rt);
if (!error)
layoutlist_.push_back(layout);
else {
Layout lay;
// signal to coverity that we do not care about the result
- (void)readStyle(lexrc, lay);
+ (void)readStyle(lexrc, lay, rt);
}
break;
}
defaultLayout = new Layout;
defaultLayout->setUnknown(unknown);
defaultLayout->setName(name);
- if (!readStyle(lex, *defaultLayout)) {
+ if (!readStyle(lex, *defaultLayout, BASECLASS)) {
// The only way this happens is because the hardcoded layout above
// is wrong.
LATTEST(false);
/// Reads the layout file without running layout2layout.
ReturnValues readWithoutConv(support::FileName const & filename, ReadType rt);
/// \return true for success.
- bool readStyle(Lexer &, Layout &) const;
+ bool readStyle(Lexer &, Layout &, ReadType) const;
///
void readOutputType(Lexer &);
///