mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix pagebreak.to check (#2475)
This commit is contained in:
parent
866bd27d2e
commit
c29a31b6c5
@ -378,7 +378,10 @@ impl PageElem {
|
|||||||
let mut frames = child.layout(vt, styles, regions)?.into_frames();
|
let mut frames = child.layout(vt, styles, regions)?.into_frames();
|
||||||
|
|
||||||
// Align the child to the pagebreak's parity.
|
// 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.
|
// Insert empty page after the current pages.
|
||||||
let size = area.map(Abs::is_finite).select(area, Size::zero());
|
let size = area.map(Abs::is_finite).select(area, Size::zero());
|
||||||
frames.push(Frame::hard(size));
|
frames.push(Frame::hard(size));
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.7 KiB |
@ -21,3 +21,15 @@ Seventh
|
|||||||
First
|
First
|
||||||
#pagebreak(to: "odd")
|
#pagebreak(to: "odd")
|
||||||
Third
|
Third
|
||||||
|
|
||||||
|
---
|
||||||
|
#set page(height: 30pt, width: 80pt)
|
||||||
|
|
||||||
|
// Test when content extends to more than one page
|
||||||
|
First
|
||||||
|
|
||||||
|
Second
|
||||||
|
|
||||||
|
#pagebreak(to: "odd")
|
||||||
|
|
||||||
|
Third
|
||||||
|
Loading…
x
Reference in New Issue
Block a user