Fix page breaks in lists and enums

This commit is contained in:
Laurenz 2021-11-02 10:42:32 +01:00
parent c4a87e5e7c
commit ea6ee3f667

View File

@ -2,9 +2,9 @@ use std::rc::Rc;
use super::{Eval, EvalContext, Str, Template, Value}; use super::{Eval, EvalContext, Str, Template, Value};
use crate::diag::TypResult; use crate::diag::TypResult;
use crate::geom::Align; use crate::geom::Spec;
use crate::layout::BlockLevel; use crate::layout::BlockLevel;
use crate::library::{ParChild, ParNode, Spacing, StackChild, StackNode}; use crate::library::{GridNode, ParChild, ParNode, TrackSizing};
use crate::syntax::*; use crate::syntax::*;
use crate::util::BoolExt; use crate::util::BoolExt;
@ -116,13 +116,12 @@ fn walk_item(ctx: &mut EvalContext, label: Str, body: Template) {
Rc::clone(&style.text), Rc::clone(&style.text),
)], )],
}; };
StackNode {
dir: style.dir, let spacing = style.text.size / 2.0;
children: vec![ GridNode {
StackChild::Node(label.pack(), Align::Start), tracks: Spec::new(vec![TrackSizing::Auto; 2], vec![]),
StackChild::Spacing(Spacing::Linear((style.text.size / 2.0).into())), gutter: Spec::new(vec![TrackSizing::Linear(spacing.into())], vec![]),
StackChild::Node(body.to_stack(&style).pack(), Align::Start), children: vec![label.pack(), body.to_stack(&style).pack()],
],
} }
}); });
} }