summaryrefslogtreecommitdiff
path: root/src/eval/func.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval/func.rs')
-rw-r--r--src/eval/func.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/eval/func.rs b/src/eval/func.rs
index b72e9f18..73f2cac9 100644
--- a/src/eval/func.rs
+++ b/src/eval/func.rs
@@ -43,11 +43,11 @@ impl Func {
Self(Arc::new(Repr::Native(Native {
name,
func: |ctx, args| {
- let styles = T::set(args)?;
+ let styles = T::set(args, true)?;
let content = T::construct(ctx, args)?;
Ok(Value::Content(content.styled_with_map(styles.scoped())))
},
- set: Some(T::set),
+ set: Some(|args| T::set(args, false)),
node: T::SHOWABLE.then(|| NodeId::of::<T>()),
})))
}
@@ -165,7 +165,10 @@ pub trait Node: 'static {
fn construct(ctx: &mut Context, args: &mut Args) -> TypResult<Content>;
/// Parse the arguments into style properties for this node.
- fn set(args: &mut Args) -> TypResult<StyleMap>;
+ ///
+ /// When `constructor` is true, [`construct`](Self::construct) will run
+ /// after this invocation of `set`.
+ fn set(args: &mut Args, constructor: bool) -> TypResult<StyleMap>;
}
/// A user-defined closure.