]> git.lyx.org Git - features.git/commitdiff
Fix reverting of chunks insets to 2.0 format
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 27 Nov 2014 15:30:00 +0000 (16:30 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 27 Nov 2014 15:32:58 +0000 (16:32 +0100)
When the chunk inset did not have an optional argument, the prefix of the chunk was omitted.

Fixes bug: #9343

lib/lyx2lyx/lyx_2_1.py

index 2d523dbcfd66296dab3fb5b62b6312e1eefee5b6..76156d2fa1cddc6a855af89a67fe7b70835159f7 100644 (file)
@@ -4688,7 +4688,7 @@ def revert_chunks(document):
             continue
 
         # Look for optional argument
-        have_optarg = False
+        optarg = ""
         ostart = find_token(document.body, "\\begin_inset Argument 1", i, iend)
         if ostart != -1:
             oend = find_end_of_inset(document.body, ostart)
@@ -4698,7 +4698,6 @@ def revert_chunks(document):
             else:
                 m = find_end_of_layout(document.body, k)
                 optarg = "".join(document.body[k+1:m])
-                have_optarg = True
 
             # We now remove the optional argument, so we have something
             # uniform on which to work
@@ -4727,8 +4726,7 @@ def revert_chunks(document):
             k = j
         # we now need to wrap all of these paragraphs in chunks
         newlines = []
-        if have_optarg:
-            newlines.extend(["\\begin_layout Chunk", "", "<<" + optarg + ">>=", "\\end_layout", ""])
+        newlines.extend(["\\begin_layout Chunk", "", "<<" + optarg + ">>=", "\\end_layout", ""])
         for stuff in parlist:
             newlines.extend(["\\begin_layout Chunk"] + stuff + ["\\end_layout", ""])
         newlines.extend(["\\begin_layout Chunk", "", "@", "\\end_layout", ""])