From 959ad0b25086c629caa3ebfbde7aaba35ab58d91 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 16 Sep 2014 17:42:19 +0200 Subject: [PATCH] Fix some convert_TeX_brace_to_Argument glitches Fixes: #9273 --- lib/lyx2lyx/lyx_2_1.py | 16 +++++++++++++--- status.21x | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index d9bedf4056..289a4d4b85 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -229,10 +229,18 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment, o else: opening = find_token(document.body, "{", lineERT, end_ERT) if opening != -1: - document.body[lineERT : end_ERT + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] - n += 1 lineERT2 = find_token(document.body, "\\begin_inset ERT", end_ERT, end_layout) - if lineERT2 != -1: + if lineERT2 == -1: + # argument in a single ERT + # strip off the opening bracket + document.body[opening] = document.body[opening][1:] + ertcontlastline = end_ERT - 3 + if (opt and document.body[ertcontlastline].endswith("]")) or document.body[ertcontlastline].endswith("}"): + # strip off the closing bracket + document.body[ertcontlastline] = document.body[ertcontlastline][:-1] + end2 = find_token(document.body, "\\end_inset", ertcontlastline) + document.body[lineERT : lineERT + 1] = ["\\begin_inset Argument " + str(n)] + else: end_ERT2 = find_end_of_inset(document.body, lineERT2) if end_ERT2 == -1: document.warning("Can't find end of second ERT!!") @@ -244,6 +252,8 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment, o if closing != -1: # assure that the "}" is in this ERT end2 = find_token(document.body, "\\end_inset", closing) document.body[lineERT2 : end2 + 1] = ["\\end_layout", "", "\\end_inset"] + document.body[lineERT : end_ERT + 1] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"] + n += 1 ############################################################################### diff --git a/status.21x b/status.21x index de54c03265..0b8191fee7 100644 --- a/status.21x +++ b/status.21x @@ -56,11 +56,14 @@ What's new * LYX2LYX +- Fix import of LyX 2.0 documents with complex beamer arguments (bug 9254). + +- Fix import of LyX 2.0 IEEEtran documents (bug 9773). * USER INTERFACE -- Fix alignment rendering of multirow in LyX (#8976) +- Fix alignment rendering of multirow in LyX (bug 8976). * INTERNALS -- 2.39.5