The attached patch ups the lyx format to 228 and uses this change to
trigger lyx2lyx into acting on lyxconvert_227.py (also in the patch).
I think that I've covered all the InsetCollabsable-derived insets but
please check.
Regards,
--
Angus
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.550
diff -u -p -r1.550 buffer.C
--- src/buffer.C 10 Dec 2003 21:48:38 -0000 1.550
+++ src/buffer.C 15 Dec 2003 16:49:46 -0000
@@ -132,7 +132,7 @@ extern BufferList bufferlist;
namespace {
-const int LYX_FORMAT = 227;
+const int LYX_FORMAT = 228;
} // namespace anon
Index: lib/lyx2lyx/lyx2lyx
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/lyx2lyx/lyx2lyx,v
retrieving revision 1.19
diff -u -p -r1.19 lyx2lyx
--- lib/lyx2lyx/lyx2lyx 10 Dec 2003 21:48:37 -0000 1.19
+++ lib/lyx2lyx/lyx2lyx 15 Dec 2003 16:49:46 -0000
@@ -40,7 +40,7 @@ opt.quiet = 0
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]
+lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228]
def usage():
print """Usage: lyx2lyx [options] [file]
Index: lib/lyx2lyx/lyxconvert_227.py
===================================================================
RCS file: lib/lyx2lyx/lyxconvert_227.py
diff -N lib/lyx2lyx/lyxconvert_227.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/lyx2lyx/lyxconvert_227.py 15 Dec 2003 16:49:46 -0000
@@ -0,0 +1,50 @@
+# 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.
+
+from parser_tools import find_tokens
+
+def convert_collapsable(lines):
+ i = 0
+ while 1:
+ i = find_tokens(lines, ["\\begin_inset Box",
+ "\\begin_inset Branch",
+ "\\begin_inset CharStyle",
+ "\\begin_inset Float",
+ "\\begin_inset Foot",
+ "\\begin_inset Marginal",
+ "\\begin_inset Note",
+ "\\begin_inset OptArg",
+ "\\begin_inset Wrap"], i)
+ if i == -1:
+ break
+
+ # We are interested in the next line
+ 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
+
+def convert(header, body):
+ convert_collapsable(body)
+
+if __name__ == "__main__":
+ pass
Index: lib/lyx2lyx/lyxrevert_228.py
===================================================================
RCS file: lib/lyx2lyx/lyxrevert_228.py
diff -N lib/lyx2lyx/lyxrevert_228.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/lyx2lyx/lyxrevert_228.py 15 Dec 2003 16:49:46 -0000
@@ -0,0 +1,51 @@
+# 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.
+
+from parser_tools import find_tokens
+
+def convert_collapsable(lines):
+ i = 0
+ while 1:
+ i = find_tokens(lines, ["\\begin_inset Box",
+ "\\begin_inset Branch",
+ "\\begin_inset CharStyle",
+ "\\begin_inset Float",
+ "\\begin_inset Foot",
+ "\\begin_inset Marginal",
+ "\\begin_inset Note",
+ "\\begin_inset OptArg",
+ "\\begin_inset Wrap"], i)
+ if i == -1:
+ break
+
+ # We are interested in the next line
+ 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
+
+def convert(header, body):
+ convert_collapsable(body)
+
+if __name__ == "__main__":
+ pass