]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_1_1_6fix3.py
clean up french language handling
[lyx.git] / lib / lyx2lyx / lyx_1_1_6fix3.py
index b38f0047e18b9e5a302003ee02e0d2684c45fab5..df8f3d25be2a21d62d52d942c68b7f52a31eea95 100644 (file)
@@ -18,7 +18,7 @@
 
 import re
 import string
-from parser_tools import find_token
+from parser_tools import find_token, find_re
 
 def bool_table(item):
     if item == "0":
@@ -31,10 +31,12 @@ align_table = {"0": "top", "2": "left", "4": "right", "8": "center"}
 use_table = {"0": "none", "1": "parbox"}
 table_meta_re = re.compile(r'<LyXTabular version="?1"? rows="?(\d*)"? columns="?(\d*)"?>')
 
-def update_tabular(lines, opt):
+def update_tabular(file):
+    regexp = re.compile(r'^\\begin_inset\s+Tabular')
+    lines = file.body
     i=0
     while 1:
-        i = find_token(lines, '\\begin_inset  Tabular', i)
+        i = find_re(lines, regexp, i)
         if i == -1:
             break
 
@@ -48,7 +50,7 @@ def update_tabular(lines, opt):
 
         j = find_token(lines, '</LyXTabular>', i) + 1
         if j == 0:
-            opt.warning( "Error: Bad lyx format i=%d j=%d" % (i,j))
+            file.warning( "Error: Bad lyx format i=%d j=%d" % (i,j))
             break
 
         new_table = table_update(lines[i:j])
@@ -113,13 +115,8 @@ def table_update(lines):
     return lines[:2] + col_info + lines[2:]
 
 
-def convert(header, body, opt):
-    update_tabular(body, opt)
-    opt.format = 218
-
-
-def revert(header, body, opt):
-    opt.error("The convertion to an older format (%s) is not implemented." % opt.format)
+convert = [[218, [update_tabular]]]
+revert  = []
 
 
 if __name__ == "__main__":