From a29931493bad487ec48f9bf97ee97ad35fcad714 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 20 Dec 2016 09:41:22 -0500 Subject: [PATCH] Add example to README --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 499e31d..3d25bb5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,30 @@ ocaml-mustache mustache.js logic-less templates in OCaml + +Example usage +------------- + +```ocaml +let tmpl = + Mustache.of_string "Hello {{name}}\n\ + Mustache is:\n\ + {{#qualities}}\ + * {{name}}\n\ + {{/qualities}}" + +let json = + `O [ "name", `String "OCaml" + ; "qualities", `A [ `O ["name", `String "awesome"] + ; `O ["name", `String "simple"] + ; `O ["name", `String "fun"] + ] + ] + +let rendered = + Mustache.render tmpl json +``` + Todo/Wish List ----------- * Support for ropes