Source

yetis-mustache /

Filename Size Date modified Message
src
6 B
1.2 KB
2.4 KB

Yeti's Mustache

Description

Implementation of Mustache in Yeti.

Usage

mustache is string -> hash<string, (Boolean boolean
| Function string -> string
| List list?<hash<string, 'a>>
| Number 'b
| String string is 'a)> -> hash<string, string> -> string

Here's an example:

template = "{{#uppercase}}{{header}}{{/uppercase}}";
vars = ["header": String "Test", "uppercase": Function strUpper];
partials = [:];
println (mustache template vars partials)

You can run tests with mvn verify. Install the package to your local repository with mvn install.

Problems

Mustache doesn't seem to define how setting delimeters should work inside blocks. What should happen in this case?

template = "{{#l}}{{=<? ?>=}}<?name?>{{/l}}";
vars = [
    "l": List [
        ["name": String "Brian"],
        ["name": String "Ben"]
    ]
];
println (mustache template vars [])

I've implemented it so that different delimeters will only apply to the current context (block).