diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-26 13:06:37 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-26 13:06:37 +0200 |
| commit | 285c2f617b74e182be69decea46bbd0afdb0f604 (patch) | |
| tree | 41bdb5d19bc80c165df6e55e829051f0812f7c3d /src/library/spacing.rs | |
| parent | 63cf36149635156013f0324b660bf4d362beb87f (diff) | |
Cleanse library
- Remove doc-comments for Typst functions from library
- Reduce number of library source files
Diffstat (limited to 'src/library/spacing.rs')
| -rw-r--r-- | src/library/spacing.rs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/library/spacing.rs b/src/library/spacing.rs deleted file mode 100644 index b32e97c1..00000000 --- a/src/library/spacing.rs +++ /dev/null @@ -1,39 +0,0 @@ -use super::*; - -/// `h`: Horizontal spacing. -/// -/// # Positional parameters -/// - Amount of spacing: of type `linear` relative to current font size. -/// -/// # Return value -/// A template that inserts horizontal spacing. -pub fn h(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { - spacing_impl("h", ctx, args, GenAxis::Cross) -} - -/// `v`: Vertical spacing. -/// -/// # Positional parameters -/// - Amount of spacing: of type `linear` relative to current font size. -/// -/// # Return value -/// A template that inserts vertical spacing. -pub fn v(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value { - spacing_impl("v", ctx, args, GenAxis::Main) -} - -fn spacing_impl( - name: &str, - ctx: &mut EvalContext, - args: &mut FuncArgs, - axis: GenAxis, -) -> Value { - let spacing: Option<Linear> = args.expect(ctx, "spacing"); - Value::template(name, move |ctx| { - if let Some(linear) = spacing { - // TODO: Should this really always be font-size relative? - let amount = linear.resolve(ctx.state.font.size); - ctx.push_spacing(axis, amount); - } - }) -} |
