diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-12-09 13:42:52 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-12-09 13:42:52 +0100 |
| commit | fe21c4d399d291e75165b664762f0aa8bdc4724a (patch) | |
| tree | a3ec954df6e66f6504f4416b37600cedf95dd7e1 /src/library/align.rs | |
| parent | 40b87d4066fe85cb3fde6cf84cd60d748273ae25 (diff) | |
Set Rules Episode III: Revenge of the packer
Diffstat (limited to 'src/library/align.rs')
| -rw-r--r-- | src/library/align.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/library/align.rs b/src/library/align.rs index 76db7fc4..96a1c6c5 100644 --- a/src/library/align.rs +++ b/src/library/align.rs @@ -1,12 +1,19 @@ use super::prelude::*; +use super::ParNode; /// `align`: Configure the alignment along the layouting axes. pub fn align(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> { let aligns = args.expect::<Spec<_>>("alignment")?; let body = args.expect::<Node>("body")?; - // TODO(set): Style paragraphs with x alignment. - Ok(Value::block(body.into_block().aligned(aligns))) + let mut styles = Styles::new(); + if let Some(align) = aligns.x { + styles.set(ParNode::ALIGN, align); + } + + Ok(Value::block( + body.into_block().styled(styles).aligned(aligns), + )) } /// A node that aligns its child. |
