]> git.lyx.org Git - features.git/commitdiff
Make the code a bit more python-like
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 26 Oct 2006 14:43:58 +0000 (14:43 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 26 Oct 2006 14:43:58 +0000 (14:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15563 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_1_5.py

index 70ec731ee691e5c256fcc7e0aad415769d91a3c2..17f9f2d5e35798ec1d99364e7deece128b71005f 100644 (file)
@@ -372,8 +372,8 @@ def convert_commandparams(document):
         state = "WS"
         # Used to handle things like \command[foo[bar]]{foo{bar}}
         nestdepth = 0
-        for j in range(len(command)):
-            c = command[j]
+        b = 0
+        for c in command:
             if ((state == "CMDNAME" and c == ' ') or
                 (state == "CMDNAME" and c == '[') or
                 (state == "CMDNAME" and c == '{')):
@@ -398,10 +398,6 @@ def convert_commandparams(document):
             elif state == "CONTENT":
                     argument += c
             elif state == "WS":
-                if j > 0:
-                    b = command[j-1]
-                else:
-                    b = 0
                 if c == '\\':
                     state = "CMDNAME"
                 elif c == '[' and b != ']':
@@ -413,6 +409,7 @@ def convert_commandparams(document):
                 elif c == '{':
                     state = "CONTENT"
                     nestdepth = 0 # Just to be sure
+            b = c
 
         # Now we have parsed the command, output the parameters
         lines = ["\\begin_inset LatexCommand %s" % name]