TXT Output: Simplify remove image and link regexes

This commit is contained in:
John Schember 2011-02-06 14:09:14 -05:00
parent b6ec16463e
commit 0257fe4a02
2 changed files with 3 additions and 7 deletions

View File

@ -35,11 +35,9 @@ class MarkdownMLizer(object):
html = unicode(etree.tostring(item.data, encoding=unicode))
if not self.opts.keep_links:
html = re.sub(r'<\s*a[^>]*>', '', html)
html = re.sub(r'<\s*/\s*a\s*>', '', html)
html = re.sub(r'<\s*/*\s*a[^>]*>', '', html)
if not self.opts.keep_image_references:
html = re.sub(r'<\s*img[^>]*>', '', html)
html = re.sub(r'<\s*img\s*>', '', html)
html = re.sub(r'<\s*img[^>]*>', '', html)\
text = html2text(html)

View File

@ -36,11 +36,9 @@ class TextileMLizer(object):
html = unicode(etree.tostring(item.data.find(XHTML('body')), encoding=unicode))
if not self.opts.keep_links:
html = re.sub(r'<\s*a[^>]*>', '', html)
html = re.sub(r'<\s*/\s*a\s*>', '', html)
html = re.sub(r'<\s*/*\s*a[^>]*>', '', html)
if not self.opts.keep_image_references:
html = re.sub(r'<\s*img[^>]*>', '', html)
html = re.sub(r'<\s*img\s*>', '', html)
text = html2textile(html)