diff --git a/src/calibre/ebooks/textile/functions.py b/src/calibre/ebooks/textile/functions.py index 45e73cfe8f..7380b10d1f 100755 --- a/src/calibre/ebooks/textile/functions.py +++ b/src/calibre/ebooks/textile/functions.py @@ -86,7 +86,14 @@ def getimagesize(url): """ try: - import ImageFile + from PIL import ImageFile + except ImportError: + try: + import ImageFile + except ImportError: + return None + + try: import urllib2 except ImportError: return None @@ -220,7 +227,7 @@ class Textile(object): (re.compile(r'{(S\^|\^S)}'), r'Ŝ'), # S-circumflex (re.compile(r'{(s\^|\^s)}'), r'ŝ'), # s-circumflex - + (re.compile(r'{(S\ˇ|\ˇS)}'), r'Š'), # S-caron (re.compile(r'{(s\ˇ|\ˇs)}'), r'š'), # s-caron (re.compile(r'{(T\ˇ|\ˇT)}'), r'Ť'), # T-caron @@ -229,7 +236,7 @@ class Textile(object): (re.compile(r'{(u\°|\°u)}'), r'ů'), # u-ring (re.compile(r'{(Z\ˇ|\ˇZ)}'), r'Ž'), # Z-caron (re.compile(r'{(z\ˇ|\ˇz)}'), r'ž'), # z-caron - + (re.compile(r'{\*}'), r'•'), # bullet (re.compile(r'{Fr}'), r'₣'), # Franc (re.compile(r'{(L=|=L)}'), r'₤'), # Lira @@ -245,7 +252,7 @@ class Textile(object): (re.compile(r"{(’|'/|/')}"), r'’'), # closing-single-quote - apostrophe (re.compile(r"{(‘|\\'|'\\)}"), r'‘'), # opening-single-quote (re.compile(r'{(”|"/|/")}'), r'”'), # closing-double-quote - (re.compile(r'{(“|\\"|"\\)}'), r'“'), # opening-double-quote + (re.compile(r'{(“|\\"|"\\)}'), r'“'), # opening-double-quote ] glyph_defaults = [ (re.compile(r'(\d+\'?\"?)( ?)x( ?)(?=\d+)'), r'\1\2×\3'), # dimension sign