]> git.lyx.org Git - features.git/commitdiff
old ERT insets should just be ignored
authorDekel Tsur <dekelts@tau.ac.il>
Mon, 12 Aug 2002 21:48:47 +0000 (21:48 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Mon, 12 Aug 2002 21:48:47 +0000 (21:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4949 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 9a6db44ba702f2101eccf83dc02aa7dcd851711e..89eb0a365dd806cd80c45af12b1aa291cd135f66 100644 (file)
@@ -228,7 +228,7 @@ def remove_oldert(lines):
                        # as similar as posible to the lyx format
                        new2 = [""]
                    new2.append(line)
-               else:
+               elif not check_token(line, "\\latex"):
                    tmp.append(line)
 
            if is_empty(tmp):
@@ -268,27 +268,19 @@ def remove_oldert(lines):
        lines[i:j+1] = new
        i = i+1
 
-def convert_ertinset(lines):
+def remove_oldertinset(lines):
     i = 0
     while 1:
        i = find_token(lines, "\\begin_inset ERT", i)
        if i == -1:
            break
-       j = find_token(lines, "collapsed", i+1)
-       if string.split(lines[j])[1] == "true":
-           status = "Collapsed"
-       else:
-           status = "Open"
-       lines[j] = "status " + status
-
-       # Remove font commands
        j = find_end_of_inset(lines, i)
-       new = []
-       for line in lines[i:j]:
-           if not font_rexp.match(line) and not check_token(line, "\\latex"):
-               new.append(line)
-       lines[i:j] = new
-
+       k = find_token(lines, "\\layout", i+1)
+       l = get_paragraph(lines, i)
+       if lines[k] == lines[l]: # same layout
+           k = k+1
+       new = lines[k:j]
+       lines[i:j+1] = new
        i = i+1
 
 def is_ert_paragraph(lines, i):
@@ -409,7 +401,7 @@ def convert(header, body):
        language = "english"
 
     change_preamble(header)
-    convert_ertinset(body)
+    remove_oldertinset(body)
     remove_oldert(body)
     combine_ert(body)
     remove_oldminipage(body)
index ac78b93a03a7c46cb48bdda659bcc6217d14b4a2..b01a8c83b1c94b13199c152fed302594b80b0c7b 100644 (file)
@@ -92,14 +92,15 @@ def get_paragraph(lines, i):
 def find_end_of_inset(lines, i):
     count = 1
     i = i+1
-    while count > 0:
+    while 1:
        i = find_tokens(lines, ["\\end_inset", "\\begin_inset"], i)
        if check_token(lines[i], "\\begin_inset"):
            count = count+1
        else:
            count = count-1
+       if count == 0:
+           return i
        i = i+1
-    return i
 
 def is_nonempty_line(line):
     return line != " "*len(line)