diff --git a/macros/src/lib.rs b/macros/src/lib.rs index b667d2e26..b2dee7c91 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -179,7 +179,7 @@ fn process_const( const NAME: &'static str = #name; - fn node_id() -> TypeId { + fn class_id() -> TypeId { TypeId::of::<#self_ty>() } diff --git a/src/eval/class.rs b/src/eval/class.rs index 91a9daefe..4307eecbd 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 { (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; + fn construct(ctx: &mut EvalContext, args: &mut Args) -> TypResult