Commit 2b577d20 authored by Guido van Rossum's avatar Guido van Rossum

When optimizing startEndTag, use " />" as the end separator when

generating HTML, and "/>" for XML, instead of always using "/>".

This is necessary for proper XHTML generation.
parent 116aebd2
...@@ -118,6 +118,10 @@ class TALGenerator: ...@@ -118,6 +118,10 @@ class TALGenerator:
output = [] output = []
collect = [] collect = []
rawseen = cursor = 0 rawseen = cursor = 0
if self.xml:
endsep = "/>"
else:
endsep = " />"
for cursor in xrange(len(program)+1): for cursor in xrange(len(program)+1):
try: try:
item = program[cursor] item = program[cursor]
...@@ -133,7 +137,7 @@ class TALGenerator: ...@@ -133,7 +137,7 @@ class TALGenerator:
if self.optimizeStartTag(collect, item[1], item[2], ">"): if self.optimizeStartTag(collect, item[1], item[2], ">"):
continue continue
if item[0] == "startEndTag": if item[0] == "startEndTag":
if self.optimizeStartTag(collect, item[1], item[2], "/>"): if self.optimizeStartTag(collect, item[1], item[2], endsep):
continue continue
text = string.join(collect, "") text = string.join(collect, "")
if text: if text:
......
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