mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get rid of workaround for people running from source with obsolete binaries
This commit is contained in:
parent
18fd3ae063
commit
ea5b6da55a
@ -5,22 +5,8 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
print_function)
|
print_function)
|
||||||
|
|
||||||
|
|
||||||
def rudimentary_html2text(html):
|
|
||||||
from lxml import html as h
|
|
||||||
root = h.fromstring(html)
|
|
||||||
return h.tostring(root, method='text', encoding='unicode')
|
|
||||||
|
|
||||||
|
|
||||||
def html2text(html):
|
def html2text(html):
|
||||||
try:
|
from html2text import HTML2Text
|
||||||
from html2text import HTML2Text
|
|
||||||
except ImportError:
|
|
||||||
# for people running from source
|
|
||||||
from calibre.constants import numeric_version
|
|
||||||
if numeric_version <= (3, 40, 1):
|
|
||||||
return rudimentary_html2text(html)
|
|
||||||
raise
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
if isinstance(html, bytes):
|
if isinstance(html, bytes):
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user