]> git.lyx.org Git - lyx.git/commitdiff
document and convert eqref fileformat change
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 21 Feb 2005 12:04:23 +0000 (12:04 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Mon, 21 Feb 2005 12:04:23 +0000 (12:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9657 a592a061-630c-0410-9148-cb99ea01b6c8

development/FORMAT
lib/lyx2lyx/ChangeLog
lib/lyx2lyx/lyx_1_4.py

index c098a3cbbded8949c5633f901806d3f357ec36e3..0954ed053cc4138136d8b4b17b5de32dcc192fde 100644 (file)
@@ -320,6 +320,11 @@ Paragraph text.
                ERT: "\ " could be converted to InsetSpace \<space>
                ERT: "\," could be converted to InsetSpace \,
 
+2003-04-24  André Pönitz <poenitz@gmx.net>
+
+       * Added eqref support:
+       \begin_inset LatexCommand \eqref{label}
+
 2003-03-12  John Levon  <levon@movementarian.org>
 
        * Added \\end_header to signify the end of the header in a
index ee8a6d520f36daf751b22d0790b656a60aaf1191..7d541da23d6155d5ba3828ff5a39b23711ad5aa2 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-20  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
+
+       * lyx_1_4.py (lyx_support_escape): new
+       * lyx_1_4.py (revert_eqref): new, convert
+       '\begin_inset LatexCommand \eqref{label}' to ERT
+       * lyx_1_4.py (revert): call revert_eqref in step 223 -> 221
+
 2005-02-17  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * lyx_1_4.py (convert_table_valignment_middle,
index 29330d8abb71783c1ea4cfbaf9f53cc1af9cc3d7..f459ef43ff0ebb1f75d6a416fa694ccb74f9cfa6 100644 (file)
@@ -69,6 +69,41 @@ def revert_spaces(file):
         file.body[i] = replace(file.body[i],"\\InsetSpace ~", "\\SpecialChar ~")
 
 
+##
+# equivalent to lyx::support::escape()
+#
+def lyx_support_escape(lab):
+    hexdigit = ['0', '1', '2', '3', '4', '5', '6', '7',
+                '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
+    enc = ""
+    for c in lab:
+        o = ord(c)
+        if o >= 128 or c == '=' or c == '%':
+            enc = enc + '='
+            enc = enc + hexdigit[o >> 4]
+            enc = enc + hexdigit[o & 15]
+        else:
+            enc = enc + c
+    return enc;
+
+
+##
+# \begin_inset LatexCommand \eqref -> ERT
+#
+def revert_eqref(file):
+    regexp = re.compile(r'^\\begin_inset\s+LatexCommand\s+\\eqref')
+    i = 0
+    while 1:
+        i = find_re(file.body, regexp, i)
+        if i == -1:
+            break
+        eqref = lyx_support_escape(regexp.sub("", file.body[i]))
+        file.body[i:i+1] = ["\\begin_inset ERT", "status Collapsed", "",
+                            "\\layout Standard", "", "\\backslash ",
+                            "eqref" + eqref]
+        i = i + 7
+
+
 ##
 # BibTeX changes
 #
@@ -1834,7 +1869,7 @@ revert =  [[240, [revert_ert_paragraphs]],
            [225, [revert_note]],
            [224, [rm_end_layout, begin_layout2layout, revert_end_document,
                   revert_valignment_middle, convert_vspace, convert_frameless_box]],
-           [223, [revert_external_2, revert_comment]],
+           [223, [revert_external_2, revert_comment, revert_eqref]],
            [221, [rm_end_header, revert_spaces, revert_bibtex,
                   rm_tracking_changes, rm_body_changes]]]