Pass text node to text show rule instead of string
This commit is contained in:
parent
92f2c56203
commit
9b8c1dc19f
@ -167,6 +167,13 @@ impl TextNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn field(&self, name: &str) -> Option<Value> {
|
||||
match name {
|
||||
"text" => Some(Value::Str(self.0.clone().into())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for TextNode {
|
||||
|
@ -419,9 +419,10 @@ impl Recipe {
|
||||
result.push(make(text[cursor..start].into()));
|
||||
}
|
||||
|
||||
let transformed = self
|
||||
.transform
|
||||
.apply(world, self.span, || Value::Str(mat.as_str().into()))?;
|
||||
let transformed = self.transform.apply(world, self.span, || {
|
||||
Value::Content(make(mat.as_str().into()))
|
||||
})?;
|
||||
|
||||
result.push(transformed);
|
||||
cursor = mat.end();
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 46 KiB |
@ -47,6 +47,11 @@ Treeworld, the World of worlds, is a world.
|
||||
#show regex("(?i)rust"): it => [#it (🚀)]
|
||||
Rust is memory-safe and blazingly fast. Let's rewrite everything in rust.
|
||||
|
||||
---
|
||||
// Test accessing the string itself.
|
||||
#show "hello": it => it.text.split("").map(upper).join("|")
|
||||
Oh, hello there!
|
||||
|
||||
---
|
||||
// Replace worlds but only in lists.
|
||||
#show list: it => [
|
||||
|
Loading…
Reference in New Issue
Block a user