From 4c24976164e3ac9bfb14ca98f6f970fca6f1f300 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 15 Apr 2011 02:50:45 +0000 Subject: [PATCH] Try to catch CopyStyle of a Flex inset, which we need to convert to the new Flex:* format. We can't do this perfectly, but we can do so when it's done within a single file. Failure to do this (which mistake had been made before) was the root cause of the problem reported by Enrico with IEEE. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38391 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/scripts/layout2layout.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index d9f8cabc46..a59dfcfae2 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -224,6 +224,7 @@ def convert(lines): # with quotes re_QInsetLayout2 = re.compile(r'^\s*InsetLayout\s+"([^"]+)"\s*$', re.IGNORECASE) re_IsFlex = re.compile(r'\s*LyXType.*$', re.IGNORECASE) + re_CopyStyle2 = re.compile(r'(\s*CopyStyle\s+)"?([^"]+)"?\s*$') # counters for sectioning styles (hardcoded in 1.3) counters = {"part" : "\\Roman{part}", @@ -269,6 +270,7 @@ def convert(lines): format = 1 formatline = 0 usemodules = [] + flexstyles = [] while i < len(lines): # Skip comments and empty lines @@ -317,8 +319,17 @@ def convert(lines): if not match: match = re_QInsetLayout2.match(lines[i]) if not match: + match = re_CopyStyle2.match(lines[i]) + if not match: + i += 1 + continue + style = match.group(2) + + if flexstyles.count(style): + lines[i] = match.group(1) + "\"Flex:" + style + "\"" i += 1 continue + name = match.group(1) names = name.split(":", 1) if len(names) > 1 and names[0] == "Flex": @@ -334,6 +345,7 @@ def convert(lines): break if isflex: + flexstyles.append(name) lines[i] = "InsetLayout \"Flex:" + name + "\"" i += 1 -- 2.39.5