Prevent changing of non-tabular lines.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5195 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-09-03 15:21:24 +00:00
parent 1ccc528e28
commit 5036183ea4
3 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,8 @@
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> 2002-09-03 Angus Leeming <leeming@lyx.org>
* scripts/lyxpreview2ppm.sh: re-written to make use of the "lyx" * scripts/lyxpreview2ppm.sh: re-written to make use of the "lyx"

View File

@ -404,11 +404,7 @@ def update_tabular(lines):
if i == -1: if i == -1:
break break
j = find_end_of_tabular(lines, i+1) for k in get_tabular_lines(lines, i):
if j == -1:
break
for k in xrange(i+1,j):
if check_token(lines[k], "<lyxtabular"): if check_token(lines[k], "<lyxtabular"):
lines[k] = string.replace(lines[k], 'version="2"', 'version="3"') lines[k] = string.replace(lines[k], 'version="2"', 'version="3"')
elif check_token(lines[k], "<column"): elif check_token(lines[k], "<column"):
@ -417,7 +413,7 @@ def update_tabular(lines):
if line_re.match(lines[k]): if line_re.match(lines[k]):
lines[k] = re.sub(attr_re, "", lines[k]) lines[k] = re.sub(attr_re, "", lines[k])
i = j+1 i = i+1
def change_preamble(lines): def change_preamble(lines):
i = find_token(lines, "\\use_amsmath", 0) i = find_token(lines, "\\use_amsmath", 0)

View File

@ -144,6 +144,21 @@ def find_beginning_of_inset(lines, i):
def find_end_of_tabular(lines, i): def find_end_of_tabular(lines, i):
return find_end_of(lines, i, "<lyxtabular", "</lyxtabular") 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): def is_nonempty_line(line):
return line != " "*len(line) return line != " "*len(line)