def process_text(self, text): try: tree = fromstring(clean_html(text)) except etree.XMLSyntaxError: return xhtmlim(text) self._parse_element(tree) return html2md(etree.tostring(tree, method="xml", encoding=unicode))
def process_text(self, text): try: tree = fromstring(clean_html(text)) except etree.XMLSyntaxError: return xhtmlim(text) for el in tree.find_class('tags'): el.drop_tree() self._parse_element(tree) return html2md(etree.tostring(tree, method="xml", encoding=unicode))
def process_text(self, text): try: tree = fromstring(clean_html(text)) except etree.XMLSyntaxError: return xhtmlim(text) rm = False for el in tree.iterchildren(): if el.tag.lower() == 'a' and el.get('name').lower().startswith('cutid'): rm = True if rm: el.drop_tree() self._parse_element(tree) return html2md(etree.tostring(tree, method="xml", encoding=unicode))