diff options
author | Fred Drake <fdrake@acm.org> | 2005-10-13 19:20:18 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2005-10-13 19:20:18 +0000 |
commit | c21f649251f5ad2a677e672fbae39dcaf7369b0e (patch) | |
tree | 6177d990a1fd5ad3bd4f87c2fb82c4fba828cdd4 | |
parent | a390705602105790bf6293f01c4e02ba9c7fac29 (diff) | |
download | zope-tal-c21f649251f5ad2a677e672fbae39dcaf7369b0e.tar.gz |
- avoid variable initialization
- add a couple of minor comments
-rw-r--r-- | talgenerator.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/talgenerator.py b/talgenerator.py index 03819bc..e01bd50 100644 --- a/talgenerator.py +++ b/talgenerator.py @@ -50,9 +50,10 @@ class TALGenerator(object): # emitEndElement needs to finish its calculations self.todoStack = [] self.macros = {} + # {slot-name --> default content program} self.slots = {} self.slotStack = [] - self.xml = xml + self.xml = xml # true --> XML, false --> HTML self.emit("version", TAL_VERSION) self.emit("mode", xml and "xml" or "html") if source_file is not None: @@ -70,10 +71,6 @@ class TALGenerator(object): output = [] collect = [] cursor = 0 - if self.xml: - endsep = "/>" - else: - endsep = " />" for cursor in xrange(len(program)+1): try: item = program[cursor] @@ -90,6 +87,7 @@ class TALGenerator(object): if self.optimizeStartTag(collect, item[1], item[2], ">"): continue if opcode == "startEndTag": + endsep = self.xml and "/>" or " />" if self.optimizeStartTag(collect, item[1], item[2], endsep): continue if opcode in ("beginScope", "endScope"): |