mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Make the code a bit more python-like
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15563 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f113c9b63d
commit
35847cdad8
@ -372,8 +372,8 @@ def convert_commandparams(document):
|
|||||||
state = "WS"
|
state = "WS"
|
||||||
# Used to handle things like \command[foo[bar]]{foo{bar}}
|
# Used to handle things like \command[foo[bar]]{foo{bar}}
|
||||||
nestdepth = 0
|
nestdepth = 0
|
||||||
for j in range(len(command)):
|
b = 0
|
||||||
c = command[j]
|
for c in command:
|
||||||
if ((state == "CMDNAME" and c == ' ') or
|
if ((state == "CMDNAME" and c == ' ') or
|
||||||
(state == "CMDNAME" and c == '[') or
|
(state == "CMDNAME" and c == '[') or
|
||||||
(state == "CMDNAME" and c == '{')):
|
(state == "CMDNAME" and c == '{')):
|
||||||
@ -398,10 +398,6 @@ def convert_commandparams(document):
|
|||||||
elif state == "CONTENT":
|
elif state == "CONTENT":
|
||||||
argument += c
|
argument += c
|
||||||
elif state == "WS":
|
elif state == "WS":
|
||||||
if j > 0:
|
|
||||||
b = command[j-1]
|
|
||||||
else:
|
|
||||||
b = 0
|
|
||||||
if c == '\\':
|
if c == '\\':
|
||||||
state = "CMDNAME"
|
state = "CMDNAME"
|
||||||
elif c == '[' and b != ']':
|
elif c == '[' and b != ']':
|
||||||
@ -413,6 +409,7 @@ def convert_commandparams(document):
|
|||||||
elif c == '{':
|
elif c == '{':
|
||||||
state = "CONTENT"
|
state = "CONTENT"
|
||||||
nestdepth = 0 # Just to be sure
|
nestdepth = 0 # Just to be sure
|
||||||
|
b = c
|
||||||
|
|
||||||
# Now we have parsed the command, output the parameters
|
# Now we have parsed the command, output the parameters
|
||||||
lines = ["\\begin_inset LatexCommand %s" % name]
|
lines = ["\\begin_inset LatexCommand %s" % name]
|
||||||
|
Loading…
Reference in New Issue
Block a user