mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
fix bug 4639
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23813 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e01e14872d
commit
6c57005797
@ -247,6 +247,12 @@ class LyX_base:
|
||||
|
||||
self.header.append(line)
|
||||
|
||||
i = find_token(self.header, '\\textclass', 0)
|
||||
if i == -1:
|
||||
self.warning("Malformed LyX file: Missing '\\textclass'.")
|
||||
i = find_token(self.header, '\\lyxformat', 0) + 1
|
||||
self.header[i:i] = ['\\textclass article']
|
||||
|
||||
self.textclass = get_value(self.header, "\\textclass", 0)
|
||||
self.backend = get_backend(self.textclass)
|
||||
self.format = self.read_format()
|
||||
@ -284,10 +290,7 @@ class LyX_base:
|
||||
if self.preamble:
|
||||
i = find_token(self.header, '\\textclass', 0) + 1
|
||||
preamble = ['\\begin_preamble'] + self.preamble + ['\\end_preamble']
|
||||
if i == 0:
|
||||
self.error("Malformed LyX file: Missing '\\textclass'.")
|
||||
else:
|
||||
header = self.header[:i] + preamble + self.header[i:]
|
||||
header = self.header[:i] + preamble + self.header[i:]
|
||||
else:
|
||||
header = self.header
|
||||
|
||||
|
@ -149,7 +149,7 @@ def get_value(lines, token, start, end = 0, default = ""):
|
||||
|
||||
i = find_token_exact(lines, token, start, end)
|
||||
if i == -1:
|
||||
return ""
|
||||
return default
|
||||
if len(lines[i].split()) > 1:
|
||||
return lines[i].split()[1]
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user