]> git.lyx.org Git - features.git/commitdiff
Prevent changing of non-tabular lines.
authorDekel Tsur <dekelts@tau.ac.il>
Tue, 3 Sep 2002 15:21:24 +0000 (15:21 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Tue, 3 Sep 2002 15:21:24 +0000 (15:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5195 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/lyx2lyx/lyxconvert_218.py
lib/lyx2lyx/parser_tools.py

index 5b6f28a09d3f5a55a21836c5ff8ed58323017363..4a586013bd6493a5a6ca58d390ac924c6e7e3254 100644 (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>
 
        * scripts/lyxpreview2ppm.sh: re-written to make use of the "lyx"
index f5ea8b0235fbe7846de530195710edaa70f2a49b..5044ae92256a95ef28d858758af14415cb5f1ce4 100644 (file)
@@ -404,11 +404,7 @@ def update_tabular(lines):
         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"):
@@ -417,7 +413,7 @@ def update_tabular(lines):
            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)
index 3b15704eac1eb9f5ade988eb24cd6cf46a347fd5..b16648a8219ca2077d6bacc833aa44934f1a029d 100644 (file)
@@ -144,6 +144,21 @@ def find_beginning_of_inset(lines, i):
 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)