("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,476), 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))
]
####################################################################
def trim_eol(line):
" Remove end of line char(s)."
+ if line[-1] != '\n' and line[-1] != '\r':
+ # May happen for the last line of a document
+ return line
if line[-2:-1] == '\r':
return line[:-2]
else:
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]
self.read()
+# FIXME: header settings are completely outdated, don't use like this
#class NewFile(LyX_base):
# " This class is to create new LyX files."
# def set_header(self, **params):
# "\\use_amsmath 1",
# "\\cite_engine basic",
# "\\use_bibtopic false",
+# "\\use_indices false",
# "\\paperorientation portrait",
# "\\secnumdepth 3",
# "\\tocdepth 3",