mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer page break insertion
This commit is contained in:
parent
87b86d86a8
commit
6c78ae2105
@ -420,6 +420,9 @@ def merge_html(container, names, master, insert_page_breaks=False):
|
||||
first_child.set('id', unique_anchor(seen_anchors, 'top'))
|
||||
seen_anchors.add(first_child.get('id'))
|
||||
|
||||
if insert_page_breaks:
|
||||
first_child.set('style', first_child.get('style', '') + '; page-break-before: always')
|
||||
|
||||
amap[''] = first_child.get('id')
|
||||
|
||||
# Fix links that point to local changed anchors
|
||||
@ -428,9 +431,6 @@ def merge_html(container, names, master, insert_page_breaks=False):
|
||||
if q in amap:
|
||||
a.set('href', '#' + amap[q])
|
||||
|
||||
if insert_page_breaks:
|
||||
master_body.append(master_body.makeelement(XHTML('div'), style='page-break-after:always'))
|
||||
|
||||
for child in children:
|
||||
if isinstance(child, string_or_bytes):
|
||||
add_text(master_body, child)
|
||||
|
Loading…
x
Reference in New Issue
Block a user