diff --git a/src/libprs500/ebooks/lrf/html/convert_from.py b/src/libprs500/ebooks/lrf/html/convert_from.py index d8a4a5297f..d202aad0e3 100644 --- a/src/libprs500/ebooks/lrf/html/convert_from.py +++ b/src/libprs500/ebooks/lrf/html/convert_from.py @@ -1013,16 +1013,16 @@ class HTMLConverter(object): self.current_para = Paragraph() self.current_block = self.book.create_text_block(textStyle=pb.textStyle, blockStyle=pb.blockStyle) - elif tagname in ['p', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']: + elif tagname in ['p', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']: + src = self.get_text(tag) if self.chapter_detection and tagname.startswith('h'): - src = self.get_text(tag) if self.chapter_regex.search(src): if self.verbose: print 'Detected chapter', src self.end_page() self.page_break_found = True self.end_current_para() - if not tag.contents or not ''.join(tag.contents).strip(): # Handle empty

elements + if not tag.contents or not src.strip(): # Handle empty

elements self.current_block.append(CR()) return self.lstrip_toggle = True