X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flyx2lyx%2Flyx_2_1.py;h=84f376a52fd95698a22f145a20b8d3720e801df9;hb=e798db5739871aaa29f95de321c52f19058064c9;hp=fe5f9d69932ca2ab47e632609873f1e72391825b;hpb=61b54f87df86ad2ea76ac03f40278a16836f8626;p=lyx.git diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index fe5f9d6993..84f376a52f 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -219,6 +219,13 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment, o else: lineERT += 1 if environment == True: + # FIXME This version of the routine does not check for and pass over + # arguments before n. So it attempts to process the argument in the + # document, no matter what has been specified. + # + # The other branch does do that, but probably that code would be better + # in a single location: Skip all those arguments, then process the ones + # we want. end_ERT = find_end_of_inset(document.body, lineERT) if end_ERT == -1: document.warning("Can't find end of ERT!!") @@ -254,6 +261,9 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment, o 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 + else: + document.warning("Unable to process argument!") + n += 1 ############################################################################### @@ -838,7 +848,7 @@ def revert_verbatim(document, starred = False): 'begin{%s}' % (latex_name), '\\end_layout', '', '\\begin_layout Plain Layout', ''] - while 1: + while True: i = find_token(document.body, "\\begin_layout %s" % (layout_name), i) if i == -1: return @@ -850,7 +860,7 @@ def revert_verbatim(document, starred = False): continue # delete all line breaks insets (there are no other insets) l = i - while 1: + while True: n = find_token(document.body, "\\begin_inset Newline newline", l, j) if n == -1: n = find_token(document.body, "\\begin_inset Newline linebreak", l, j) @@ -898,7 +908,7 @@ def revert_verbatim(document, starred = False): def revert_tipa(document): " Revert native TIPA insets to mathed or ERT. " i = 0 - while 1: + while True: i = find_token(document.body, "\\begin_inset IPA", i) if i == -1: return @@ -970,7 +980,7 @@ def revert_cell_rotation(document): finally: if load_rotating: - add_to_preamble(document, ["\\@ifundefined{turnbox}{\usepackage{rotating}}{}"]) + add_to_preamble(document, ["\\@ifundefined{turnbox}{\\usepackage{rotating}}{}"]) def convert_cell_rotation(document): @@ -1029,7 +1039,7 @@ def revert_table_rotation(document): finally: if load_rotating: - add_to_preamble(document, ["\\@ifundefined{turnbox}{\usepackage{rotating}}{}"]) + add_to_preamble(document, ["\\@ifundefined{turnbox}{\\usepackage{rotating}}{}"]) def convert_table_rotation(document):