Angus Leeming wrote:
> What I meant was that this 'removal of InsetMinipage/conversion of
> InsetMinipage to InsetBox' is a format change and so should
> 1 be documented
> 2 be placed in its own lyx2lyx files, lyxconvert_228.py and
> lyxrevert_229.py.

Yes, this is certainly much cleaner.

> The bare bones lyxconvert_228.py and lyxrevert_229.py are pointless
> (as you say). Personally I'd move the conversion code into them. The
> more of these tiny files we have, the more likely José is to come up
> with a versioning system that separates file from format number ;-)

Is the attached better?

Jürgen.
Index: development/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/ChangeLog,v
retrieving revision 1.40
diff -u -r1.40 ChangeLog
--- development/ChangeLog	15 Dec 2003 22:04:31 -0000	1.40
+++ development/ChangeLog	29 Dec 2003 15:28:00 -0000
@@ -1,3 +1,7 @@
+2003-12-29  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
+
+	* FORMAT: document change to format 229.
+	
 2003-12-15  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* FORMAT: document change to format 228.
Index: development/FORMAT
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/FORMAT,v
retrieving revision 1.20
diff -u -r1.20 FORMAT
--- development/FORMAT	15 Dec 2003 22:04:31 -0000	1.20
+++ development/FORMAT	29 Dec 2003 15:28:01 -0000
@@ -1,6 +1,12 @@
 LyX file-format changes
 -----------------------
 
+2003-12-29  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
+
+	* format incremented to 229.
+	* Minipages cannot be read anymore. All minipage insets will
+	be converted to frameless box insets between 228->229.
+
 2003-12-15  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* format incremented to 228.
Index: lib/lyx2lyx/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/ChangeLog,v
retrieving revision 1.16
diff -u -r1.16 ChangeLog
--- lib/lyx2lyx/ChangeLog	29 Dec 2003 12:56:09 -0000	1.16
+++ lib/lyx2lyx/ChangeLog	29 Dec 2003 15:28:04 -0000
@@ -1,7 +1,9 @@
 2003-12-29  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
 
+	* lyx2lyx: up the format to 229.
 	* lyxconvert_224.py (convert_minipage): remove function...
-	* lyxconvert_227.py: ...and place it here.
+	* lyxconvert_228.py: ...and place it here.
+	* lyxrevert_229.py: new file (bare bones).
 
 2003-12-19  Angus Leeming  <[EMAIL PROTECTED]>
 
Index: lib/lyx2lyx/lyx2lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v
retrieving revision 1.20
diff -u -r1.20 lyx2lyx
--- lib/lyx2lyx/lyx2lyx	15 Dec 2003 22:04:31 -0000	1.20
+++ lib/lyx2lyx/lyx2lyx	29 Dec 2003 15:28:04 -0000
@@ -40,7 +40,7 @@
 
 format = re.compile(r"(\d)[\.,]?(\d\d)")
 fileformat = re.compile(r"\\lyxformat\s*(\S*)")
