X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetcommandparams.C;h=bd0c208ef2a7603e4dbc9bb076e96821eb204fe7;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=ab61de201cf8ce23cbf4d6255a176e8488f9c3eb;hpb=6c300f72a217722652dc27db9108e1050028979c;p=lyx.git diff --git a/src/insets/insetcommandparams.C b/src/insets/insetcommandparams.C index ab61de201c..bd0c208ef2 100644 --- a/src/insets/insetcommandparams.C +++ b/src/insets/insetcommandparams.C @@ -117,6 +117,22 @@ InsetCommandParams::findInfo(std::string const & name) return &info; } + // InsetNomencl + if (name == "nomenclature") { + static const char * const paramnames[] = {"prefix", "symbol", "description", ""}; + static const bool isoptional[] = {true, false, false}; + static const CommandInfo info = {3, paramnames, isoptional}; + return &info; + } + + // InsetPrintNomencl + if (name == "printnomenclature") { + static const char * const paramnames[] = {"labelwidth", ""}; + static const bool isoptional[] = {true}; + static const CommandInfo info = {1, paramnames, isoptional}; + return &info; + } + // InsetRef if (name == "eqref" || name == "pageref" || name == "vpageref" || name == "vref" || name == "prettyref" || name == "ref") { @@ -288,6 +304,7 @@ void InsetCommandParams::write(ostream & os) const docstring const InsetCommandParams::getCommand() const { docstring s = '\\' + from_ascii(name_); + bool noparam = true; for (size_t i = 0; i < info_->n; ++i) { if (info_->optional[i]) { if (params_[i].empty()) { @@ -299,14 +316,23 @@ docstring const InsetCommandParams::getCommand() const break; if (!params_[j].empty()) { s += "[]"; + noparam = false; break; } } - } else + } else { s += '[' + params_[i] + ']'; - } else + noparam = false; + } + } else { s += '{' + params_[i] + '}'; + noparam = false; + } } + if (noparam) + // Make sure that following stuff does not change the + // command name. + s += "{}"; return s; }