diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/library/par.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/library/par.rs')
| -rw-r--r-- | src/library/par.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/library/par.rs b/src/library/par.rs index 0467af44..cf2549bf 100644 --- a/src/library/par.rs +++ b/src/library/par.rs @@ -2,26 +2,19 @@ use super::*; /// `par`: Configure paragraphs. /// -/// # Positional parameters -/// - Body: optional, of type `template`. -/// /// # Named parameters /// - Paragraph spacing: `spacing`, of type `linear` relative to current font size. /// - Line leading: `leading`, of type `linear` relative to current font size. /// - Word spacing: `word-spacing`, of type `linear` relative to current font size. /// /// # Return value -/// A template that configures paragraph properties. The effect is scoped to the -/// body if present. +/// A template that configures paragraph properties. pub fn par(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { let spacing = args.get(ctx, "spacing"); let leading = args.get(ctx, "leading"); let word_spacing = args.get(ctx, "word-spacing"); - let body = args.find::<TemplateValue>(ctx); Value::template("par", move |ctx| { - let snapshot = ctx.state.clone(); - if let Some(spacing) = spacing { ctx.state.par.spacing = spacing; } @@ -35,10 +28,5 @@ pub fn par(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { } ctx.push_parbreak(); - - if let Some(body) = &body { - body.exec(ctx); - ctx.state = snapshot; - } }) } |
