Fix bug in HTML Input plugin preprocess code when it is called before __call__

This commit is contained in:
Kovid Goyal 2010-08-27 22:32:41 -06:00
parent 6831e6e53f
commit 1f922ddb5a

View File

@ -491,6 +491,9 @@ class HTMLInput(InputFormatPlugin):
return (None, raw)
def preprocess_html(self, html):
if not hasattr(self, 'log'):
from calibre.utils.logging import default_log
self.log = default_log
self.log("********* Preprocessing HTML *********")
# Detect Chapters to match the xpath in the GUI
chapdetect = re.compile(r'(?=</?(br|p|span))(</?(br|p|span)[^>]*>)?\s*(?P<chap>(<(i|b)><(i|b)>|<(i|b)>)?(.?Chapter|Epilogue|Prologue|Book|Part|Dedication)\s*([\d\w-]+(\s\w+)?)?(</(i|b)></(i|b)>|</(i|b)>)?)(</?(p|br|span)[^>]*>)', re.IGNORECASE)