Fix handling of \hfill inside ERT.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7281 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2003-07-15 14:04:35 +00:00
parent dc85736c7f
commit 62c09c9630
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2003-07-15 Dekel Tsur <dekelts@tau.ac.il>
* lyx2lyx/lyxconvert_218.py (remove_oldert): Fix handling of
\hfill inside ERT.
2003-07-09 Juergen Spitzmueller <j.spitzmueller@gmx.de> 2003-07-09 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* CREDITS: update. * CREDITS: update.

View File

@ -195,7 +195,7 @@ def is_empty(lines):
return filter(is_nonempty_line, lines) == [] return filter(is_nonempty_line, lines) == []
move_rexp = re.compile(r"\\(family|series|shape|size|emph|numeric|bar|noun|end_deeper)") 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.*)") spchar_rexp = re.compile(r"(.*)(\\SpecialChar.*)")
ert_begin = ["\\begin_inset ERT", ert_begin = ["\\begin_inset ERT",
"status Collapsed", "status Collapsed",
@ -233,11 +233,15 @@ def remove_oldert(lines):
k = i+1 k = i+1
while 1: while 1:
k2 = find_re(lines, ert_rexp, k, j) k2 = find_re(lines, ert_rexp, k, j)
inset = specialchar = 0 inset = hfill = specialchar = 0
if k2 == -1: if k2 == -1:
k2 = j k2 = j
elif check_token(lines[k2], "\\begin_inset"): elif check_token(lines[k2], "\\begin_inset"):
inset = 1 inset = 1
elif check_token(lines[k2], "\\hfill"):
hfill = 1
del lines[k2]
j = j-1
else: else:
specialchar = 1 specialchar = 1
mo = spchar_rexp.match(lines[k2]) mo = spchar_rexp.match(lines[k2])
@ -276,6 +280,9 @@ def remove_oldert(lines):
if not is_nonempty_line(lines[k]): if not is_nonempty_line(lines[k]):
k = k+1 k = k+1
new.append("") new.append("")
elif hfill:
new = new+["\hfill", ""]
k = k2
elif specialchar: elif specialchar:
if new == []: if new == []:
# This is not necessary, but we want the output to be # This is not necessary, but we want the output to be