]> git.lyx.org Git - features.git/commitdiff
Simplify revert_suppress_date.
authorRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 13:43:33 +0000 (13:43 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 13:43:33 +0000 (13:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36051 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_2_0.py

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