-lst_ft = [210, 215, 216, 217,  218, 220, 221, 223, 224, 225, 226, 227, 228]
+lst_ft = [210, 215, 216, 217,  218, 220, 221, 223, 224, 225, 226, 227, 228, 229]
 
 def usage():
     print """Usage: lyx2lyx [options] [file]
Index: lib/lyx2lyx/lyxconvert_227.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyxconvert_227.py,v
retrieving revision 1.5
diff -u -r1.5 lyxconvert_227.py
--- lib/lyx2lyx/lyxconvert_227.py	29 Dec 2003 12:56:10 -0000	1.5
+++ lib/lyx2lyx/lyxconvert_227.py	29 Dec 2003 15:28:04 -0000
@@ -16,7 +16,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 import sys
-from parser_tools import find_token, find_tokens
+from parser_tools import find_tokens
 
 def convert_collapsable(lines):
     i = 0
@@ -52,72 +52,8 @@
         i = i + 1
 
 
-def convert_minipage(lines):
-    """ Convert minipages to the box inset.
-    We try to use the same order of arguments as lyx does.
-    """
-    pos = ["t","c","b"]
-    inner_pos = ["c","t","b","s"]
-
-    i = 0
-    while 1:
-        i = find_token(lines, "\\begin_inset Minipage", i)
-        if i == -1:
-            return
-
-        lines[i] = "\\begin_inset Box Frameless"
-        i = i + 1
-
-        # convert old to new position using the pos list
-        if lines[i][:8] == "position":
-            lines[i] = 'position "%s"' % pos[int(lines[i][9])]
-        else:
-            lines.insert(i, 'position "%s"' % pos[0])
-        i = i + 1
-
-        lines.insert(i, 'hor_pos "c"')
-        i = i + 1
-        lines.insert(i, 'has_inner_box 1')
-        i = i + 1
-
-        # convert the inner_position
-        if lines[i][:14] == "inner_position":
-            lines[i] = 'inner_pos "%s"' %  inner_pos[int(lines[i][15])]
-        else:
-            lines.insert('inner_pos "%s"' % inner_pos[0])
-        i = i + 1
-
-        # We need this since the new file format has a height and width
-        # in a different order.
-        if lines[i][:6] == "height":
-            height = lines[i][6:]
-            # test for default value of 221 and convert it accordingly
-            if height == ' "0pt"':
-                height = ' "1pt"'
-            del lines[i]
-        else:
-            height = ' "1pt"'
-
-        if lines[i][:5] == "width":
-            width = lines[i][5:]
-            del lines[i]
-        else:
-            width = ' "0"'
-
-        lines.insert(i, 'use_parbox 0')
-        i = i + 1
-        lines.insert(i, 'width' + width)
-        i = i + 1
-        lines.insert(i, 'special "none"')
-        i = i + 1
-        lines.insert(i, 'height' + height)
-        i = i + 1
-        lines.insert(i, 'height_special "totalheight"')
-        i = i + 1
-
 def convert(header, body):
     convert_collapsable(body)
-    convert_minipage(body)
 
 if __name__ == "__main__":
     pass
Index: lib/lyx2lyx/lyxconvert_228.py
===================================================================
RCS file: lib/lyx2lyx/lyxconvert_228.py
diff -N lib/lyx2lyx/lyxconvert_228.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lib/lyx2lyx/lyxconvert_228.py	29 Dec 2003 15:28:05 -0000
@@ -0,0 +1,91 @@
+# This file is part of lyx2lyx
+# Copyright (C) 2003 José Matos <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+
+import sys
+from parser_tools import find_token
+
+
+def convert_minipage(lines):
+    """ Convert minipages to the box inset.
+    We try to use the same order of arguments as lyx does.
+    """
+    pos = ["t","c","b"]
+    inner_pos = ["c","t","b","s"]
+
+    i = 0
+    while 1:
+        i = find_token(lines, "\\begin_inset Minipage", i)
+        if i == -1:
+            return
+
+        lines[i] = "\\begin_inset Box Frameless"
+        i = i + 1
+
+        # convert old to new position using the pos list
+        if lines[i][:8] == "position":
+            lines[i] = 'position "%s"' % pos[int(lines[i][9])]
+        else:
+            lines.insert(i, 'position "%s"' % pos[0])
+        i = i + 1
+
+        lines.insert(i, 'hor_pos "c"')
+        i = i + 1
+        lines.insert(i, 'has_inner_box 1')
+        i = i + 1
+
+        # convert the inner_position
+        if lines[i][:14] == "inner_position":
+            lines[i] = 'inner_pos "%s"' %  inner_pos[int(lines[i][15])]
+        else:
+            lines.insert('inner_pos "%s"' % inner_pos[0])
+        i = i + 1
+
+        # We need this since the new file format has a height and width
+        # in a different order.
+        if lines[i][:6] == "height":
+            height = lines[i][6:]
+            # test for default value of 221 and convert it accordingly
+            if height == ' "0pt"':
+                height = ' "1pt"'
+            del lines[i]
+        else:
+            height = ' "1pt"'
+
+        if lines[i][:5] == "width":
+            width = lines[i][5:]
+            del lines[i]
+        else:
+            width = ' "0"'
+
+        lines.insert(i, 'use_parbox 0')
+        i = i + 1
+        lines.insert(i, 'width' + width)
+        i = i + 1
+        lines.insert(i, 'special "none"')
+        i = i + 1
+        lines.insert(i, 'height' + height)
+        i = i + 1
+        lines.insert(i, 'height_special "totalheight"')
+        i = i + 1
+
+def convert(header, body):
+    convert_minipage(body)
+
+if __name__ == "__main__":
+    pass
Index: lib/lyx2lyx/lyxrevert_229.py
===================================================================
RCS file: lib/lyx2lyx/lyxrevert_229.py
diff -N lib/lyx2lyx/lyxrevert_229.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lib/lyx2lyx/lyxrevert_229.py	29 Dec 2003 15:28:05 -0000
@@ -0,0 +1,24 @@
+# This file is part of lyx2lyx
+# Copyright (C) 2003 José Matos <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+
+def convert(header, body):
+    pass
+
+if __name__ == "__main__":
+    pass
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1760
diff -u -r1.1760 ChangeLog
--- src/ChangeLog	29 Dec 2003 13:55:41 -0000	1.1760
+++ src/ChangeLog	29 Dec 2003 15:28:29 -0000
@@ -1,3 +1,7 @@
+2003-12-29  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
+
+	* buffer.C: increment format to 229.
+
 2003-12-28  Michael Schmitt  <[EMAIL PROTECTED]>
 
 	* LaTeXFeatures.C:
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.551
diff -u -r1.551 buffer.C
--- src/buffer.C	15 Dec 2003 22:04:30 -0000	1.551
+++ src/buffer.C	29 Dec 2003 15:28:31 -0000
@@ -132,7 +132,7 @@
 
 namespace {
 
-const int LYX_FORMAT = 228;
+const int LYX_FORMAT = 229;
 
 } // namespace anon
 

Reply via email to