mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:43:31 +02:00
Fix search and replace.
This commit is contained in:
parent
ade8f7a797
commit
73e60f8c7e
1 changed files with 4 additions and 1 deletions
|
|
@ -458,7 +458,10 @@ def __call__(self, html, remove_special_chars=None,
|
|||
if search_pattern:
|
||||
try:
|
||||
search_re = re.compile(search_pattern)
|
||||
rules.insert(0, (search_re, getattr(self.extra_opts, replace, '')))
|
||||
replace_txt = getattr(self.extra_opts, replace, '')
|
||||
if replace_txt == None:
|
||||
replace_txt = ''
|
||||
rules.insert(0, (search_re, replace_txt))
|
||||
except Exception as e:
|
||||
self.log.error('Failed to parse %s regexp because %s' % (search, e))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue