]> git.lyx.org Git - features.git/commitdiff
Small changes
authorDekel Tsur <dekelts@tau.ac.il>
Sat, 10 Aug 2002 13:34:57 +0000 (13:34 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Sat, 10 Aug 2002 13:34:57 +0000 (13:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4929 a592a061-630c-0410-9148-cb99ea01b6c8

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

index abe1c12f45812734e9f6001e58a69d7a2cd8d5cd..346916d496c35eee6e0eb3b94ac9bfcbdf97ba1f 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-10  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * lyx2lyx/parser_tools.py (get_paragraph): Fixed.
+
+       * lyx2lyx/lyxconvert_218.py (convert_ertinset): Remove font commands.
+
 2002-08-08  Herbert Voss  <voss@perce.de>
 
        * ui/default.ui: put gather into math menu
index 996788f99533c9a2d612ff07bf93efd7b1f754f6..9a6db44ba702f2101eccf83dc02aa7dcd851711e 100644 (file)
@@ -190,7 +190,7 @@ def remove_oldert(lines):
            j = find_tokens(lines, ["\\latex default", "\\begin_inset", "\\layout", "\\end_float", "\\the_end"],
                            j)
            if check_token(lines[j], "\\begin_inset"):
-               j = skip_inset(lines, j)
+               j = find_end_of_inset(lines, j)
            else:
                break
 
@@ -243,7 +243,7 @@ def remove_oldert(lines):
                new = new+ert_begin+tmp+["\\end_inset ", ""]
 
            if inset:
-               k3 = find_token(lines, "\\end_inset", k2+1)
+               k3 = find_end_of_inset(lines, k2)
                new = new+[""]+lines[k2:k3+1]+[""] # Put an empty line after \end_inset
                k = k3+1
                # Skip the empty line after \end_inset
@@ -280,13 +280,22 @@ def convert_ertinset(lines):
        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
+
        i = i+1
 
 def is_ert_paragraph(lines, i):
     i = find_nonempty_line(lines, i+1)
     if not check_token(lines[i], "\\begin_inset ERT"):
        return 0
-    j = find_token(lines, "\\end_inset", i)
+    j = find_end_of_inset(lines, i)
     k = find_nonempty_line(lines, j+1)
     return check_token(lines[k], "\\layout")
 
@@ -334,7 +343,7 @@ def remove_figinset(lines):
        i = find_token(lines, "\\begin_inset Figure", i)
        if i == -1:
            break
-       j = find_token(lines, "\\end_inset", i+1)
+       j = find_end_of_inset(lines, i)
 
        lyxwidth = string.split(lines[i])[3]+"pt"
        lyxheight = string.split(lines[i])[4]+"pt"
index d657ba9f564a8c492bb348fe40fc4104e08b4bff..ac78b93a03a7c46cb48bdda659bcc6217d14b4a2 100644 (file)
@@ -74,6 +74,7 @@ def get_value(lines, token, start, end = 0):
     return string.split(lines[i])[1]
 
 # Finds the paragraph that contains line i.
+import sys
 def get_paragraph(lines, i):
     while 1:
        i = find_tokens_backwards(lines, ["\\end_inset", "\\layout"], i)
@@ -81,15 +82,14 @@ def get_paragraph(lines, i):
            return i
        count = 1
        while count > 0:
-           i = find_tokens_backwards(lines, ["\\end_inset", "\\begin_inset"], i)
+           i = find_tokens_backwards(lines, ["\\end_inset", "\\begin_inset"], i-1)
            if check_token(lines[i], "\\end_inset"):
                count = count+1
            else:
                count = count-1
-       i = i-1
 
 # Finds the matching \end_inset
-def skip_inset(lines, i):
+def find_end_of_inset(lines, i):
     count = 1
     i = i+1
     while count > 0: