Commit 8af87ff6 authored by Guido van Rossum's avatar Guido van Rossum

Use the nasty hack I just checked into TALGenerator.py to include some

preceding whitespace into the repeated stuff for a loop: if a repeated
element is preceded by a newline possibly followed by whitespace,
repeat that newline and whitespace for each loop iteration.  This
makes the generated XML look better.
parent 121b1873
......@@ -177,6 +177,10 @@ class TALParser(XMLParser):
if repeat: n = n+1
if n > 1:
raise TALError("can't use insert, replace, repeat together")
repeatWhitespace = None
if repeat:
# Hack to include preceding whitespace in the loop program
repeatWhitespace = self.gen.unEmitNewlineWhitespace()
if defineMacro:
self.gen.pushProgram()
todo["defineMacro"] = defineMacro
......@@ -206,6 +210,8 @@ class TALParser(XMLParser):
todo["repeat"] = repeat
self.gen.emit("beginScope")
self.gen.pushProgram()
if repeatWhitespace:
self.gen.emitText(repeatWhitespace)
if attrsubst:
repldict = parseAttributeReplacements(attrsubst)
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment