From 3112bed4194fc21e1d6bb83e0b3264066ad5841f Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 10 Jan 2008 03:59:39 +0000 Subject: [PATCH] Fix layout2layout. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22459 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/scripts/layout2layout.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index e539714921..af50d3bab5 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -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 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)