diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-23 11:58:16 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-23 11:58:16 +0100 |
| commit | d3f6040cedacad1b6c323be721c9086f6c5d9a44 (patch) | |
| tree | 2a39a206ab4d032880b4841bf421eee59fcbec73 /src/library | |
| parent | 02f114d072ffba72c5b18953f2959eac4dee1612 (diff) | |
Horizon alignment
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/align.rs | 4 | ||||
| -rw-r--r-- | src/library/mod.rs | 3 | ||||
| -rw-r--r-- | src/library/par.rs | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/library/align.rs b/src/library/align.rs index 5aeef543..97196aa7 100644 --- a/src/library/align.rs +++ b/src/library/align.rs @@ -20,8 +20,8 @@ pub(super) fn parse_aligns(args: &mut Args) -> TypResult<Spec<Option<Align>>> { let mut y = args.named("vertical")?; for Spanned { v, span } in args.all::<Spanned<Align>>() { match v.axis() { - None | Some(SpecAxis::Horizontal) if x.is_none() => x = Some(v), - None | Some(SpecAxis::Vertical) if y.is_none() => y = Some(v), + SpecAxis::Horizontal if x.is_none() => x = Some(v), + SpecAxis::Vertical if y.is_none() => y = Some(v), _ => bail!(span, "unexpected argument"), } } diff --git a/src/library/mod.rs b/src/library/mod.rs index 6260e6fc..9fe15a0f 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -121,9 +121,10 @@ pub fn new() -> Scope { std.def_const("ttb", Dir::TTB); std.def_const("btt", Dir::BTT); std.def_const("left", Align::Left); - std.def_const("top", Align::Top); std.def_const("center", Align::Center); std.def_const("right", Align::Right); + std.def_const("top", Align::Top); + std.def_const("horizon", Align::Horizon); std.def_const("bottom", Align::Bottom); std.def_const("serif", FontFamily::Serif); std.def_const("sans-serif", FontFamily::SansSerif); diff --git a/src/library/par.rs b/src/library/par.rs index ab4909e1..4d291fdc 100644 --- a/src/library/par.rs +++ b/src/library/par.rs @@ -33,7 +33,7 @@ pub fn par(ctx: &mut EvalContext, args: &mut Args) -> TypResult<Value> { let mut align = None; if let Some(Spanned { v, span }) = args.named::<Spanned<Align>>("align")? { - if matches!(v.axis(), None | Some(SpecAxis::Horizontal)) { + if v.axis() == SpecAxis::Horizontal { align = Some(v); } else { bail!(span, "must be horizontal"); |
