mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #885 (Spurious inter-paragraph blank lines produced by trailing spaces)
This commit is contained in:
commit
2bc7d8cbfb
@ -222,6 +222,7 @@ class HTMLConverter(object, LoggingInterface):
|
|||||||
self.memory = [] #: Used to ensure that duplicate CSS unhandled erros are not reported
|
self.memory = [] #: Used to ensure that duplicate CSS unhandled erros are not reported
|
||||||
self.tops = {} #: element representing the top of each HTML file in the LRF file
|
self.tops = {} #: element representing the top of each HTML file in the LRF file
|
||||||
self.previous_text = '' #: Used to figure out when to lstrip
|
self.previous_text = '' #: Used to figure out when to lstrip
|
||||||
|
self.stripped_space = ''
|
||||||
self.preserve_block_style = False #: Used so that <p> tags in <blockquote> elements are handled properly
|
self.preserve_block_style = False #: Used so that <p> tags in <blockquote> elements are handled properly
|
||||||
self.avoid_page_break = False
|
self.avoid_page_break = False
|
||||||
self.current_page = book.create_page()
|
self.current_page = book.create_page()
|
||||||
@ -864,6 +865,10 @@ class HTMLConverter(object, LoggingInterface):
|
|||||||
|
|
||||||
if collapse_whitespace:
|
if collapse_whitespace:
|
||||||
src = re.sub(r'\s{1,}', ' ', src)
|
src = re.sub(r'\s{1,}', ' ', src)
|
||||||
|
if self.stripped_space and len(src) == len(src.lstrip(u' \n\r\t')):
|
||||||
|
src = self.stripped_space + src
|
||||||
|
src, orig = src.rstrip(u' \n\r\t'), src
|
||||||
|
self.stripped_space = orig[len(src):]
|
||||||
if len(self.previous_text) != len(self.previous_text.rstrip(u' \n\r\t')):
|
if len(self.previous_text) != len(self.previous_text.rstrip(u' \n\r\t')):
|
||||||
src = src.lstrip(u' \n\r\t')
|
src = src.lstrip(u' \n\r\t')
|
||||||
if len(src):
|
if len(src):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user