Fix mistaken CSS page break processing during Mobipocket and LIT generation.

This commit is contained in:
Marshall T. Vandegrift 2009-01-25 15:08:02 -05:00
parent 9f5078add1
commit 2931ecb43a
2 changed files with 4 additions and 2 deletions

View File

@ -122,6 +122,8 @@ LZXC_CONTROL = \
COLLAPSE = re.compile(r'[ \t\r\n\v]+') COLLAPSE = re.compile(r'[ \t\r\n\v]+')
PAGE_BREAKS = set(['always', 'left', 'right'])
def decint(value): def decint(value):
bytes = [] bytes = []
while True: while True:
@ -202,7 +204,7 @@ class ReBinary(object):
self.write(FLAG_CUSTOM, len(tag)+1, tag) self.write(FLAG_CUSTOM, len(tag)+1, tag)
last_break = self.page_breaks[-1][0] if self.page_breaks else None last_break = self.page_breaks[-1][0] if self.page_breaks else None
if style and last_break != tag_offset \ if style and last_break != tag_offset \
and style['page-break-before'] not in ('avoid', 'auto'): and style['page-break-before'] in PAGE_BREAKS:
self.page_breaks.append((tag_offset, list(parents))) self.page_breaks.append((tag_offset, list(parents)))
for attr, value in attrib.items(): for attr, value in attrib.items():
attr = prefixname(attr, nsrmap) attr = prefixname(attr, nsrmap)

View File

@ -27,7 +27,7 @@ TABLE_TAGS = set(['table', 'tr', 'td', 'th'])
SPECIAL_TAGS = set(['hr', 'br']) SPECIAL_TAGS = set(['hr', 'br'])
CONTENT_TAGS = set(['img', 'hr', 'br']) CONTENT_TAGS = set(['img', 'hr', 'br'])
PAGE_BREAKS = set(['always', 'odd', 'even']) PAGE_BREAKS = set(['always', 'left', 'right'])
COLLAPSE = re.compile(r'[ \t\r\n\v]+') COLLAPSE = re.compile(r'[ \t\r\n\v]+')