Fix pagebreak.to check (#2475)

This commit is contained in:
Francisco J. Sanchez 2023-10-25 17:16:34 +02:00 committed by GitHub
parent 866bd27d2e
commit c29a31b6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -378,7 +378,10 @@ impl PageElem {
let mut frames = child.layout(vt, styles, regions)?.into_frames();
// Align the child to the pagebreak's parity.
if extend_to.is_some_and(|p| p.matches(page_counter.physical().get())) {
// Check for page count after adding the pending frames
if extend_to
.is_some_and(|p| !p.matches(page_counter.physical().get() + frames.len()))
{
// Insert empty page after the current pages.
let size = area.map(Abs::is_finite).select(area, Size::zero());
frames.push(Frame::hard(size));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -21,3 +21,15 @@ Seventh
First
#pagebreak(to: "odd")
Third
---
#set page(height: 30pt, width: 80pt)
// Test when content extends to more than one page
First
Second
#pagebreak(to: "odd")
Third