mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Allow argument definitions in layout files to modify existing ones.
This is what layout re-definitions do in all other cases.
This commit is contained in:
parent
54a72663ae
commit
6f643e52d4
@ -1148,17 +1148,22 @@ void Layout::readSpacing(Lexer & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Layout::readArgument(Lexer & lex)
|
void Layout::readArgument(Lexer & lex, bool validating)
|
||||||
{
|
{
|
||||||
latexarg arg;
|
|
||||||
bool error = false;
|
|
||||||
bool finished = false;
|
|
||||||
string id;
|
string id;
|
||||||
lex >> id;
|
lex >> id;
|
||||||
bool const itemarg = prefixIs(id, "item:");
|
bool const itemarg = prefixIs(id, "item:");
|
||||||
bool const postcmd = prefixIs(id, "post:");
|
bool const postcmd = prefixIs(id, "post:");
|
||||||
bool const listpreamble = prefixIs(id, "listpreamble:");
|
bool const listpreamble = prefixIs(id, "listpreamble:");
|
||||||
|
|
||||||
|
LaTeXArgMap & lam = itemarg ? itemargs_ :
|
||||||
|
(postcmd ? postcommandargs_ :
|
||||||
|
(listpreamble ? listpreamble_ :
|
||||||
|
latexargs_));
|
||||||
|
latexarg & arg = lam[id];
|
||||||
|
|
||||||
|
bool error = false;
|
||||||
|
bool finished = false;
|
||||||
while (!finished && lex.isOK() && !error) {
|
while (!finished && lex.isOK() && !error) {
|
||||||
lex.next();
|
lex.next();
|
||||||
string const tok = ascii_lowercase(lex.getString());
|
string const tok = ascii_lowercase(lex.getString());
|
||||||
@ -1239,16 +1244,9 @@ void Layout::readArgument(Lexer & lex)
|
|||||||
}
|
}
|
||||||
if (arg.labelstring.empty())
|
if (arg.labelstring.empty())
|
||||||
LYXERR0("Incomplete Argument definition!");
|
LYXERR0("Incomplete Argument definition!");
|
||||||
else if (itemarg)
|
// remove invalid definition
|
||||||
itemargs_[id] = arg;
|
lam.erase(id);
|
||||||
else if (postcmd)
|
}
|
||||||
postcommandargs_[id] = arg;
|
|
||||||
else if (listpreamble) {
|
|
||||||
// list preamble has no delimiters by default
|
|
||||||
arg.nodelims = true;
|
|
||||||
listpreamble_[id] = arg;
|
|
||||||
} else
|
|
||||||
latexargs_[id] = arg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user