]> git.lyx.org Git - lyx.git/commitdiff
Make this routine more pythonic.
authorRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 17:42:47 +0000 (17:42 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 17:42:47 +0000 (17:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36085 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_2_0.py

index 79f9f1be2f17c2fa826bf22c751038cbea3b0f8f..9871d6a4febbead3640da1912cf62996e54fe0c0 100644 (file)
@@ -1633,16 +1633,10 @@ def remove_Nameref(document):
 def revert_mathrsfs(document):
     " Load mathrsfs if \mathrsfs us use in the document "
     i = 0
-    end = len(document.body) - 1
-    while True:
-      j = document.body[i].find("\\mathscr{")
-      if j != -1:
-        add_to_preamble(document, ["% this command was inserted by lyx2lyx"])
-        add_to_preamble(document, ["\\usepackage{mathrsfs}"])
-        break
-      if i == end:
-        break
-      i += 1
+    for line in document.body:
+      if line.find("\\mathscr{") != -1:
+        add_to_preamble(document, ["% lyx2lyx mathrsfs addition", "\\usepackage{mathrsfs}"])
+        return
 
 
 def convert_flexnames(document):