From faaea50708b6e7e174fca2dabb420cb6e8440671 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 15 Dec 2003 22:04:31 +0000 Subject: [PATCH] Handle Michael's changes to InsetCollapsable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8255 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/ChangeLog | 4 +++ development/FORMAT | 8 ++++++ lib/lyx2lyx/ChangeLog | 7 +++++ lib/lyx2lyx/lyx2lyx | 2 +- lib/lyx2lyx/lyxconvert_227.py | 50 ++++++++++++++++++++++++++++++++++ lib/lyx2lyx/lyxrevert_228.py | 51 +++++++++++++++++++++++++++++++++++ src/ChangeLog | 6 ++++- src/buffer.C | 2 +- 8 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 lib/lyx2lyx/lyxconvert_227.py create mode 100644 lib/lyx2lyx/lyxrevert_228.py diff --git a/development/ChangeLog b/development/ChangeLog index 67eb3065ae..d4f7cff291 100644 --- a/development/ChangeLog +++ b/development/ChangeLog @@ -1,3 +1,7 @@ +2003-12-15 Angus Leeming + + * FORMAT: document change to format 228. + 2003-12-10 Angus Leeming * FORMAT: document the addition of a 'draft' option to InsetExternal. diff --git a/development/FORMAT b/development/FORMAT index d8bec3d94c..b4764b86f5 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,14 @@ LyX file-format changes ----------------------- +2003-12-15 Angus Leeming + + * format incremented to 228. + * Change the output of all insets derived from InsetCollapsable + except for InsetERT (which has this output already), changing lines + "collapsed true" -> "status collapsed" + "collapsed false" -> "status open". + 2003-12-10 Angus Leeming * format NOT incremented. diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index 1aaa3bfe93..9ec1d4f64a 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,10 @@ +2003-12-15 Angus Leeming + + * lyx2lyx: + * lyxconvert_227.py: + * lyxrevert_228.py: convert the InsetCollapsable format between + formats 227 and 228. + 2003-12-10 Angus Leeming * lyxrevert_227.py: InsetExternal gains a 'draft' option, so remove diff --git a/lib/lyx2lyx/lyx2lyx b/lib/lyx2lyx/lyx2lyx index c314816c5f..1a45dbe0db 100755 --- a/lib/lyx2lyx/lyx2lyx +++ b/lib/lyx2lyx/lyx2lyx @@ -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] diff --git a/lib/lyx2lyx/lyxconvert_227.py b/lib/lyx2lyx/lyxconvert_227.py new file mode 100644 index 0000000000..6f6fbf06e9 --- /dev/null +++ b/lib/lyx2lyx/lyxconvert_227.py @@ -0,0 +1,50 @@ +# This file is part of lyx2lyx +# Copyright (C) 2003 José Matos +# +# 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 diff --git a/lib/lyx2lyx/lyxrevert_228.py b/lib/lyx2lyx/lyxrevert_228.py new file mode 100644 index 0000000000..8357d72cf3 --- /dev/null +++ b/lib/lyx2lyx/lyxrevert_228.py @@ -0,0 +1,51 @@ +# This file is part of lyx2lyx +# Copyright (C) 2003 José Matos +# +# 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 diff --git a/src/ChangeLog b/src/ChangeLog index 7a4510e9ca..273a5cd436 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,11 @@ +2003-12-15 Angus Leeming + + * buffer.C: up the format to 228. 2003-12-15 André Pönitz - * cursor_slice.[Ch]: new class to cover texted and mathed's cursor slices + * cursor_slice.[Ch]: new class to cover texted and mathed's cursor + slices * Makefile.am: diff --git a/src/buffer.C b/src/buffer.C index 53c5b39230..30a42b39da 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -132,7 +132,7 @@ extern BufferList bufferlist; namespace { -const int LYX_FORMAT = 227; +const int LYX_FORMAT = 228; } // namespace anon -- 2.39.5