Author: forenr
Date: Sat Nov  6 16:24:37 2010
New Revision: 36164
URL: http://www.lyx.org/trac/changeset/36164

Log:
Fix bug #7019 (Math labels should not be escaped on saving)

Modified:
   lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.cpp
   lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.h
   lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.cpp
   lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.h
   lyx-devel/branches/BRANCH_1_6_X/status.16x

Modified: lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.cpp        Sat Nov 
 6 16:06:19 2010        (r36163)
+++ lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.cpp        Sat Nov 
 6 16:24:37 2010        (r36164)
@@ -634,7 +634,8 @@
 }
 
 
-docstring InsetMathGrid::eolString(row_type row, bool fragile, bool last_eoln) 
const
+docstring InsetMathGrid::eolString(row_type row, bool fragile, bool /*latex*/,
+               bool last_eoln) const
 {
        docstring eol;
 
@@ -1006,7 +1007,7 @@
                                ModeSpecifier specifier(os, TEXT_MODE);
                        os << eocString(col, lastcol);
                }
-               eol = eolString(row, os.fragile(), last_eoln);
+               eol = eolString(row, os.fragile(), os.latex(), last_eoln);
                os << eol;
                // append newline only if line wasn't completely empty
                // and this was not the last line in the grid

Modified: lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.h
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.h  Sat Nov  6 
16:06:19 2010        (r36163)
+++ lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathGrid.h  Sat Nov  6 
16:24:37 2010        (r36164)
@@ -230,7 +230,8 @@
        /// returns y offset of cell compared to inset
        int cellYOffset(idx_type idx) const;
        /// returns proper 'end of line' code for LaTeX
-       virtual docstring eolString(row_type row, bool fragile, bool last_eoln) 
const;
+       virtual docstring eolString(row_type row, bool fragile, bool latex,
+                       bool last_eoln) const;
        /// returns proper 'end of column' code for LaTeX
        virtual docstring eocString(col_type col, col_type lastcol) const;
        /// splits cells and shifts right part to the next cell

Modified: lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.cpp        Sat Nov 
 6 16:06:19 2010        (r36163)
+++ lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.cpp        Sat Nov 
 6 16:24:37 2010        (r36164)
@@ -1071,19 +1071,23 @@
 }
 
 
-docstring InsetMathHull::eolString(row_type row, bool fragile, bool last_eoln) 
const
+docstring InsetMathHull::eolString(row_type row, bool fragile, bool latex,
+               bool last_eoln) const
 {
        docstring res;
        if (numberedType()) {
-               if (label_[row] && !nonum_[row])
-                       res += "\\label{" +
-                           escape(label_[row]->getParam("name")) + '}';
+               if (label_[row] && !nonum_[row]) {
+                       docstring const name =
+                               latex ? escape(label_[row]->getParam("name"))
+                                     : label_[row]->getParam("name");
+                       res += "\\label{" + name + '}';
+               }
                if (nonum_[row] && (type_ != hullMultline))
                        res += "\\nonumber ";
        }
        // Never add \\ on the last empty line of eqnarray and friends
        last_eoln = false;
-       return res + InsetMathGrid::eolString(row, fragile, last_eoln);
+       return res + InsetMathGrid::eolString(row, fragile, latex, last_eoln);
 }
 
 

Modified: lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.h
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.h  Sat Nov  6 
16:06:19 2010        (r36163)
+++ lyx-devel/branches/BRANCH_1_6_X/src/mathed/InsetMathHull.h  Sat Nov  6 
16:24:37 2010        (r36164)
@@ -155,7 +155,8 @@
        bool getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & status) const;
        ///
-       docstring eolString(row_type row, bool fragile, bool last_eoln) const;
+       docstring eolString(row_type row, bool fragile, bool latex,
+               bool last_eoln) const;
 
 private:
        virtual Inset * clone() const;

Modified: lyx-devel/branches/BRANCH_1_6_X/status.16x
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/status.16x  Sat Nov  6 16:06:19 2010        
(r36163)
+++ lyx-devel/branches/BRANCH_1_6_X/status.16x  Sat Nov  6 16:24:37 2010        
(r36164)
@@ -116,6 +116,8 @@
 
 - Save the path of pasted images as a relative path (part of bug 5561).
 
+- Don't escape math labels when saving (bug 7019).
+
 
 * USER INTERFACE
 

Reply via email to