# $Id: textblock.py,v 1.3 2002/04/01 19:06:06 jribbens Exp $ import re import jon.wt as wt import jon.cgi as cgi class TextBlock(wt.TemplateCode): def text(self): return "" def main(self, template): for self.paragraph in re.split(r"\r?\n\r?\n", self.text()): self.paragraph = cgi.html_encode(self.paragraph) self.paragraph = self.paragraph.replace("\n", "
") self.process(template) class TextBlock_Links(wt.TemplateCode): def text(self): return "" def main(self, template): for self.paragraph in re.split(r"\r?\n\r?\n", self.text()): self.paragraph = cgi.html_encode(self.paragraph) self.paragraph = self.paragraph.replace("\n", "
") def repl(m): return '%s' % \ (m.group(2), m.group(1)) self.paragraph = re.sub(r"\|([^|]+)\|([^|]+)\|", repl, self.paragraph) self.process(template) # legacy names textblock = TextBlock textblock_links = TextBlock_Links