change the file format number to 229 for the sake of a cleaner minipage/box conversion

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8287 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2003-12-29 15:49:50 +00:00
parent b02ecd9f24
commit 260a79e3a5
9 changed files with 135 additions and 68 deletions

View File

@ -1,3 +1,7 @@
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FORMAT: document change to format 229.
2003-12-15 Angus Leeming <leeming@lyx.org>
* FORMAT: document change to format 228.

View File

@ -1,6 +1,12 @@
LyX file-format changes
-----------------------
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* 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 <leeming@lyx.org>
* format incremented to 228.

View File

@ -1,7 +1,9 @@
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* 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 <leeming@lyx.org>

View File

@ -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, 228]
lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229]
def usage():
print """Usage: lyx2lyx [options] [file]

View File

@ -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 @@ def convert_collapsable(lines):
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

View File

@ -0,0 +1,91 @@
# This file is part of lyx2lyx
# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
#
# 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

View File

@ -0,0 +1,24 @@
# This file is part of lyx2lyx
# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
#
# 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

View File

@ -1,3 +1,7 @@
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* buffer.C: increment format to 229.
2003-12-28 Michael Schmitt <michael.schmitt@teststep.org>
* LaTeXFeatures.C:

View File

@ -132,7 +132,7 @@ extern BufferList bufferlist;
namespace {
const int LYX_FORMAT = 228;
const int LYX_FORMAT = 229;
} // namespace anon