]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/layout2layout.py
Amend 212314ada71
[lyx.git] / lib / scripts / layout2layout.py
index eebacf883d544a91656d51e71d9779811d6ed919..46a8ea6efb151d0c8262cd6005900e1d11b533a3 100644 (file)
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 64
+currentFormat = 76
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -217,6 +217,44 @@ currentFormat = 64
 # LabelStringAppendix, and EndLabelString, and LabelCounter,
 # to conform to what we used to do.
 
+# Incremented to format 65, 16 October 2017 by spitz
+# Color collapsable -> collapsible
+
+# Incremented to format 66, 28 December 2017 by spitz
+# New Layout tags "AutoNests ... EndAutoNests" and
+# "IsAutoNestedBy ... EndIsAutoNestedBy"
+
+# Incremented to format 67, 14 April 2018 by spitz
+# New Layout tag "NeedsCProtect"
+
+# Incremented to format 68, 21 May 2018 by spitz
+# New Layout tag "AddToCiteEngine"
+
+# Incremented to format 69, 16 August 2018 by spitz
+# New argument type "listpreamble"
+
+# Incremented to format 70, 5 June 2018 by rkh
+# New InsetLayout tag EditExternal
+
+# Incremented to format 71, 12 March 2019 by spitz
+# New [Inset]Layout tag NeedMBoxProtect
+
+# Incremented to format 72, 26 March 2019 by spitz
+# New TextClass tag TableStyle
+
+# Incremented to format 73, 18 April 2019 by spitz
+# New InsetLayout tag MenuString
+
+# Incremented to format 74, 18 April 2019 by spitz
+# New InsetLayout and Argument tag NewlineCmd
+
+# Incremented to format 75, 2 June 2019 by spitz
+# New Argument tags FreeSpacing, InsertOnNewline
+# New InsetLayout tag ParbreakIgnored
+
+# Incremented to format 76, 8 July 2019 by spitz
+# New textclass tag BibInToc
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -466,12 +504,28 @@ def convert(lines, end_format):
                 i += 1
             continue
 
+        if format >= 65 and format <= 75:
+            # nothing to do.
+            i += 1
+            continue
+
+        if format == 64:
+            match = re.compile(b'(\\s*Color\\s+)(\\w+)', re.IGNORECASE).match(lines[i])
+            if not match:
+                i += 1
+                continue
+            col  = match.group(2)
+            if col == "collapsable":
+                lines[i] = match.group(1) + "collapsible"
+            i += 1
+            continue
+
         if format == 63:
             for r in (re_trimLabelString, re_trimLabelStringAppendix,\
               re_trimEndLabelString, re_trimLabelCounter):
                 m = r.match(lines[i])
                 if m:
-                    lines[i] = m.group(1) + '"' + m.group(2) + '"'
+                    lines[i] = m.group(1) + b'"' + m.group(2) + b'"'
             i += 1
             continue
 
@@ -1203,13 +1257,17 @@ def main(argv):
     # Open files
     if options.input_file:
         source = open(options.input_file, 'rb')
-    else:
+    elif PY2:
         source = sys.stdin
+    else:
+        source = sys.stdin.buffer
 
     if options.output_file:
         output = open(options.output_file, 'wb')
-    else:
+    elif PY2:
         output = sys.stdout
+    else:
+        output = sys.stdout.buffer
 
     if options.format > currentFormat:
         error("Format %i does not exist" % options.format);