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":
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
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])
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__":