diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-02 16:02:23 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-02 16:02:23 +0100 |
| commit | a7b403fd742941f6b163f06876aec96729db707f (patch) | |
| tree | b5062eddbcb814713b65f59d3f59dfe7e2bcaca8 /src/eval/class.rs | |
| parent | 0a1916c1e4259aff1306b26c06d4edcf0f190a3b (diff) | |
Rename `Node` to `Template`
Diffstat (limited to 'src/eval/class.rs')
| -rw-r--r-- | src/eval/class.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/eval/class.rs b/src/eval/class.rs index 91a9daef..4307eecb 100644 --- a/src/eval/class.rs +++ b/src/eval/class.rs @@ -1,15 +1,15 @@ use std::fmt::{self, Debug, Formatter, Write}; -use super::{Args, EvalContext, Func, Node, StyleMap, Value}; +use super::{Args, EvalContext, Func, StyleMap, Template, Value}; use crate::diag::TypResult; -/// A class of [nodes](Node). +/// A class of nodes. /// /// You can [construct] an instance of a class in Typst code by invoking the -/// class as a callable. This always produces some node, but not necessarily one -/// of fixed type. For example, the `text` constructor does not actually create -/// a [`TextNode`]. Instead it applies styling to whatever node you pass in and -/// returns it structurally unchanged. +/// class as a callable. This always produces a template, but not necessarily a +/// simple inline or block node. For example, the `text` constructor does not +/// actually create a [`TextNode`]. Instead it applies styling to whatever node +/// you pass in and returns it structurally unchanged. /// /// The arguments you can pass to a class constructor fall into two categories: /// Data that is inherent to the instance (e.g. the text of a heading) and style @@ -50,8 +50,8 @@ impl Class { construct: |ctx, args| { let mut styles = StyleMap::new(); T::set(args, &mut styles)?; - let node = T::construct(ctx, args)?; - Ok(Value::Node(node.styled_with_map(styles.scoped()))) + let template = T::construct(ctx, args)?; + Ok(Value::Template(template.styled_with_map(styles.scoped()))) }, set: T::set, } @@ -65,7 +65,7 @@ impl Class { /// Construct an instance of the class. /// /// This parses both property and data arguments (in this order) and styles - /// the node constructed from the data with the style properties. + /// the template constructed from the data with the style properties. pub fn construct(&self, ctx: &mut EvalContext, args: &mut Args) -> TypResult<Value> { (self.construct)(ctx, args) } @@ -104,7 +104,7 @@ pub trait Construct { /// /// This is passed only the arguments that remain after execution of the /// class's set rule. - fn construct(ctx: &mut EvalContext, args: &mut Args) -> TypResult<Node>; + fn construct(ctx: &mut EvalContext, args: &mut Args) -> TypResult<Template>; } /// Set style properties of a class. |
