summaryrefslogtreecommitdiff
path: root/src/library/page.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-12 14:16:59 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-12 14:16:59 +0100
commitc3acb491e38d333acff6897479f7dd9c86fba307 (patch)
tree7bf33511e7631c2ebff1b1f438eeefba6e3ae6a2 /src/library/page.rs
parent584a43277dbfbdba834a2681afe63d10598db3f9 (diff)
Refactor execution context 🏗
- The execution context is a lot more structured: Instead of a magic stack of arbitrary objects there are static objects for pages, stacks and paragraphs - Page softness/keeping mechanic is now a lot simpler than before
Diffstat (limited to 'src/library/page.rs')
-rw-r--r--src/library/page.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/library/page.rs b/src/library/page.rs
index 4ab92b31..963ab913 100644
--- a/src/library/page.rs
+++ b/src/library/page.rs
@@ -83,25 +83,20 @@ pub fn page(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value {
}
ctx.set_dirs(Gen::new(main, cross));
+ ctx.finish_page(false, Softness::Hard);
- let mut softness = ctx.end_page_group(|_| false);
if let Some(body) = &body {
// TODO: Restrict body to a single page?
- ctx.start_page_group(Softness::Hard);
body.exec(ctx);
- ctx.end_page_group(|s| s == Softness::Hard);
- softness = Softness::Soft;
ctx.state = snapshot;
+ ctx.finish_page(true, Softness::Soft);
}
-
- ctx.start_page_group(softness);
})
}
/// `pagebreak`: Start a new page.
pub fn pagebreak(_: &mut EvalContext, _: &mut ValueArgs) -> Value {
Value::template("pagebreak", move |ctx| {
- ctx.end_page_group(|_| true);
- ctx.start_page_group(Softness::Hard);
+ ctx.finish_page(true, Softness::Hard);
})
}