123456789101112131415161718192021222324252627282930313233343536373839(** HTML combinators.
This module provides combinators to produce html. It doesn't enforce
the well-formedness of the html, unlike Tyxml, but it's simple and should
be reasonably efficient.
@since 0.12
*)includeTiny_httpd_html_(** @inline *)(** Convert a HTML element to a string.
@param top if true, add DOCTYPE at the beginning. The top element should then
be a "html" tag. *)letto_string?(top=false)(self:elt):string=letout=Out.create()iniftopthenOut.add_stringout"<!DOCTYPE html>\n";selfout;Out.to_stringout(** 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. *)letto_string_l(l:eltlist)=letout=Out.create()inList.iter(funf->fout;Out.add_format_nlout)l;Out.to_stringoutletto_string_top=to_string~top:true(** Convert a HTML element to a stream. This might just convert
it to a string first, do not assume it to be more efficient. *)letto_stream(self:elt):Tiny_httpd_stream.t=Tiny_httpd_stream.of_string@@to_stringself