]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/layout2layout.py
Fix bug 4094: HTML export issue with FAT32 on Linux.
[lyx.git] / lib / scripts / layout2layout.py
index 45bc499f8bd3b295623e1e4de3a343141211bdb1..97c7066162a28878675c4bf4e2a9ad893e2bb75e 100644 (file)
@@ -79,6 +79,7 @@ def convert(lines):
     re_CopyStyle = re.compile(r'^(\s*)(CopyStyle)(\s+)(\S+)', re.IGNORECASE)
     re_NoStyle = re.compile(r'^(\s*)(NoStyle)(\s+)(\S+)', re.IGNORECASE)
     re_End = re.compile(r'^(\s*)(End)(\s*)$', re.IGNORECASE)
+    re_Provides = re.compile(r'^(\s*)Provides(\S+)(\s+)(\S+)', re.IGNORECASE)
 
     # counters for sectioning styles (hardcoded in 1.3)
     counters = {"part"          : "\\Roman{part}",
@@ -133,16 +134,16 @@ def convert(lines):
                 match = re_Format.match(lines[i])
                 if match:
                         format = int(match.group(4))
-                        if format == 2:
-                            lines[i] = "Format 3"
+                        if format > 1 and format < 4:
+                            lines[i] = "Format %d" % (format + 1)
                             only_comment = 0
-                        elif format == 3:
+                        elif format == 4:
                                 # nothing to do
-                                return
+                                return format
                         else:
                             error('Cannot convert file format %s' % format)
                 else:
-                        lines.insert(i, "Format 3")
+                        lines.insert(i, "Format 2")
                         only_comment = 0
                         continue
 
@@ -153,6 +154,17 @@ def convert(lines):
                 i = i + 1
             continue
 
+        if format == 3:
+            # convert 'providesamsmath x',  'providesmakeidx x',  'providesnatbib x',  'providesurl x' to
+            #         'provides amsmath x', 'provides makeidx x', 'provides natbib x', 'provides url x'
+            # x is either 0 or 1
+            match = re_Provides.match(lines[i])
+            if match:
+                lines[i] = "%sProvides %s%s%s" % (match.group(1), match.group(2).lower(),
+                                                  match.group(3), match.group(4))
+            i = i + 1
+            continue
+
         if format == 2:
             caption = []
 
@@ -352,6 +364,8 @@ def convert(lines):
 
         i = i + 1
 
+    return format + 1
+
 
 def main(argv):
 
@@ -367,7 +381,9 @@ def main(argv):
 
     # Do the real work
     lines = read(input)
-    convert(lines)
+    format = 1
+    while (format < 4):
+        format = convert(lines)
     write(output, lines)
 
     # Close files