+2002-09-03 Dekel Tsur <dekelts@tau.ac.il>
+
+ * lyx2lyx/lyxconvert_218.py (update_tabular): Prevent changing
+ of non-tabular lines.
+
2002-09-03 Angus Leeming <leeming@lyx.org>
* scripts/lyxpreview2ppm.sh: re-written to make use of the "lyx"
if i == -1:
break
- j = find_end_of_tabular(lines, i+1)
- if j == -1:
- break
-
- for k in xrange(i+1,j):
+ for k in get_tabular_lines(lines, i):
if check_token(lines[k], "<lyxtabular"):
lines[k] = string.replace(lines[k], 'version="2"', 'version="3"')
elif check_token(lines[k], "<column"):
if line_re.match(lines[k]):
lines[k] = re.sub(attr_re, "", lines[k])
- i = j+1
+ i = i+1
def change_preamble(lines):
i = find_token(lines, "\\use_amsmath", 0)
def find_end_of_tabular(lines, i):
return find_end_of(lines, i, "<lyxtabular", "</lyxtabular")
+def get_tabular_lines(lines, i):
+ result = []
+ i = i+1
+ j = find_end_of_tabular(lines, i)
+ if j == -1:
+ return []
+
+ while i <= j:
+ if check_token(lines[i], "\\begin_inset"):
+ i = find_end_of_inset(lines, i)+1
+ else:
+ result.append(i)
+ i = i+1
+ return result
+
def is_nonempty_line(line):
return line != " "*len(line)