[LyX/master] Allow argument definitions in layout files to modify existing ones.
Richard Kimberly Heck
rikiheck at lyx.org
Tue Sep 29 01:41:46 UTC 2020
commit 6f643e52d43423dc85457158e3746b331115fe47
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date: Mon Sep 28 22:06:11 2020 -0400
Allow argument definitions in layout files to modify existing ones.
This is what layout re-definitions do in all other cases.
---
src/Layout.cpp | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 6b591ec..1f5a898 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -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;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
bool const postcmd = prefixIs(id, "post:");
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) {
lex.next();
string const tok = ascii_lowercase(lex.getString());
@@ -1239,16 +1244,9 @@ void Layout::readArgument(Lexer & lex)
}
if (arg.labelstring.empty())
LYXERR0("Incomplete Argument definition!");
- else if (itemarg)
- itemargs_[id] = arg;
- 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;
+ // remove invalid definition
+ lam.erase(id);
+ }
}
More information about the lyx-cvs
mailing list