def convert_textile(txt, title=''): from calibre.ebooks.textile import textile html = textile(txt, encoding='utf-8') return HTML_TEMPLATE % (title, html)