File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ let escape_html s =
6060 ) s ;
6161 Buffer. contents b
6262
63- let rec to_formatter fmt = function
63+ let rec pp fmt = function
6464
6565 | String s ->
6666 Format. pp_print_string fmt s
@@ -73,11 +73,11 @@ let rec to_formatter fmt = function
7373
7474 | Inverted_section s ->
7575 Format. fprintf fmt " {{^%s}}%a{{/%s}}"
76- s.name to_formatter s.contents s.name
76+ s.name pp s.contents s.name
7777
7878 | Section s ->
7979 Format. fprintf fmt " {{#%s}}%a{{/%s}}"
80- s.name to_formatter s.contents s.name
80+ s.name pp s.contents s.name
8181
8282 | Partial s ->
8383 Format. fprintf fmt " {{> %s }}" s
@@ -86,12 +86,14 @@ let rec to_formatter fmt = function
8686 Format. fprintf fmt " {{! %s }}" s
8787
8888 | Concat s ->
89- List. iter (to_formatter fmt) s
89+ List. iter (pp fmt) s
90+
91+ let to_formatter = pp
9092
9193let to_string x =
9294 let b = Buffer. create 0 in
9395 let fmt = Format. formatter_of_buffer b in
94- to_formatter fmt x ;
96+ pp fmt x ;
9597 Format. pp_print_flush fmt () ;
9698 Buffer. contents b
9799
@@ -200,7 +202,7 @@ let render_fmt ?(strict=true) (fmt : Format.formatter) (m : t) (js : Json.t) =
200202 end
201203
202204 | Partial _ ->
203- to_formatter fmt m
205+ pp fmt m
204206
205207 | Comment c -> ()
206208
Original file line number Diff line number Diff line change @@ -25,9 +25,12 @@ type t
2525val parse_lx : Lexing .lexbuf -> t
2626val of_string : string -> t
2727
28- (* * [to_formatter fmt template] print a template as raw mustache to
28+ (* * [pp fmt template] print a template as raw mustache to
2929 the formatter [fmt]. *)
30+ val pp : Format .formatter -> t -> unit
31+
3032val to_formatter : Format .formatter -> t -> unit
33+ (* * Alias for compatibility *)
3134
3235(* * [to_string template] uses [to_formatter] in order to return
3336 a string representing the template as raw mustache. *)
You can’t perform that action at this time.
0 commit comments