Simplify revert_suppress_date.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36051 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 13:43:33 +00:00
parent 1bc5f3cb2b
commit bbacb7c5be

View File

@ -1170,19 +1170,16 @@ def revert_author_id(document):
def revert_suppress_date(document): def revert_suppress_date(document):
" Revert suppressing of default document date to preamble code " " Revert suppressing of default document date to preamble code "
i = 0 i = find_token(document.header, "\\suppress_date", 0)
while True: if i == -1:
i = find_token(document.header, "\\suppress_date", i) return
if i == -1: # remove the preamble line and write to the preamble
break # when suppress_date was true
# remove the preamble line and write to the preamble date = get_value(document.header, "\\suppress_date", i)
# when suppress_date was true if date == "true":
date = get_value(document.header, "\\suppress_date", i) add_to_preamble(document, ["% this command was inserted by lyx2lyx"])
if date == "true": add_to_preamble(document, ["\\date{}"])
add_to_preamble(document, ["% this command was inserted by lyx2lyx"]) del document.header[i]
add_to_preamble(document, ["\\date{}"])
del document.header[i]
i = i + 1
def revert_mhchem(document): def revert_mhchem(document):