Simplify a bunch of tests in lyx2lyx code.

This commit is contained in:
Richard Heck 2015-11-28 23:58:50 -05:00
parent 01b4e811a6
commit 7831e11717

View File

@ -486,14 +486,7 @@ def revert_question_env(document):
""" """
# Do we use theorems-ams-extended-bytype module? # Do we use theorems-ams-extended-bytype module?
have_mod = False if not "theorems-ams-extended-bytype" in document.get_module_list():
mods = document.get_module_list()
for mod in mods:
if mod == "theorems-ams-extended-bytype":
have_mod = True
continue
if not have_mod:
return return
consecutive = False consecutive = False
@ -798,15 +791,7 @@ def revert_sigplan_doi(document):
def revert_ex_itemargs(document): def revert_ex_itemargs(document):
" Reverts \\item arguments of the example environments (Linguistics module) to TeX-code " " Reverts \\item arguments of the example environments (Linguistics module) to TeX-code "
# Do we use the linguistics module? if not "linguistics" in document.get_module_list():
have_mod = False
mods = document.get_module_list()
for mod in mods:
if mod == "linguistics":
have_mod = True
continue
if not have_mod:
return return
i = 0 i = 0
@ -837,15 +822,7 @@ def revert_ex_itemargs(document):
def revert_forest(document): def revert_forest(document):
" Reverts the forest environment (Linguistics module) to TeX-code " " Reverts the forest environment (Linguistics module) to TeX-code "
# Do we use the linguistics module? if not "linguistics" in document.get_module_list():
have_mod = False
mods = document.get_module_list()
for mod in mods:
if mod == "linguistics":
have_mod = True
continue
if not have_mod:
return return
i = 0 i = 0
@ -876,15 +853,7 @@ def revert_forest(document):
def revert_glossgroup(document): def revert_glossgroup(document):
" Reverts the GroupGlossedWords inset (Linguistics module) to TeX-code " " Reverts the GroupGlossedWords inset (Linguistics module) to TeX-code "
# Do we use the linguistics module? if not "linguistics" in document.get_module_list():
have_mod = False
mods = document.get_module_list()
for mod in mods:
if mod == "linguistics":
have_mod = True
continue
if not have_mod:
return return
i = 0 i = 0
@ -909,15 +878,7 @@ def revert_glossgroup(document):
def revert_newgloss(document): def revert_newgloss(document):
" Reverts the new Glosse insets (Linguistics module) to the old format " " Reverts the new Glosse insets (Linguistics module) to the old format "
# Do we use the linguistics module? if not "linguistics" in document.get_module_list():
have_mod = False
mods = document.get_module_list()
for mod in mods:
if mod == "linguistics":
have_mod = True
continue
if not have_mod:
return return
glosses = ("\\begin_inset Flex Glosse", "\\begin_inset Flex Tri-Glosse") glosses = ("\\begin_inset Flex Glosse", "\\begin_inset Flex Tri-Glosse")
@ -965,15 +926,7 @@ def revert_newgloss(document):
def convert_newgloss(document): def convert_newgloss(document):
" Converts Glosse insets (Linguistics module) to the new format " " Converts Glosse insets (Linguistics module) to the new format "
# Do we use the linguistics module? if not "linguistics" in document.get_module_list():
have_mod = False
mods = document.get_module_list()
for mod in mods:
if mod == "linguistics":
have_mod = True
continue
if not have_mod:
return return
glosses = ("\\begin_inset Flex Glosse", "\\begin_inset Flex Tri-Glosse") glosses = ("\\begin_inset Flex Glosse", "\\begin_inset Flex Tri-Glosse")