From 36afcb3f8e27163d272c27784b501190b6300c89 Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Fri, 11 Oct 2002 18:08:21 +0000 Subject: [PATCH] Fix bug reported by Martin. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5385 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyxconvert_218.py | 6 ++++-- lib/lyx2lyx/parser_tools.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyxconvert_218.py b/lib/lyx2lyx/lyxconvert_218.py index d94de6f4c8..4b94a5388a 100644 --- a/lib/lyx2lyx/lyxconvert_218.py +++ b/lib/lyx2lyx/lyxconvert_218.py @@ -213,10 +213,12 @@ def remove_oldert(lines): break j = i+1 while 1: - j = find_tokens(lines, ["\\latex default", "\\begin_inset", "\\layout", "\\end_inset", "\\end_float", "\\the_end"], + # \end_inset is for ert inside a tabular cell. The other tokens + # are obvious. + j = find_tokens(lines, ["\\latex default", "\\layout", "\\begin_inset", "\\end_inset", "\\end_float", "\\the_end"], j) if check_token(lines[j], "\\begin_inset"): - j = find_end_of_inset(lines, j) + j = find_end_of_inset(lines, j)+1 else: break diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index b16648a821..61fafe8d8a 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -92,16 +92,18 @@ def del_token(lines, token, i, j): # Finds the paragraph that contains line i. def get_paragraph(lines, i): - while 1: + while i != -1: i = find_tokens_backwards(lines, ["\\end_inset", "\\layout"], i) + if i == -1: return -1 if check_token(lines[i], "\\layout"): return i i = find_beginning_of_inset(lines, i) # Finds the paragraph after the paragraph that contains line i. def get_next_paragraph(lines, i): - while 1: + while i != -1: i = find_tokens(lines, ["\\begin_inset", "\\layout"], i) + if i == -1: return -1 if check_token(lines[i], "\\layout"): return i i = find_end_of_inset(lines, i) -- 2.39.2