Skip to content

Commit a299314

Browse files
committed
Add example to README
1 parent 0c94248 commit a299314

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@ ocaml-mustache
33

44
mustache.js logic-less templates in OCaml
55

6+
7+
Example usage
8+
-------------
9+
10+
```ocaml
11+
let tmpl =
12+
Mustache.of_string "Hello {{name}}\n\
13+
Mustache is:\n\
14+
{{#qualities}}\
15+
* {{name}}\n\
16+
{{/qualities}}"
17+
18+
let json =
19+
`O [ "name", `String "OCaml"
20+
; "qualities", `A [ `O ["name", `String "awesome"]
21+
; `O ["name", `String "simple"]
22+
; `O ["name", `String "fun"]
23+
]
24+
]
25+
26+
let rendered =
27+
Mustache.render tmpl json
28+
```
29+
630
Todo/Wish List
731
-----------
832
* Support for ropes

0 commit comments

Comments
 (0)