Skip to content

Commit

Permalink
Showing 4 changed files with 42 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -488,3 +488,10 @@ to open a `new issue <https://github.com/Kozea/WeasyPrint/issues/new>`_. You
can also find extra help in this `bug report
<https://github.com/Kozea/WeasyPrint/issues/589>`_. If you cheated, then, you
know: Kittens already died.


Other Options for Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a .NET wrapper for WeasyPrint available `here
<https://github.com/balbarak/WeasyPrint-netcore>`_.
4 changes: 2 additions & 2 deletions weasyprint/document.py
Original file line number Diff line number Diff line change
@@ -423,7 +423,7 @@ def copy(self, pages='all'):
Combine multiple documents into one PDF file,
using metadata from the first::
all_pages = [p for p in doc.pages for doc in documents]
all_pages = [p for doc in documents for p in doc.pages]
documents[0].copy(all_pages).write_pdf('combined.pdf')
"""
@@ -481,7 +481,7 @@ def make_bookmark_tree(self):
.. versionadded:: 0.15
:return: A list of bookmark subtrees.
A subtree is ``(label, target, children)``. ``label`` is
A subtree is ``(label, target, children, state)``. ``label`` is
a string, ``target`` is ``(page_number, x, y)`` like in
:meth:`resolve_links`, and ``children`` is a
list of child subtrees.
13 changes: 10 additions & 3 deletions weasyprint/layout/pages.py
Original file line number Diff line number Diff line change
@@ -715,9 +715,16 @@ def remake_page(index, context, root_box, html, style_for):
page_state = copy.deepcopy(initial_page_state)
next_page_name = initial_next_page['page']
first = index == 0
# TODO: handle recto/verso and add test
blank = ((initial_next_page['break'] == 'left' and right_page) or
(initial_next_page['break'] == 'right' and not right_page))
if initial_next_page['break'] in ('left', 'right'):
next_page_side = initial_next_page['break']
elif initial_next_page['break'] in ('recto', 'verso'):
direction_ltr = root_box.style['direction'] == 'ltr'
break_verso = initial_next_page['break'] == 'verso'
next_page_side = 'right' if direction_ltr ^ break_verso else 'left'
else:
next_page_side = None
blank = ((next_page_side == 'left' and right_page) or
(next_page_side == 'right' and not right_page))
if blank:
next_page_name = ''
side = 'right' if right_page else 'left'
23 changes: 23 additions & 0 deletions weasyprint/tests/test_layout/test_page.py
Original file line number Diff line number Diff line change
@@ -497,6 +497,29 @@ def test_margin_break_clearance():
assert div_2.content_box_y() == 5


@assert_no_logs
@pytest.mark.parametrize('direction, page_break, pages_number', (
('ltr', 'recto', 3),
('ltr', 'verso', 2),
('rtl', 'recto', 3),
('rtl', 'verso', 2),
('ltr', 'right', 3),
('ltr', 'left', 2),
('rtl', 'right', 2),
('rtl', 'left', 3),
))
def test_recto_verso_break(direction, page_break, pages_number):
pages = render_pages('''
<style>
html { direction: %s }
p { break-before: %s }
</style>
abc
<p>def</p>
''' % (direction, page_break))
assert len(pages) == pages_number


@assert_no_logs
def test_page_names_1():
pages = render_pages('''

0 comments on commit 0142689

Please sign in to comment.