diff --git a/benches/bench.typ b/benches/bench.typ index 75c97d025..4925db4d8 100644 --- a/benches/bench.typ +++ b/benches/bench.typ @@ -4,15 +4,15 @@ // There are variables and they can take normal values like strings, ... #let city = "Berlin" -// ... but also "template" values. While these contain markup, +// ... but also "content" values. While these contain markup, // they are also values and can be summed, stored in arrays etc. // There are also more standard control flow structures, like #if and #for. #let university = [*Technische Universität {city}*] #let faculty = [*Fakultät II, Institut for Mathematik*] // The `box` function just places content into a rectangular container. When -// the only argument to a function is a template, the parentheses can be omitted -// (i.e. `f[a]` is the same as `f([a])`). +// the only argument to a function is a content block, the parentheses can be +// omitted (i.e. `f[a]` is the same as `f([a])`). #box[ // Backslash adds a forced line break. #university \ @@ -26,8 +26,8 @@ // Adds vertical spacing. #v(6mm) -// If the last argument to a function is a template, we can also place it behind -// the parentheses. +// If the last argument to a function is a content block, we can also place it +// behind the parentheses. #align(center)[ // Markdown-like syntax for headings. ==== 3. Übungsblatt Computerorientierte Mathematik II #v(4mm) diff --git a/benches/oneshot.rs b/benches/oneshot.rs index 9bce185c0..ddd689703 100644 --- a/benches/oneshot.rs +++ b/benches/oneshot.rs @@ -80,7 +80,7 @@ fn bench_eval(iai: &mut Iai) { fn bench_layout(iai: &mut Iai) { let (mut ctx, id) = context(); let module = ctx.evaluate(id).unwrap(); - iai.run(|| module.template.layout(&mut ctx)); + iai.run(|| module.content.layout(&mut ctx)); } fn bench_render(iai: &mut Iai) { diff --git a/src/eval/array.rs b/src/eval/array.rs index 7ff5fb74c..294d28711 100644 --- a/src/eval/array.rs +++ b/src/eval/array.rs @@ -89,7 +89,7 @@ impl Array { a.partial_cmp(b).unwrap_or_else(|| { if result.is_ok() { result = Err(format!( - "cannot compare {} with {}", + "cannot order {} and {}", a.type_name(), b.type_name(), )); diff --git a/src/eval/capture.rs b/src/eval/capture.rs index b27aceb72..4e8d76046 100644 --- a/src/eval/capture.rs +++ b/src/eval/capture.rs @@ -49,8 +49,8 @@ impl<'a> CapturesVisitor<'a> { // through the expressions that contain them). Some(Expr::Ident(ident)) => self.capture(ident), - // Blocks and templates create a scope. - Some(Expr::Code(_) | Expr::Template(_)) => { + // Code and content blocks create a scope. + Some(Expr::Code(_) | Expr::Content(_)) => { self.internal.enter(); for child in node.children() { self.visit(child); diff --git a/src/eval/class.rs b/src/eval/class.rs index 2cced74d5..051916673 100644 --- a/src/eval/class.rs +++ b/src/eval/class.rs @@ -2,24 +2,25 @@ use std::any::TypeId; use std::fmt::{self, Debug, Formatter, Write}; use std::hash::{Hash, Hasher}; -use super::{Args, Func, StyleMap, Template, Value}; +use super::{Args, Content, Func, StyleMap, Value}; use crate::diag::TypResult; use crate::Context; /// 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 a template value, but not +/// class as a callable. This always produces a content value, 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. +/// styling to whatever content 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/content of a heading) /// and style properties (e.g. the fill color of a heading). As the latter are /// often shared by many instances throughout a document, they can also be /// conveniently configured through class's [`set`] rule. Then, they apply to -/// all nodes that are instantiated into the template where the `set` was +/// all nodes that are instantiated into the content block where the `set` was /// executed. /// /// ```typst @@ -55,8 +56,8 @@ impl Class { construct: |ctx, args| { let mut styles = StyleMap::new(); T::set(args, &mut styles)?; - let template = T::construct(ctx, args)?; - Ok(Value::Template(template.styled_with_map(styles.scoped()))) + let content = T::construct(ctx, args)?; + Ok(Value::Content(content.styled_with_map(styles.scoped()))) }, set: T::set, } @@ -80,8 +81,8 @@ impl Class { /// Construct an instance of the class. /// /// This parses both property and data arguments (in this order), styles the - /// template constructed from the data with the style properties and wraps - /// it in a value. + /// content constructed from the data with the style properties and wraps it + /// in a value. pub fn construct(&self, ctx: &mut Context, mut args: Args) -> TypResult { let value = (self.construct)(ctx, &mut args)?; args.finish()?; @@ -126,7 +127,7 @@ pub trait Construct { /// /// This is passed only the arguments that remain after execution of the /// class's set rule. - fn construct(ctx: &mut Context, args: &mut Args) -> TypResult