preserve spaces inside parentheses for arg

During testing, I found that spaces inside quotes were preserved by the "instring" code, but not spaces inside naked parentheses. For example, "(Elvish Rider)" would be turned into "ElvishRider". This fix keeps interior whitespace from being discarded; the problem of leading and trailing whitespace is dealt with by stripping the arg before appending it to args.
This commit is contained in:
Groggy Dice 2013-12-15 18:48:01 -05:00
parent 7a014e8030
commit f2391f0966

View file

@ -173,9 +173,9 @@ def parse_macroref(start, line):
line[i].isspace() and \
brackdepth == 1 and \
parendepth == 0:
args.append(arg)
args.append(arg.strip())
arg = ""
elif not line[i].isspace():
elif not line[i].isspace() or parendepth > 0:
arg += line[i]
return (args, brackdepth, parendepth)