]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/layout2layout.py
Revert "DocBook: add new layout parameter DocBookWrapperMergeWithPrevious."
[lyx.git] / lib / scripts / layout2layout.py
index 80a21d78131123fdf88c481ae47886e755d56420..60d4593482bc673c2b9765b808fbe260adfcfb13 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 = 75
+currentFormat = 82
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -249,7 +249,37 @@ currentFormat = 75
 # New InsetLayout and Argument tag NewlineCmd
 
 # Incremented to format 75, 2 June 2019 by spitz
-# New Argument tag FreeSpacing
+# New Argument tags FreeSpacing, InsertOnNewline
+# New InsetLayout tag ParbreakIgnored
+
+# Incremented to format 76, 8 July 2019 by spitz
+# New textclass tag BibInToc
+
+# Incremented to format 77, 6 August 2019 by spitz
+# New textclass tag PageSize (= default page size) 
+# and textclass option PageSize (= list of available page sizes)
+
+# Incremented to format 78, 6 August 2019 by spitz
+# New textclass tag FontsizeFormat
+
+# Incremented to format 79, 7 August 2019 by spitz
+# New textclass tag PagesizeFormat
+
+# Incremented to format 80, 12 August 2019 by spitz
+# New float option Requires
+
+# Incremented to format 81, 12 August 2019 by rikiheck
+# New tag GuiName for counters
+
+# Incremented to format 82, 4 June 2017 by dourouc05
+# - Add new tags for Layout:
+#   DocBookTag, DocBookAttr, DocBookInInfo,
+#   DocBookWrapperTag, DocBookWrapperAttr,
+#   DocBookItemWrapperTag, DocBookItemWrapperAttr,
+#   DocBookItemTag, DocBookItemAttr,
+#   DocBookLabelTag, DocBookLabelAttr
+# - Removed tag Header from ClassOptionsClassOptions
+# - Removed tag Element for flex insets
 
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
@@ -372,7 +402,7 @@ def convert(lines, end_format):
     # for categories
     re_Declaration = re.compile(b'^#\\s*\\Declare\\w+Class.*$')
     re_ExtractCategory = re.compile(b'^(#\\s*\\Declare\\w+Class(?:\\[[^]]*?\\])?){([^(]+?)\\s+\\(([^)]+?)\\)\\s*}\\s*$')
-    ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports", \
+    ConvDict = {"article": "Articles", "book" : "Books", "letter" : "Letters", "report": "Reports",
                 "presentation" : "Presentations", "curriculum vitae" : "Curricula Vitae", "handout" : "Handouts"}
     # Arguments
     re_OptArgs = re.compile(b'^(\\s*)OptionalArgs(\\s+)(\\d+)\\D*$', re.IGNORECASE)
@@ -465,12 +495,12 @@ def convert(lines, end_format):
           continue
 
         # insert file format if not already there
-        if (only_comment):
+        if only_comment:
             match = re_Format.match(lines[i])
             if match:
                 formatline = i
                 format = int(match.group(4))
-                if format > 1 and format < end_format:
+                if 1 < format < end_format:
                     lines[i] = b"Format %d" % (format + 1)
                     only_comment = 0
                 elif format == end_format:
@@ -500,7 +530,21 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if format >= 65 and format <= 74:
+        if format == 81:
+            match = re.compile(b'^(\\s*Header\\s+)("?\\w+"?)', re.IGNORECASE).match(lines[i])
+            if match:
+                del lines[i]
+                continue
+
+            match = re.compile(b'(\\s*LyXType\\s+)(\\w+)(\\s*Element\\s+)', re.IGNORECASE).match(lines[i])
+            if match:
+                del lines[i]
+                continue
+
+            i += 1
+            continue
+
+        if 65 <= format <= 80:
             # nothing to do.
             i += 1
             continue
@@ -525,7 +569,7 @@ def convert(lines, end_format):
             i += 1
             continue
 
-        if format >= 60 and format <= 62:
+        if 60 <= format <= 62:
             # nothing to do.
             i += 1
             continue
@@ -558,7 +602,7 @@ def convert(lines, end_format):
             i += 1
             continue
 
-        if format >= 50 and format <= 56:
+        if 50 <= format <= 56:
             # nothing to do.
             i += 1
             continue
@@ -656,7 +700,7 @@ def convert(lines, end_format):
 
             continue
 
-        if format >= 44 and format <= 47:
+        if 44 <= format <= 47:
             # nothing to do.
             i += 1
             continue
@@ -775,7 +819,7 @@ def convert(lines, end_format):
             continue
 
         if format == 36:
-            match = re_CiteFormat.match(lines[i]);
+            match = re_CiteFormat.match(lines[i])
             if match and match.group(4) == b"":
                 lines[i] = match.group(0) + b" default"
             i += 1
@@ -844,7 +888,7 @@ def convert(lines, end_format):
           continue
 
         # Only new features
-        if format >= 29 and format <= 31:
+        if 29 <= format <= 31:
           i += 1
           continue
 
@@ -868,7 +912,7 @@ def convert(lines, end_format):
           continue
 
         # Only new features
-        if format >= 24 and format <= 27:
+        if 24 <= format <= 27:
           i += 1
           continue
 
@@ -914,7 +958,7 @@ def convert(lines, end_format):
           continue
 
         # This just involved new features, not any changes to old ones
-        if format >= 14 and format <= 22:
+        if 14 <= format <= 22:
           i += 1
           continue
 
@@ -991,7 +1035,7 @@ def convert(lines, end_format):
             continue
 
         # These just involved new features, not any changes to old ones
-        if format >= 5 and format <= 7:
+        if 5 <= format <= 7:
           i += 1
           continue
 
@@ -1253,13 +1297,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);