1.1 --- a/MoinForms.py Sun Dec 02 01:40:02 2012 +0100
1.2 +++ b/MoinForms.py Sun Dec 02 15:43:39 2012 +0100
1.3 @@ -237,22 +237,20 @@
1.4 """
1.5
1.6 result = []
1.7 - state = None
1.8 type = None
1.9
1.10 - for match in form_field_regexp.split(body):
1.11 + for i, match in enumerate(form_field_regexp.split(body)):
1.12 + state = i % 3
1.13
1.14 # Reproduce normal text as is.
1.15
1.16 - if not state:
1.17 + if state == 0:
1.18 result.append(match)
1.19 - state = "TYPE"
1.20
1.21 # Capture the macro type.
1.22
1.23 - elif state == "TYPE":
1.24 + elif state == 1:
1.25 type = match
1.26 - state = "ARGS"
1.27
1.28 # Substitute the macro and modified arguments.
1.29
1.30 @@ -260,7 +258,6 @@
1.31 result.append("<<Form%s(%s)>>" % (type, ",".join(
1.32 adjustMacroArguments(parseMacroArguments(match), path)
1.33 )))
1.34 - state = None
1.35
1.36 return "".join(result)
1.37