]> git.lyx.org Git - features.git/commitdiff
remove space between margin separation and units of 2.15 files (bug 763)
authorJosé Matox <jamatos@lyx.org>
Fri, 6 Jun 2003 15:48:35 +0000 (15:48 +0000)
committerJosé Matox <jamatos@lyx.org>
Fri, 6 Jun 2003 15:48:35 +0000 (15:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7127 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/lyx2lyx/lyxconvert_215.py

index e189c8f6cca92d3bcae7504fe1172ca6895b9a86..737623cadc14318dca8ad333988185ea48c811b6 100644 (file)
@@ -1,3 +1,7 @@
+2003-06-06  José Matos  <jamatos@fep.up.pt>
+
+       * lyx2lyx/lyxconvert_215 (remove_space_in_units): fix bug 763.
+
 2003-06-06  José Matos  <jamatos@fep.up.pt>
 
        * lyx2lyx/lyxconvert_216 (update_tabular): fix bug 1045.
index 1dbc589bd26e44955dd0a0261926ec0d26303b94..1bcb0833de84dfc1057f80e876a7c6511234e54a 100644 (file)
@@ -107,6 +107,30 @@ def remove_vcid(lines):
     if i != -1:
         del lines[i]
 
+def remove_space_in_units(lines):
+    margins = ["\\topmargin","\\rightmargin",
+               "\\leftmargin","\\bottommargin"]
+
+    unit_rexp = re.compile(r'[^ ]* (.*) (.*)')
+
+    begin_preamble = find_token(lines,"\\begin_preamble", 0)
+    end_preamble = find_token(lines, "\\end_preamble", 0)
+    for margin in margins:
+        i = 0
+        while 1:
+            i = find_token(lines, margin, i)
+            if i == -1:
+                break
+
+            if i > begin_preamble and i < end_preamble:
+                i = i + 1
+                continue
+
+            result = unit_rexp.search(lines[i])
+            if result:
+                lines[i] = margin + " " + result.group(1) + result.group(2)
+            i = i + 1
+
 def convert(header,body):
     remove_vcid(header)
     remove_cursor(body)
@@ -114,6 +138,7 @@ def convert(header,body):
     replace_protected_separator(body)
     merge_formula_inset(body)
     update_tabular(body)
+    remove_space_in_units(header)    
 
 if __name__ == "__main__":
     pass