diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-11-30 22:07:08 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-11-30 22:07:08 +0100 |
| commit | fdc1b378a3eb3cf325592b801c43e2ec2478ddff (patch) | |
| tree | 0e83aa07d7ec49ac494746b44869d0306f5648fe /src/eval | |
| parent | 21857064db8ca1bdf61b6e5ee37dff1a15083189 (diff) | |
Compress images in PDFs ⚙
Diffstat (limited to 'src/eval')
| -rw-r--r-- | src/eval/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/eval/mod.rs b/src/eval/mod.rs index e1682adc..6d8f66ca 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -37,7 +37,7 @@ pub fn eval(tree: &SynTree, env: SharedEnv, state: State) -> Pass<Document> { let mut ctx = EvalContext::new(env, state); ctx.start_page_group(false); tree.eval(&mut ctx); - ctx.end_page_group(); + ctx.end_page_group(true); ctx.finish() } @@ -117,7 +117,8 @@ impl EvalContext { /// Start a page group based on the active page state. /// - /// If `hard` is false, empty page runs will be omitted from the output. + /// If both this `hard` and the one in the matching call to `end_page_group` + /// are false, empty page runs will be omitted from the output. /// /// This also starts an inner paragraph. pub fn start_page_group(&mut self, hard: bool) { @@ -134,10 +135,10 @@ impl EvalContext { /// End a page group and push it to the finished page runs. /// /// This also ends an inner paragraph. - pub fn end_page_group(&mut self) { + pub fn end_page_group(&mut self, hard: bool) { self.end_par_group(); let (group, children) = self.end_group::<PageGroup>(); - if group.hard || !children.is_empty() { + if hard || group.hard || !children.is_empty() { self.runs.push(Pages { size: group.size, child: LayoutNode::dynamic(Pad { @@ -208,6 +209,7 @@ impl EvalContext { /// End a layouting group started with [`start_group`](Self::start_group). /// /// This returns the stored metadata and the collected nodes. + #[track_caller] fn end_group<T: 'static>(&mut self) -> (T, Vec<LayoutNode>) { if let Some(&LayoutNode::Spacing(spacing)) = self.inner.last() { if spacing.softness == Softness::Soft { |
