From 57a3fee974aca3b9563961c3e1b20a9f92977367 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 6 Oct 2008 10:07:58 -0700 Subject: [PATCH] Fix #1137 (Soft Hyphens on Epub file) --- src/calibre/ebooks/epub/__init__.py | 2 ++ src/calibre/ebooks/html.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/calibre/ebooks/epub/__init__.py b/src/calibre/ebooks/epub/__init__.py index 1d8b6e6b4c..8b95c5c0a8 100644 --- a/src/calibre/ebooks/epub/__init__.py +++ b/src/calibre/ebooks/epub/__init__.py @@ -15,11 +15,13 @@ class DefaultProfile(object): flow_size = sys.maxint screen_size = None + remove_soft_hyphens = False class PRS505(DefaultProfile): flow_size = 300000 screen_size = (600, 775) + remove_soft_hyphens = True PROFILES = { diff --git a/src/calibre/ebooks/html.py b/src/calibre/ebooks/html.py index 7a1ef56ad0..ea968edd53 100644 --- a/src/calibre/ebooks/html.py +++ b/src/calibre/ebooks/html.py @@ -364,6 +364,9 @@ class PreProcessor(object): return '' in src[:1000] def preprocess(self, html): + opts = getattr(self, 'opts', False) + if opts and hasattr(opts, 'profile') and getattr(opts.profile, 'remove_soft_hyphens', False): + html = html.replace(u'\u00ad', '') if self.is_baen(html): rules = [] elif self.is_book_designer(html):