From bfa9991f9308c414357810cb1d1152929e96b70b Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 21 Oct 2010 17:56:00 +0000 Subject: [PATCH] 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 --- src/insets/InsetCommandParams.cpp | 5 ++--- src/insets/InsetCommandParams.h | 10 +++++----- src/insets/InsetRef.cpp | 11 +++++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 31ea514a79..0f4b82aaf8 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -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 + ']'; diff --git a/src/insets/InsetCommandParams.h b/src/insets/InsetCommandParams.h index 8d2aaa8fa2..7dc59fa5ee 100644 --- a/src/insets/InsetCommandParams.h +++ b/src/insets/InsetCommandParams.h @@ -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_; diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index d9bef45d48..f003090cf1 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -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; } -- 2.39.2