Commit 75bf0d61 authored by Fred Drake's avatar Fred Drake

Split .emitText() into .exitText() and .emitRawText(); both generate
"rawtext" instructions, but .emitText() re-writes the data to use magic
entities for HTML.  Adjacent "rawtext" instructions are collapsed into a
single instruction.
parent 8dcc0e69
...@@ -142,14 +142,16 @@ class TALGenerator: ...@@ -142,14 +142,16 @@ class TALGenerator:
else: else:
self.program.append(("endTag", name)) self.program.append(("endTag", name))
def emitText(self, text): def emitRawText(self, text):
text = cgi.escape(text)
if self.program and self.program[-1][0] == "rawtext": if self.program and self.program[-1][0] == "rawtext":
# Concatenate text # Concatenate text
self.program[-1] = ("rawtext", self.program[-1][1] + text) self.program[-1] = ("rawtext", self.program[-1][1] + text)
return return
self.program.append(("rawtext", text)) self.program.append(("rawtext", text))
def emitText(self, text):
self.emitRawText(cgi.escape(text))
def emitDefines(self, defines): def emitDefines(self, defines):
for part in splitParts(defines): for part in splitParts(defines):
m = re.match( m = re.match(
......
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