package yocaml_mustache

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file yocaml_mustache.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Renderable = struct
  include Yocaml.Key_value.Jsonm_descriptor

  let to_string ?(strict = true) variables tpl =
    let layout = Mustache.of_string tpl in
    Mustache.render ~strict layout (`O variables)
  ;;
end

include Renderable

let apply_as_template
  (type a)
  (module I : Yocaml.Metadata.INJECTABLE with type t = a)
  ?(strict = true)
  template
  =
  Yocaml.Build.apply_as_template
    (module I)
    (module Renderable)
    ~strict
    template
;;