def formatText(text): text = cleanupText(text) #if "\n" in text: # print # print "------------- ORIGINAL ----------------" # print text text = text.replace("<pre", "\n\n<pre").replace("</pre>", "</pre>\n\n") # encode to ascii leads into a translation of umlauts to their XML code. text = unicode(textile.textile(text.encode("utf-8"), output="ascii")) #if "\n" in text: # print "------------- TEXTILED ----------------" # print text return text