def textile(self, text, rel=None, head_offset=0, html_type='xhtml', sanitize=False): """ >>> import textile >>> textile.textile('some textile') '\\t<p>some textile</p>' """ self.html_type = html_type # text = unicode(text) text = _normalize_newlines(text) if self.restricted: text = self.encode_html(text, quotes=False) if rel: self.rel = ' rel="%s"' % rel text = self.getRefs(text) text = self.block(text, int(head_offset)) text = self.retrieve(text) if sanitize: text = sanitizer.sanitize(text, self.html_type) return text