From 5a21d3f0f8fbf49b53a08c886c873c5145ae6379 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 13 Feb 2015 17:45:38 +0100 Subject: [PATCH] Fix reversion of beamer description overlay args --- lib/lyx2lyx/lyx_2_1.py | 18 ++++++++++++++++-- status.21x | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 029b54d995..798a36b9b1 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -2705,8 +2705,22 @@ def revert_beamerargs(document): endPlain = find_end_of_layout(document.body, beginPlain) content = document.body[beginPlain + 1 : endPlain] del document.body[i:j+1] - subst = put_cmd_in_ert("[") + content + put_cmd_in_ert("]") - document.body[realparbeg : realparbeg] = subst + if layoutname == "Description": + # Description only has one (overlay) item arg + subst = put_cmd_in_ert("<") + content + put_cmd_in_ert(">") + # This must be put after the first space (begin of decription body + # in LyX's arkward description list syntax) + # Try to find that place ... + rxx = re.compile(r'^([^\\ ]+ )(.*)$') + for q in range(parbeg, parend): + m = rxx.match(document.body[q]) + if m: + # We found it. Now insert the ERT argument just there: + document.body[q : q] = [m.group(1), ''] + subst + ['', m.group(2)] + break + else: + subst = put_cmd_in_ert("[") + content + put_cmd_in_ert("]") + document.body[realparbeg : realparbeg] = subst elif argnr == "item:2": j = find_end_of_inset(document.body, i) # Find containing paragraph layout diff --git a/status.21x b/status.21x index a41260b20e..9ea7294afc 100644 --- a/status.21x +++ b/status.21x @@ -57,6 +57,8 @@ What's new - Fix wrong listings preamble encoding (bug 9382). +- Fix reversion of beamer description overlay arguments. + * LYX2LYX -- 2.39.5