summaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/template.rs14
-rw-r--r--src/eval/walk.rs8
2 files changed, 10 insertions, 12 deletions
diff --git a/src/eval/template.rs b/src/eval/template.rs
index 59fe293a..63916339 100644
--- a/src/eval/template.rs
+++ b/src/eval/template.rs
@@ -6,7 +6,7 @@ use std::rc::Rc;
use super::Str;
use crate::diag::StrResult;
-use crate::geom::{Align, Dir, GenAxis, Length, Linear, Sides, Size};
+use crate::geom::{Align, Dir, GenAxis, Length, Linear, Sides, Size, SpecAxis};
use crate::layout::{
Decoration, LayoutNode, LayoutTree, PadNode, PageRun, ParChild, ParNode, StackChild,
StackNode,
@@ -309,7 +309,7 @@ impl Builder {
fn parbreak(&mut self) {
let amount = self.style.par_spacing();
self.stack.finish_par(&self.style);
- self.stack.push_soft(StackChild::Spacing(amount.into()));
+ self.stack.push_soft(StackChild::spacing(amount, SpecAxis::Vertical));
}
/// Apply a forced page break.
@@ -335,7 +335,7 @@ impl Builder {
/// Push a block node into the active stack, finishing the active paragraph.
fn block(&mut self, node: impl Into<LayoutNode>) {
self.parbreak();
- self.stack.push(StackChild::Any(node.into(), self.style.aligns.block));
+ self.stack.push(StackChild::new(node, self.style.aligns.block));
self.parbreak();
}
@@ -344,7 +344,7 @@ impl Builder {
match axis {
GenAxis::Block => {
self.stack.finish_par(&self.style);
- self.stack.push_hard(StackChild::Spacing(amount));
+ self.stack.push_hard(StackChild::spacing(amount, SpecAxis::Vertical));
}
GenAxis::Inline => {
self.stack.par.push_hard(ParChild::Spacing(amount));
@@ -508,10 +508,8 @@ impl ParBuilder {
fn build(self) -> Option<StackChild> {
let Self { align, dir, line_spacing, children, .. } = self;
- (!children.is_empty()).then(|| {
- let node = ParNode { dir, line_spacing, children };
- StackChild::Any(node.into(), align)
- })
+ (!children.is_empty())
+ .then(|| StackChild::new(ParNode { dir, line_spacing, children }, align))
}
}
diff --git a/src/eval/walk.rs b/src/eval/walk.rs
index b76300ec..24284e4e 100644
--- a/src/eval/walk.rs
+++ b/src/eval/walk.rs
@@ -2,7 +2,7 @@ use std::rc::Rc;
use super::{Eval, EvalContext, Str, Template, Value};
use crate::diag::TypResult;
-use crate::geom::Align;
+use crate::geom::{Align, SpecAxis};
use crate::layout::{ParChild, ParNode, StackChild, StackNode};
use crate::syntax::*;
use crate::util::BoolExt;
@@ -119,9 +119,9 @@ fn walk_item(ctx: &mut EvalContext, label: Str, body: Template) {
StackNode {
dir: style.dir,
children: vec![
- StackChild::Any(label.into(), Align::Start),
- StackChild::Spacing((style.text.size / 2.0).into()),
- StackChild::Any(body.to_stack(&style).into(), Align::Start),
+ StackChild::new(label, Align::Start),
+ StackChild::spacing(style.text.size / 2.0, SpecAxis::Horizontal),
+ StackChild::new(body.to_stack(&style), Align::Start),
],
}
});