]> git.lyx.org Git - features.git/commitdiff
Georg's patch enabled lyx2lyx to find the collapsed status of Box insets
authorAngus Leeming <leeming@lyx.org>
Fri, 19 Dec 2003 21:38:07 +0000 (21:38 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 19 Dec 2003 21:38:07 +0000 (21:38 +0000)
but Floats were failing due to the presence of 'wide false'. Rather
than special case again, I wrote a more robust method to find the
collapsed status.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8270 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/ChangeLog
lib/lyx2lyx/lyxconvert_227.py
lib/lyx2lyx/lyxrevert_228.py

index 6f17be177431de11fb306a37801d2e326218d3b7..ec5692105d91c63ec08335e284ee3730d655c738 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-19  Angus Leeming  <leeming@lyx.org>
+
+       * lyxconvert_227.py (convert_collapsable): 
+       * lyxrevert_228.py (convert_collapsable): a more robust method of
+       finding the collapsed status.
+
 2003-12-18  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * lyxrevert_228.py: fix box status conversion
index 89c5fa907f50832239df8e5b5d1990d4a92990e1..9d7f557f24e98537e834ce08e93ec412f1c0286e 100644 (file)
@@ -33,18 +33,21 @@ def convert_collapsable(lines):
         if i == -1:
             break
 
-        if lines[i][:16] == "\\begin_inset Box":
-            # Skip box parameters
-            i = i + 10
-        else:
-            # We are interested in the next line
+        # Seach for a line starting 'collapsed'
+        # If, however, we find a line starting '\layout' (_always_ present)
+        # then break with a warning message
+        i = i + 1
+        while 1:
+            if (lines[i] == "collapsed false"):
+                lines[i] = "status open"
+                break
+            elif (lines[i] == "collapsed true"):
+                lines[i] = "status collapsed"
+                break
+            elif (lines[i][:7] == "\\layout"):
+                sys.stderr.write("Malformed lyx file\n")
+                break
             i = i + 1
-        if (lines[i] == "collapsed false"):
-            lines[i] = "status open"
-        elif (lines[i] == "collapsed true"):
-            lines[i] = "status collapsed"
-        else:
-            sys.stderr.write("Malformed lyx file\n")
 
         i = i + 1
 
index 646b0f4d0dcb90f8a2ccaeb005e061eb65ca3459..1f74e9812c9459110df075b465c683a30dab3308 100644 (file)
@@ -33,19 +33,23 @@ def convert_collapsable(lines):
         if i == -1:
             break
 
-        if lines[i][:16] == "\\begin_inset Box":
-            # Skip box parameters
-            i = i + 10
-        else:
-            # We are interested in the next line
+        # Seach for a line starting 'collapsed'
+        # If, however, we find a line starting '\layout' (_always_ present)
+        # then break with a warning message
+        i = i + 1
+        while 1:
+            if (lines[i] == "status open"):
+                lines[i] = "collapsed false"
+                lines[i] = "collapsed false"
+                break
+            elif (lines[i] == "status collapsed" or
+                  lines[i] == "status inlined"):
+                lines[i] = "collapsed true"
+                break
+            elif (lines[i][:13] == "\\begin_layout"):
+                sys.stderr.write("Malformed lyx file\n")
+                break
             i = i + 1
-        if (lines[i] == "status open"):
-            lines[i] = "collapsed false"
-        elif (lines[i] == "status collapsed" or
-              lines[i] == "status inlined"):
-            lines[i] = "collapsed true"
-        else:
-            sys.stderr.write("Malformed lyx file\n")
 
         i = i + 1