Fix bugs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22506 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-01-12 06:43:44 +00:00
parent efbbf7a31f
commit df4634968a
2 changed files with 12 additions and 4 deletions

View File

@ -404,7 +404,7 @@ class LyX_base:
return
j = find_token(self.header, "\\end_modules", i)
if j == -1:
self.warning("Malformed LyX document: No \\end_modules.")
self.warning("(add_module)Malformed LyX document: No \\end_modules.")
return
k = find_token(self.header, module, i)
if k != -1 and k < j:
@ -422,15 +422,19 @@ class LyX_base:
def set_module_list(self, mlist):
modbegin = find_token(self.header, "\\begin_modules", 0)
newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules']
if (modbegin == -1):
#No modules yet included
modbegin = find_token(self.header, "\\textclass", 0)
if modbegin == -1:
tclass = find_token(self.header, "\\textclass", 0)
if tclass == -1:
self.warning("Malformed LyX document: No \\textclass!!")
return
modbegin = tclass + 1
self.header[modbegin:modbegin] = newmodlist
return
modend = find_token(self.header, "\\end_modules", modbegin)
if modend == -1:
self.warning("Malformed LyX document: No \\end_modules.")
self.warning("(set_module_list)Malformed LyX document: No \\end_modules.")
return
newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules']
self.header[modbegin:modend + 1] = newmodlist

View File

@ -929,6 +929,8 @@ def convert_module_names(document):
'Theorems (Order By Chapter)' : 'theorems-chap', 'Theorems (Order By Section)' : 'theorems-sec', \
'Theorems (Starred)' : 'theorems-starred', 'Theorems' : 'theorems-std' }
modlist = document.get_module_list()
if len(modlist) == 0:
return
newmodlist = []
for mod in modlist:
if modulemap.has_key(mod):
@ -946,6 +948,8 @@ def revert_module_names(document):
'theorems-chap' : 'Theorems (Order By Chapter)', 'theorems-sec' : 'Theorems (Order By Section)', \
'theorems-starred' : 'Theorems (Starred)', 'theorems-std' : 'Theorems'}
modlist = document.get_module_list()
if len(modlist) == 0:
return
newmodlist = []
for mod in modlist:
if modulemap.has_key(mod):