Fix bug #6962. I hadn't see how these were being escaped.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35757 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-10-21 17:56:00 +00:00
parent 1c059dba29
commit bfa9991f93
3 changed files with 16 additions and 10 deletions

View File

@ -365,7 +365,6 @@ bool InsetCommandParams::writeEmptyOptional(ParamInfo::const_iterator ci) const
}
docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
docstring const & command,
ParamInfo::ParamHandling handling) const
@ -425,14 +424,14 @@ docstring InsetCommandParams::getCommand(OutputParams const & runparams) 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 + ']';

View File

@ -140,16 +140,16 @@ public:
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_;

View File

@ -83,12 +83,19 @@ int InsetRef::latex(odocstream & os, OutputParams const & runparams) const
}
// 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;
}