mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
fix search and replace
This commit is contained in:
commit
f10e10f079
@ -458,7 +458,10 @@ class HTMLPreProcessor(object):
|
||||
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…
x
Reference in New Issue
Block a user