summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-08-02 22:21:58 +0200
committerLaurenz <laurmaedje@gmail.com>2020-08-02 22:21:58 +0200
commit5a8f2fb73ddafba9fdbe952385ae2676126183ae (patch)
treef65dcc5c8fc3809171e0cc1a985d466159ccb254 /src/library
parent266d457292e7461d448f9141030028ea68b573d1 (diff)
Replace body! macro with functions 🧰
Diffstat (limited to 'src/library')
-rw-r--r--src/library/font.rs4
-rw-r--r--src/library/layout.rs8
-rw-r--r--src/library/mod.rs4
-rw-r--r--src/library/page.rs2
-rw-r--r--src/library/spacing.rs2
5 files changed, 10 insertions, 10 deletions
diff --git a/src/library/font.rs b/src/library/font.rs
index efcbb86f..21ac14c7 100644
--- a/src/library/font.rs
+++ b/src/library/font.rs
@@ -17,7 +17,7 @@ function! {
classes: Vec<(String, Vec<String>)>,
}
- parse(header, body, ctx, f) {
+ parse(header, body, state, f) {
let size = header.args.pos.get::<ScaleLength>();
let style = header.args.key.get::<FontStyle>("style", f);
@@ -41,7 +41,7 @@ function! {
.collect();
FontFunc {
- body: body!(opt: body, ctx, f),
+ body: parse_maybe_body(body, state, f),
size,
style,
weight,
diff --git a/src/library/layout.rs b/src/library/layout.rs
index d46265a4..d6d02436 100644
--- a/src/library/layout.rs
+++ b/src/library/layout.rs
@@ -12,9 +12,9 @@ function! {
height: Option<ScaleLength>,
}
- parse(header, body, ctx, f) {
+ parse(header, body, state, f) {
BoxFunc {
- body: body!(opt: body, ctx, f).unwrap_or(SyntaxTree::new()),
+ body: parse_maybe_body(body, state, f).unwrap_or(SyntaxTree::new()),
width: header.args.key.get::<ScaleLength>("width", f),
height: header.args.key.get::<ScaleLength>("height", f),
}
@@ -56,9 +56,9 @@ function! {
v: Option<Spanned<SpecAlign>>,
}
- parse(header, body, ctx, f) {
+ parse(header, body, state, f) {
AlignFunc {
- body: body!(opt: body, ctx, f),
+ body: parse_maybe_body(body, state, f),
aligns: header.args.pos.all::<Spanned<SpecAlign>>().collect(),
h: header.args.key.get::<Spanned<SpecAlign>>("horizontal", f),
v: header.args.key.get::<Spanned<SpecAlign>>("vertical", f),
diff --git a/src/library/mod.rs b/src/library/mod.rs
index 7a664257..7240e42b 100644
--- a/src/library/mod.rs
+++ b/src/library/mod.rs
@@ -1,4 +1,4 @@
-//! The _Typst_ standard library.
+//! The standard library.
use crate::func::prelude::*;
use crate::layout::{LayoutContext, Commands};
@@ -37,7 +37,7 @@ function! {
parse(header, body, state, f) {
header.args.pos.0.clear();
header.args.key.0.clear();
- ValFunc { body: body!(opt: body, state, f) }
+ ValFunc { body: parse_maybe_body(body, state, f), }
}
layout(self, ctx, f) {
diff --git a/src/library/page.rs b/src/library/page.rs
index d1964fd2..faf08ee0 100644
--- a/src/library/page.rs
+++ b/src/library/page.rs
@@ -20,7 +20,7 @@ function! {
}
parse(header, body, state, f) {
- body!(nope: body, f);
+ expect_no_body(body, f);
PageFunc {
paper: header.args.pos.get::<Paper>(),
width: header.args.key.get::<Length>("width", f),
diff --git a/src/library/spacing.rs b/src/library/spacing.rs
index 22c4669e..d8263694 100644
--- a/src/library/spacing.rs
+++ b/src/library/spacing.rs
@@ -34,7 +34,7 @@ function! {
type Meta = SpecAxis;
parse(header, body, state, f, meta) {
- body!(nope: body, f);
+ expect_no_body(body, f);
SpacingFunc {
spacing: header.args.pos.expect::<ScaleLength>(f)
.map(|s| (meta, s))