#include <boost/assert.hpp>
-using lyx::docstring;
-using lyx::support::findToken;
+namespace lyx {
+
+using support::findToken;
using std::string;
using std::endl;
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") {
if (lyxerr.debugging(Debug::PARSER))
lyxerr << "Command <" << cmd
- << "> == <" << getCommand()
+ << "> == <" << to_utf8(getCommand())
<< "> == <" << getCmdName()
<< '|' << getContents()
<< '|' << getOptions()
if (!params_[i].empty())
// FIXME UNICODE
os << info_->paramnames[i] << ' '
- << LyXLex::quoteString(lyx::to_utf8(params_[i]))
+ << LyXLex::quoteString(to_utf8(params_[i]))
<< '\n';
}
-string const InsetCommandParams::getCommand() const
+docstring const InsetCommandParams::getCommand() const
{
- docstring s = '\\' + lyx::from_ascii(name_);
+ 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()) {
break;
if (!params_[j].empty()) {
s += "[]";
+ noparam = false;
break;
}
}
- } else
+ } else {
s += '[' + params_[i] + ']';
- } else
+ noparam = false;
+ }
+ } else {
s += '{' + params_[i] + '}';
+ noparam = false;
+ }
}
- return lyx::to_utf8(s);
+ if (noparam)
+ // Make sure that following stuff does not change the
+ // command name.
+ s += "{}";
+ return s;
}
{
for (size_t i = 0; i < info_->n; ++i)
if (info_->optional[i])
- return lyx::to_utf8(params_[i]);
+ return to_utf8(params_[i]);
lyxerr << "Programming error: get nonexisting option in "
<< name_ << " inset." << endl;;
return string();
if (first)
first = false;
else
- return lyx::to_utf8(params_[i]);
+ return to_utf8(params_[i]);
}
// Happens in InsetCitation
lyxerr << "Programming error: get nonexisting second option in "
{
for (size_t i = 0; i < info_->n; ++i)
if (!info_->optional[i])
- return lyx::to_utf8(params_[i]);
+ return to_utf8(params_[i]);
BOOST_ASSERT(false);
return string();
}
{
for (size_t i = 0; i < info_->n; ++i)
if (info_->optional[i]) {
- params_[i] = lyx::from_utf8(o);
+ params_[i] = from_utf8(o);
return;
}
lyxerr << "Programming error: set nonexisting option in "
if (first)
first = false;
else {
- params_[i] = lyx::from_utf8(s);
+ params_[i] = from_utf8(s);
return;
}
}
{
for (size_t i = 0; i < info_->n; ++i)
if (!info_->optional[i]) {
- params_[i] = lyx::from_utf8(c);
+ params_[i] = from_utf8(c);
return;
}
BOOST_ASSERT(false);
{
return !(o1 == o2);
}
+
+
+} // namespace lyx