]> git.lyx.org Git - features.git/commitdiff
Fix bug #6962. I hadn't see how these were being escaped.
authorRichard Heck <rgheck@comcast.net>
Thu, 21 Oct 2010 17:56:00 +0000 (17:56 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 21 Oct 2010 17:56:00 +0000 (17:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35757 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCommandParams.cpp
src/insets/InsetCommandParams.h
src/insets/InsetRef.cpp

index 31ea514a79549aa9a835d2dfb338be258e5d3e05..0f4b82aaf868f81b2bb1aeca794f4638aafea4f5 100644 (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 + ']';
index 8d2aaa8fa246cb5268a68296ff8fc1c9f871f9b3..7dc59fa5ee764fc0e46cf65d4d5a6008ee5fdb42 100644 (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_;
index d9bef45d48fa4a9f8b0c58e7384edaa05cbf7096..f003090cf10bacd0335a7d47435679ce9fd4ea00 100644 (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;
 }