/////////////////////////////////////////////////////////////////////
ParamInfo::ParamData::ParamData(std::string const & s, ParamType t,
- ParamHandling h)
- : name_(s), type_(t), handling_(h)
+ ParamHandling h, bool ignore,
+ docstring default_value)
+ : name_(s), type_(t), handling_(h), ignore_(ignore),
+ default_value_(default_value)
{}
void ParamInfo::add(std::string const & name, ParamType type,
- ParamHandling handling)
-{
- info_.push_back(ParamData(name, type, handling));
+ ParamHandling handling, bool ignore,
+ docstring default_value)
+{
+ info_.push_back(ParamData(name, type, handling, ignore, default_value));
}
}
info_ = findInfo(insetCode_, cmdName_);
+
+ for (ParamInfo::ParamData const & param : info_)
+ if (param.ignore()) {
+ params_[param.name()] = param.defaultValue();
+ }
string token;
while (lex.isOK()) {
ParamInfo::const_iterator it = info_.begin();
ParamInfo::const_iterator end = info_.end();
for (; it != end; ++it) {
+ if (it->ignore())
+ continue;
string const & name = it->name();
string data = to_utf8((*this)[name]);
if (!data.empty()) {
ParamMap::const_iterator data = params_.find(name);
if (data == params_.end() || data->second.empty())
return dummy;
+ ParamInfo::ParamData const & param = info_[name];
+ if (param.ignore())
+ return param.defaultValue();
return data->second;
}
{
LATTEST(info_.hasParam(name));
// this will add the name in release mode
+ ParamInfo::ParamData const & param = info_[name];
+ if (param.ignore())
+ params_[name] = param.defaultValue();
return params_[name];
}
// flag for all commands.
public:
///
- ParamData(std::string const &, ParamType, ParamHandling = HANDLING_NONE);
+ ParamData(std::string const &, ParamType, ParamHandling = HANDLING_NONE,
+ bool ignore = false,
+ docstring default_value = docstring());
///
std::string name() const { return name_; }
///
/// whether this is an optional LaTeX argument
bool isOptional() const;
///
+ bool ignore() const { return ignore_; }
+ ///
+ docstring const & defaultValue() const { return default_value_; }
+ ///
bool operator==(ParamData const &) const;
///
bool operator!=(ParamData const & rhs) const
ParamType type_;
/// do we need special handling on latex output?
ParamHandling handling_;
+ ///
+ bool ignore_;
+ ///
+ docstring default_value_;
};
/// adds a new parameter
+ /// If ignore is true, then the parameter is never saved, and is always
+ /// given the default value.
void add(std::string const & name, ParamType type,
- ParamHandling = HANDLING_NONE);
+ ParamHandling = HANDLING_NONE, bool ignore = false,
+ docstring default_value = docstring());
///
bool empty() const { return info_.empty(); }
///