X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetLayout.cpp;h=0dc7914dde7f6db102ba17b9a40dff32191f3d02;hb=37f41fd4b56c54764014c93c003be555f3fd6421;hp=b6dcf582dd51a9eb6578ba0c16276b2545a573f8;hpb=e018ab2c1246179e509793b4355019aba1fc3532;p=lyx.git diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index b6dcf582dd..0dc7914dde 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -518,6 +518,7 @@ void InsetLayout::readArgument(Lexer & lex) arg.labelfont = inherit_font; string nr; lex >> nr; + bool const postcmd = support::prefixIs(nr, "post:"); while (!finished && lex.isOK() && !error) { lex.next(); string const tok = support::ascii_lowercase(lex.getString()); @@ -571,15 +572,27 @@ void InsetLayout::readArgument(Lexer & lex) } if (arg.labelstring.empty()) LYXERR0("Incomplete Argument definition!"); + else if (postcmd) + postcommandargs_[nr] = arg; else latexargs_[nr] = arg; } + +Layout::LaTeXArgMap InsetLayout::args() const +{ + Layout::LaTeXArgMap args = latexargs_; + if (!postcommandargs_.empty()) + args.insert(postcommandargs_.begin(), postcommandargs_.end()); + return args; +} + + unsigned int InsetLayout::optArgs() const { unsigned int nr = 0; - Layout::LaTeXArgMap::const_iterator it = latexargs_.begin(); - for (; it != latexargs_.end(); ++it) { + Layout::LaTeXArgMap::const_iterator it = args().begin(); + for (; it != args().end(); ++it) { if (!(*it).second.mandatory) ++nr; } @@ -590,8 +603,8 @@ unsigned int InsetLayout::optArgs() const unsigned int InsetLayout::requiredArgs() const { unsigned int nr = 0; - Layout::LaTeXArgMap::const_iterator it = latexargs_.begin(); - for (; it != latexargs_.end(); ++it) { + Layout::LaTeXArgMap::const_iterator it = args().begin(); + for (; it != args().end(); ++it) { if ((*it).second.mandatory) ++nr; }