def handle(f=None, buf=None): if f: buf = codecs.open(f, 'r','utf8').read() if not buf: return ws = prehandler(split(buf)) return SplitParagraph(ws, 0)
def texstohtml(src, o): import traceback try: words = prehandler(split(src)) html = SplitParagraph(words, 0).html() except: html = '<pre>%s</pre>' % traceback.format_exc() f = codecs.open(o, 'w','utf8') f.write(html)