From 8d898ad5b7a2c910fd39679cf4dfb57ccbbbf39b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 21 Jul 2009 17:48:03 +0000 Subject: [PATCH] * lyx_2_0.py (revert_hspace_glue_lengths): - proceed after non-glue hspace. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30739 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index d7dc87a0d5..6e2e310338 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1022,7 +1022,7 @@ def revert_percent_hspace_lengths(document): if i == -1: break star = (document.body[i].find("\\hspace*{}") != -1) - # only revert if a custom length was set and when + # only revert if a custom length was set and if # it used a percent length length = get_value(document.body, '\\length', i+1) if length == '': @@ -1057,18 +1057,17 @@ def revert_hspace_glue_lengths(document): return # only revert if the length contains a plus or minus at pos != 0 glue = re.compile(r'.+[\+-]') - if glue.search(length) == None: - break - # handle percent lengths - length = latex_length(length) - # latex_length returns "bool,length" - length = length.split(",")[1] - # revert the HSpace inset to ERT - if star == True: - subst = [put_cmd_in_ert("\\hspace*{" + length + "}")] - else: - subst = [put_cmd_in_ert("\\hspace{" + length + "}")] - document.body[i:i+3] = subst + if glue.search(length): + # handle percent lengths + length = latex_length(length) + # latex_length returns "bool,length" + length = length.split(",")[1] + # revert the HSpace inset to ERT + if star == True: + subst = [put_cmd_in_ert("\\hspace*{" + length + "}")] + else: + subst = [put_cmd_in_ert("\\hspace{" + length + "}")] + document.body[i:i+3] = subst i = i + 2 -- 2.39.2