Simplify vspace reversion.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36044 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 12:51:57 +00:00
parent d423df4366
commit 53f88eea18

View File

@ -1020,11 +1020,12 @@ def revert_percent_vspace_lengths(document):
break
# only revert if a custom length was set and if
# it used a percent length
line = document.body[i]
r = re.compile(r'\\begin_inset VSpace (.*)$')
m = r.match(line)
m = r.match(document.body[i])
length = m.group(1)
if length not in ('defskip', 'smallskip', 'medskip', 'bigskip', 'vfill'):
if length in ('defskip', 'smallskip', 'medskip', 'bigskip', 'vfill'):
i += 1
continue
# check if the space has a star (protected space)
protected = (document.body[i].rfind("*") != -1)
if protected:
@ -1037,11 +1038,11 @@ def revert_percent_vspace_lengths(document):
# revert the VSpace inset to ERT
if percent == "True":
if protected:
subst = [old_put_cmd_in_ert("\\vspace*{" + length + "}")]
subst = put_cmd_in_ert("\\vspace*{" + length + "}")
else:
subst = [old_put_cmd_in_ert("\\vspace{" + length + "}")]
subst = put_cmd_in_ert("\\vspace{" + length + "}")
document.body[i:i + 2] = subst
i = i + 1
i += 1
def revert_percent_hspace_lengths(document):