mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
add html.to_string_l
This commit is contained in:
parent
091f2f7ff2
commit
5f59174087
1 changed files with 9 additions and 0 deletions
|
|
@ -19,6 +19,15 @@ let to_string ?(top=false) (self:elt) : string =
|
|||
self out;
|
||||
Out.to_string out
|
||||
|
||||
(** Convert a list of HTML elements to a string.
|
||||
This is designed for fragments of HTML that are to be injected inside
|
||||
a bigger context, as it's invalid to have multiple elements at the toplevel
|
||||
of a HTML document. *)
|
||||
let to_string_l (l:elt list) =
|
||||
let out = Out.create () in
|
||||
List.iter (fun f -> f out; Out.add_format_nl out) l;
|
||||
Out.to_string out
|
||||
|
||||
let to_string_top = to_string ~top:true
|
||||
|
||||
(** Convert a HTML element to a stream. This might just convert
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue