mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
Make lyx2lyx parser a bit more robust.
Ignore if the first line of a lyx file does not start with a # Add such a line if it is missing.. Fixes bug #9279
This commit is contained in:
parent
10b0fab02d
commit
5ed74b4446
@ -432,8 +432,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]
|
||||
|
||||
|
@ -110,6 +110,8 @@ What's new
|
||||
|
||||
- Fix handling of the TEXINPUTS environment variable on Windows (bug 9453).
|
||||
|
||||
- Make lyx2lyx more robust, add the initial comment line that says what is the
|
||||
lyx version that created the document if none is present (bug 9279).
|
||||
|
||||
|
||||
* USER INTERFACE
|
||||
|
Loading…
Reference in New Issue
Block a user