summaryrefslogtreecommitdiff
path: root/src/library/heading.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-22 14:31:09 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-23 14:53:55 +0100
commite1f29d6cb9437a4afb2e4fc4ee10a5b8717ab9fa (patch)
tree1ce5f2bd858f6665d3867a2939d4b474c1b70377 /src/library/heading.rs
parent2bf32c51bceb2f3a8b7ebea3d7c7d6d96757591b (diff)
Rework the core context
Diffstat (limited to 'src/library/heading.rs')
-rw-r--r--src/library/heading.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/library/heading.rs b/src/library/heading.rs
index 49975655..0c9c8e27 100644
--- a/src/library/heading.rs
+++ b/src/library/heading.rs
@@ -37,7 +37,7 @@ impl HeadingNode {
/// Whether the heading is block-level.
pub const BLOCK: Leveled<bool> = Leveled::Value(true);
- fn construct(_: &mut Vm, args: &mut Args) -> TypResult<Template> {
+ fn construct(_: &mut Context, args: &mut Args) -> TypResult<Template> {
Ok(Template::show(Self {
body: args.expect("body")?,
level: args.named("level")?.unwrap_or(1),
@@ -46,16 +46,16 @@ impl HeadingNode {
}
impl Show for HeadingNode {
- fn show(&self, vm: &mut Vm, styles: StyleChain) -> TypResult<Template> {
+ fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult<Template> {
macro_rules! resolve {
($key:expr) => {
- styles.get_cloned($key).resolve(vm, self.level)?
+ styles.get_cloned($key).resolve(ctx, self.level)?
};
}
// Resolve the user recipe.
let mut body = styles
- .show(self, vm, [
+ .show(self, ctx, [
Value::Int(self.level as i64),
Value::Template(self.body.clone()),
])?
@@ -124,13 +124,13 @@ pub enum Leveled<T> {
impl<T: Cast> Leveled<T> {
/// Resolve the value based on the level.
- pub fn resolve(self, vm: &mut Vm, level: usize) -> TypResult<T> {
+ pub fn resolve(self, ctx: &mut Context, level: usize) -> TypResult<T> {
Ok(match self {
Self::Value(value) => value,
Self::Mapping(mapping) => mapping(level),
Self::Func(func, span) => {
let args = Args::from_values(span, [Value::Int(level as i64)]);
- func.call(vm, args)?.cast().at(span)?
+ func.call(ctx, args)?.cast().at(span)?
}
})
}