From 62c09c9630cbd6ead4939c8c13c6d09d9f352160 Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Tue, 15 Jul 2003 14:04:35 +0000 Subject: [PATCH] Fix handling of \hfill inside ERT. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7281 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 5 +++++ lib/lyx2lyx/lyxconvert_218.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 34d3f2456b..0962d3e0a5 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-07-15 Dekel Tsur + + * lyx2lyx/lyxconvert_218.py (remove_oldert): Fix handling of + \hfill inside ERT. + 2003-07-09 Juergen Spitzmueller * CREDITS: update. diff --git a/lib/lyx2lyx/lyxconvert_218.py b/lib/lyx2lyx/lyxconvert_218.py index 9b983d2d32..a0a0c50ed0 100644 --- a/lib/lyx2lyx/lyxconvert_218.py +++ b/lib/lyx2lyx/lyxconvert_218.py @@ -195,7 +195,7 @@ def is_empty(lines): return filter(is_nonempty_line, lines) == [] move_rexp = re.compile(r"\\(family|series|shape|size|emph|numeric|bar|noun|end_deeper)") -ert_rexp = re.compile(r"\\begin_inset|.*\\SpecialChar") +ert_rexp = re.compile(r"\\begin_inset|\\hfill|.*\\SpecialChar") spchar_rexp = re.compile(r"(.*)(\\SpecialChar.*)") ert_begin = ["\\begin_inset ERT", "status Collapsed", @@ -233,11 +233,15 @@ def remove_oldert(lines): k = i+1 while 1: k2 = find_re(lines, ert_rexp, k, j) - inset = specialchar = 0 + inset = hfill = specialchar = 0 if k2 == -1: k2 = j elif check_token(lines[k2], "\\begin_inset"): inset = 1 + elif check_token(lines[k2], "\\hfill"): + hfill = 1 + del lines[k2] + j = j-1 else: specialchar = 1 mo = spchar_rexp.match(lines[k2]) @@ -276,6 +280,9 @@ def remove_oldert(lines): if not is_nonempty_line(lines[k]): k = k+1 new.append("") + elif hfill: + new = new+["\hfill", ""] + k = k2 elif specialchar: if new == []: # This is not necessary, but we want the output to be -- 2.39.2