]> git.lyx.org Git - lyx.git/commitdiff
Try to catch CopyStyle of a Flex inset, which we need to convert to the new
authorRichard Heck <rgheck@comcast.net>
Fri, 15 Apr 2011 02:50:45 +0000 (02:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 15 Apr 2011 02:50:45 +0000 (02:50 +0000)
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

index d9f8cabc46f8495cd874f7e58905fe58cca38cff..a59dfcfae2afbd3425278d44a4f8ee17edf69e90 100644 (file)
@@ -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