}
-
docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
docstring const & command,
ParamInfo::ParamHandling handling) const
break;
case ParamInfo::LATEX_REQUIRED: {
- docstring const & data =
+ docstring const data =
prepareCommand(runparams, (*this)[name], it->handling());
s += '{' + data + '}';
noparam = false;
break;
}
case ParamInfo::LATEX_OPTIONAL: {
- docstring const & data =
+ docstring const data =
prepareCommand(runparams, (*this)[name], it->handling());
if (!data.empty()) {
s += '[' + data + ']';
void clear();
///
static bool isCompatibleCommand(InsetCode code, std::string const & s);
-
+ ///
+ ParamInfo const & info() const { return info_; };
+ ///
+ docstring prepareCommand(OutputParams const & runparams,
+ docstring const & command, ParamInfo::ParamHandling handling) const;
private:
std::string getDefaultCmd(InsetCode code);
/// checks whether we need to write an empty optional parameter
/// \return true if a non-empty optional parameter follows ci
bool writeEmptyOptional(ParamInfo::const_iterator ci) const;
- ///
- docstring prepareCommand(OutputParams const & runparams,
- docstring const & command,
- ParamInfo::ParamHandling handling) const;
/// Description of all command properties
ParamInfo info_;
}
// so we're doing a formatted reference.
+ // the command may need to be escaped.
+ InsetCommandParams const & p = params();
+ ParamInfo const & pi = p.info();
+ ParamInfo::ParamData const & pd = pi["reference"];
+ docstring const data =
+ p.prepareCommand(runparams, ref, pd.handling());
+
if (!buffer().params().use_refstyle) {
- os << "\\prettyref{" << ref << '}';
+ os << "\\prettyref{" << data << '}';
return 0;
}
- os << "\\lyxref{" << ref << '}';
+ os << "\\lyxref{" << data << '}';
return 0;
}