Skip to content

Commit

Permalink
feat: Improve demo in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Olian04 committed Jul 2, 2024
1 parent fae845d commit bb854c8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ import handles
import handles/ctx
pub fn main() {
let assert Ok(template) = handles.prepare("Hello {{name}}")
let assert Ok(greet_template) = prepare("Hello {{.}}!")
let assert Ok(template) =
prepare("{{>greet world}}\n{{>greet community}}\n{{>greet you}}")
let assert Ok(string) =
handles.run(template, ctx.Dict([ctx.Prop("name", ctx.Str("Oliver"))], []))
io.debug(string)
run(
template,
ctx.Dict([
ctx.Prop("world", ctx.Str("World")),
ctx.Prop("community", ctx.Str("Gleam Community")),
ctx.Prop("you", ctx.Str("YOU")),
]),
[#("greet", greet_template)],
)
io.println(string)
}
```

Expand Down

0 comments on commit bb854c8

Please sign in to comment.