package mustache
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=8b0a04af0cb897fdba41fd946fa1b6cdb3982ca0db604e13ee0977585ff4c45d
md5=ee15623d0f699b6aff31904fedf4945e
doc/mustache/Mustache/index.html
Module MustacheSource
A module for creating and rendering mustache templates in OCaml.
Raised when a missing variable in a template is not substituted
type t = | String of string| Escaped of dotted_name| Section of section| Unescaped of dotted_name| Partial of partial| Inverted_section of section| Concat of t list| Comment of string
Read
pp fmt template print a template as raw mustache to the formatter fmt.
Alias for compatibility
to_string template uses to_formatter in order to return a string representing the template as raw mustache.
val render_fmt :
?strict:bool ->
?partials:(name -> t option) ->
Format.formatter ->
t ->
Json.t ->
unitrender_fmt fmt template json render template, filling it with data from json, printing it to formatter fmt.
For each partial p, if partials p is Some t then the partial is substituted by t. Otherwise, the partial is substituted by the empty string is strict is false. If strict is true, the Missing_partial exception is raised.
render template json use render_fmt to render template with data from json and returns the resulting string.
val fold :
string:(string -> 'a) ->
section:(inverted:bool -> dotted_name -> 'a -> 'a) ->
escaped:(dotted_name -> 'a) ->
unescaped:(dotted_name -> 'a) ->
partial:(int -> name -> t option Lazy.t -> 'a) ->
comment:(string -> 'a) ->
concat:('a list -> 'a) ->
t ->
'afold template is the composition of f over parts of template, called in order of occurrence, where each f is one of the labelled arguments applied to the corresponding part. The default for f is the identity function.
expand_partials f template is template where for each Partial p node, p.contents now evaluates to f p.name if they were evaluating to None. Note that no lazy is forced at this point, and calls to f are delayed until p.contents is forced.
Escape &, "\"", ', < and > character for html rendering.
{{name}}
{{{name}}}
{{^person}} {{/person}}
{{#person}} {{/person}}
Variant of the t mustache datatype which includes source-file locations, and associated functions.
Erase locations from a mustache value of type With_locations.t.
Add the dummy_loc location to each node of a mustache value of type t.