Fix layout2layout.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22459 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-01-10 03:59:39 +00:00
parent 5faad9ca68
commit 3112bed419

View File

@ -9,12 +9,15 @@
# Full author contact details are available in file CREDITS
# This script will update a .layout file to format 3
# This script will update a .layout file to format 6
import os, re, string, sys
currentFormat = 6
def usage(prog_name):
return ("Usage: %s inputfile outputfile\n" % prog_name +
"or %s <inputfile >outputfile" % prog_name)
@ -135,10 +138,10 @@ def convert(lines):
match = re_Format.match(lines[i])
if match:
format = int(match.group(4))
if format > 1 and format < 5:
if format > 1 and format < currentFormat:
lines[i] = "Format %d" % (format + 1)
only_comment = 0
elif format == 5:
elif format == currentFormat:
# nothing to do
return format
else:
@ -155,6 +158,10 @@ def convert(lines):
i += 1
continue
if format == 5:
i += 1
continue
if format == 4:
# Handle conversion to long CharStyle names
match = re_CharStyle.match(lines[i])
@ -396,7 +403,7 @@ def main(argv):
# Do the real work
lines = read(input)
format = 1
while (format < 4):
while (format < currentFormat):
format = convert(lines)
write(output, lines)