From: Juergen Spitzmueller Date: Fri, 23 Nov 2012 09:29:29 +0000 (+0100) Subject: half-functional lyx2lyx reversion X-Git-Tag: 2.1.0beta1~1231 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b33b352171813f99a8fbf8e8b6f6c445025d94f8;p=features.git half-functional lyx2lyx reversion This assures reverted files can be opened. However, the argument insets are not yet reordered (see FIXME) --- diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 38c399f9ad..f9b0266a6e 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -1148,12 +1148,22 @@ def convert_latexargs(document): def revert_latexargs(document): " Revert InsetArgument to old syntax " + # FIXME: This method does not revert correctly (it does + # not reorder the arguments) # What needs to be done is this: # * find all arguments in a paragraph and reorder them # according to their ID (which is deleted) # So: \\begin_inset Argument 2 ... \\begin_inset Argument 1 # => \\begin_inset Argument ... \\begin_inset Argument # with correct order. + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Argument", i) + if i == -1: + return + # Convert the syntax so that LyX 2.0 can at least open this + document.body[i] = "\\begin_inset Argument" + i = i + 1 ##