mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 08:03:42 +02:00
TXT Output: Simplify remove image and link regexes
This commit is contained in:
parent
b6ec16463e
commit
0257fe4a02
2 changed files with 3 additions and 7 deletions
|
|
@ -35,11 +35,9 @@ def mlize_spine(self):
|
|||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,9 @@ def mlize_spine(self):
|
|||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue