From: Dekel Tsur Date: Thu, 12 Sep 2002 15:10:23 +0000 (+0000) Subject: Simplify code X-Git-Tag: 1.6.10~18287 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0ed17fdba38ac4178cbcccc01cfe5e44cae732b4;p=features.git Simplify code git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5287 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 5e7f40457d..e5dc053255 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,6 +1,7 @@ 2002-09-12 Dekel Tsur * lyx2lyx/lyxconvert_218.py (remove_oldfloat): Convert floatingfigure. + (remove_oldminipage): Simplified. 2002-09-10 José Matos diff --git a/lib/lyx2lyx/lyxconvert_218.py b/lib/lyx2lyx/lyxconvert_218.py index 4e64d252b5..794cab76b3 100644 --- a/lib/lyx2lyx/lyxconvert_218.py +++ b/lib/lyx2lyx/lyxconvert_218.py @@ -56,10 +56,11 @@ pextra_rexp = re.compile(r"\\pextra_type\s+(\S+)"+\ r"(\s+(\\pextra_widthp?)\s+(\S*))?") def get_width(mo): - if mo.group(9) == "\\pextra_widthp": - return mo.group(10)+"col%" - elif mo.group(10): - return mo.group(10) + if mo.group(10): + if mo.group(9) == "\\pextra_widthp": + return mo.group(10)+"col%" + else: + return mo.group(10) else: return "100col%" @@ -157,11 +158,9 @@ def remove_oldminipage(lines): j = find_token_backwards(lines,"\\layout", i-1) j0 = j - mid = lines[j:i] j = find_tokens(lines, ["\\layout", "\\end_float"], i+1) - # j can be -1, but this is still ok - mid = mid+lines[i+1:j] + # j can be -1 count = 0 while 1: @@ -178,11 +177,10 @@ def remove_oldminipage(lines): if mo.group(7) == "1": flag = 1 break - j = find_token_backwards(lines,"\\layout", i-1) - mid = mid+lines[j:i] + lines[i] = re.sub(pextra_rexp, "", lines[i]) j = find_tokens(lines, ["\\layout", "\\end_float"], i+1) - mid = mid+lines[i+1:j] + mid = lines[j0:j] end = ["\\end_inset "] lines[j0:j] = start+mid+end