]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/LyX.py
jss.layout: correct appearance of sectioning commands
[lyx.git] / lib / lyx2lyx / LyX.py
index 658d0ec61e0263c4e57237934469ca9665015b59..73818fa827557f1492dcf405823f4b15576b6c1b 100644 (file)
@@ -80,12 +80,12 @@ format_relation = [("0_06",    [200], minor_versions("0.6" , 4)),
                    ("1_1_6_3", [218], ["1.1", "1.1.6.3","1.1.6.4"]),
                    ("1_2",     [220], minor_versions("1.2" , 4)),
                    ("1_3",     [221], minor_versions("1.3" , 7)),
-                   ("1_4", range(222,246), minor_versions("1.4" , 5)),
-                   ("1_5", range(246,277), minor_versions("1.5" , 7)),
-                   ("1_6", range(277,346), minor_versions("1.6" , 10)),
-                   ("2_0", range(346,414), minor_versions("2.0", 8)),
-                   ("2_1", range(414,475), minor_versions("2.1", 0)),
-                   ("2_2", range(475,481), minor_versions("2.2", 0))
+                   ("1_4", list(range(222,246)), minor_versions("1.4" , 5)),
+                   ("1_5", list(range(246,277)), minor_versions("1.5" , 7)),
+                   ("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
+                   ("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
+                   ("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
+                   ("2_2", list(range(475,496)), minor_versions("2.2" , 0))
                   ]
 
 ####################################################################
@@ -438,8 +438,22 @@ class LyX_base:
 
     def set_version(self):
         " Set the header with the version used."
-        self.header[0] = " ".join(["#LyX %s created this file." % version__,
-                                  "For more info see http://www.lyx.org/"])
+
+        initial_comment = " ".join(["#LyX %s created this file." % version__,
+                                    "For more info see http://www.lyx.org/"])
+
+        # Simple heuristic to determine the comment that always starts
+        # a lyx file
+        if self.header[0].startswith("#"):
+            self.header[0] = initial_comment
+        else:
+            self.header.insert(0, initial_comment)
+
+        # Old lyx files had a two lines comment header:
+        # 1) the first line had the user who had created it
+        # 2) the second line had the lyx version used
+        # later we decided that 1) was a privacy risk for no gain
+        # here we remove the second line effectively erasing 1)
         if self.header[1][0] == '#':
             del self.header[1]