]> git.lyx.org Git - lyx.git/commitdiff
Fix reversion of beamer documents.
authorEnrico Forestieri <forenr@lyx.org>
Mon, 19 May 2014 17:39:51 +0000 (19:39 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 19 May 2014 17:39:51 +0000 (19:39 +0200)
Beamer documents do not have a "--Separator--" layout but a
"Separator" one. Also fix a thinko causing the deletion of
"\end_layout" tags in some cases.

lib/lyx2lyx/lyx_2_2.py

index 99236ffa110ac6a9e44fe72848a9496e3671dc3e..64ff1086b48511b24828905981b110313ad50751 100644 (file)
@@ -144,7 +144,13 @@ def convert_separator(document):
 def revert_separator(document):
     " Revert separator insets to layout separators "
 
-    parsep = ["\\begin_layout --Separator--", "", "\\end_layout", ""]
+    beamer_classes = ["beamer", "article-beamer", "scrarticle-beamer"]
+    if document.textclass in beamer_classes:
+        beglaysep = "\\begin_layout Separator"
+    else:
+        beglaysep = "\\begin_layout --Separator--"
+
+    parsep = [beglaysep, "", "\\end_layout", ""]
     comert = ["\\begin_inset ERT", "status collapsed", "",
               "\\begin_layout Plain Layout", "%", "\\end_layout",
               "", "\\end_inset", ""]
@@ -222,15 +228,18 @@ def revert_separator(document):
                         and not check_token(document.body[k], "\\end_deeper") \
                         and not check_token(document.body[k], "\\begin_deeper"):
                     if layoutname == "Standard":
-                        document.body[beg:j+1] = ["\\begin_layout --Separator--"]
+                        document.body[beg:j+1] = [beglaysep]
                         i = i + 1
                     else:
-                        document.body[beg:j+1] = ["\\begin_deeper", "\\begin_layout --Separator--"]
+                        document.body[beg:j+1] = ["\\begin_deeper", beglaysep]
                         end = end + 2 - (j + 1 - beg)
                         document.body[end+1:end+1] = ["", "\\end_deeper", ""]
                         i = i + 3
                 else:
-                    del document.body[i:end+1]
+                    if something_before:
+                        del document.body[i:end+1]
+                    else:
+                        del document.body[i:end-1]
 
         i = i + 1