package tiny_httpd

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

Module Tiny_httpd_htmlSource

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
Sourcemodule Out : sig ... end

Output for HTML combinators.

Sourcetype attribute = string * string

An attribute, i.e. a key/value pair

Sourcetype elt = Out.t -> unit

A html element. It is represented by its output function, so we can directly print it.

Sourcetype void = ?if_:bool -> attribute list -> elt

Element without children.

Sourcetype nary = ?if_:bool -> attribute list -> elt list -> elt

Element with children, represented as a list.

  • parameter if_

    if false, do not print anything (default true)

Sourcetype sub_elt = [
  1. | `E of elt
  2. | `L of elt list
  3. | `S of elt Seq.t
  4. | `Nil
]

A chunk of sub-elements, possibly empty.

Sourcetype nary' = ?if_:bool -> attribute list -> sub_elt list -> elt

Element with children, represented as a list of sub_elt to be flattened

  • parameter if_

    if false, do not print anything (default true)

Sourceval sub_e : elt -> sub_elt

Sub-element with a single element inside.

Sourceval sub_l : elt list -> sub_elt

Sub-element with a list of items inside.

Sourceval sub_seq : elt Seq.t -> sub_elt

Sub-element with a sequence (Seq.t) of items inside.

Sourceval seq_of_array : 'a array -> 'a Seq.t

Helper to build a Seq.t from an array.

Sourceval sub_empty : sub_elt

Sub-element with nothing inside. Useful in conditionals, when one decides not to emit a sub-element at all.

Sourceval txt : string -> elt

Emit a string value, which will be escaped.

Sourceval txtf : ('a, Format.formatter, unit, Out.t -> unit) format4 -> 'a

Formatted version of txt

Sourceval raw_html : string -> elt

Emit raw HTML. Caution, this can lead to injection vulnerabilities, never use with text that comes from untrusted users.

Sourceval area : void

tag "area", see mdn

Sourceval base : void

tag "base", see mdn

Sourceval br : void

tag "br", see mdn

Sourceval col : void

tag "col", see mdn

Sourceval embed : void

tag "embed", see mdn

Sourceval hr : void

tag "hr", see mdn

Sourceval img : void

tag "img", see mdn

Sourceval input : void

tag "input", see mdn

tag "link", see mdn

Sourceval menuitem : void

tag "menuitem", see mdn

Sourceval meta : void

tag "meta", see mdn

Sourceval param : void

tag "param", see mdn

Sourceval source : void

tag "source", see mdn

Sourceval track : void

tag "track", see mdn

Sourceval wbr : void

tag "wbr", see mdn

Sourceval a : nary

tag "a", see mdn

Sourceval a' : nary'

tag "a", see mdn

Sourceval abbr : nary

tag "abbr", see mdn

Sourceval abbr' : nary'

tag "abbr", see mdn

Sourceval address : nary

tag "address", see mdn

Sourceval address' : nary'

tag "address", see mdn

Sourceval article : nary

tag "article", see mdn

Sourceval article' : nary'

tag "article", see mdn

Sourceval aside : nary

tag "aside", see mdn

Sourceval aside' : nary'

tag "aside", see mdn

Sourceval audio : nary

tag "audio", see mdn

Sourceval audio' : nary'

tag "audio", see mdn

Sourceval b : nary

tag "b", see mdn

Sourceval b' : nary'

tag "b", see mdn

Sourceval bdi : nary

tag "bdi", see mdn

Sourceval bdi' : nary'

tag "bdi", see mdn

Sourceval bdo : nary

tag "bdo", see mdn

Sourceval bdo' : nary'

tag "bdo", see mdn

Sourceval blockquote : nary

tag "blockquote", see mdn

Sourceval blockquote' : nary'

tag "blockquote", see mdn

Sourceval body : nary

tag "body", see mdn

Sourceval body' : nary'

tag "body", see mdn

Sourceval button : nary

tag "button", see mdn

Sourceval button' : nary'

tag "button", see mdn

Sourceval canvas : nary

tag "canvas", see mdn

Sourceval canvas' : nary'

tag "canvas", see mdn

Sourceval caption : nary

tag "caption", see mdn

Sourceval caption' : nary'

tag "caption", see mdn

Sourceval cite : nary

tag "cite", see mdn

Sourceval cite' : nary'

tag "cite", see mdn

Sourceval code : nary

tag "code", see mdn

Sourceval code' : nary'

tag "code", see mdn

Sourceval colgroup : nary

tag "colgroup", see mdn

Sourceval colgroup' : nary'

tag "colgroup", see mdn

Sourceval data : nary

tag "data", see mdn

Sourceval data' : nary'

tag "data", see mdn

Sourceval datalist : nary

tag "datalist", see mdn

Sourceval datalist' : nary'

tag "datalist", see mdn

Sourceval dd : nary

tag "dd", see mdn

Sourceval dd' : nary'

tag "dd", see mdn

Sourceval del : nary

tag "del", see mdn

Sourceval del' : nary'

tag "del", see mdn

Sourceval details : nary

tag "details", see mdn

Sourceval details' : nary'

tag "details", see mdn

Sourceval dfn : nary

tag "dfn", see mdn

Sourceval dfn' : nary'

tag "dfn", see mdn

Sourceval dialog : nary

tag "dialog", see mdn

Sourceval dialog' : nary'

tag "dialog", see mdn

Sourceval div : nary

tag "div", see mdn

Sourceval div' : nary'

tag "div", see mdn

Sourceval dl : nary

tag "dl", see mdn

Sourceval dl' : nary'

tag "dl", see mdn

Sourceval dt : nary

tag "dt", see mdn

Sourceval dt' : nary'

tag "dt", see mdn

Sourceval em : nary

tag "em", see mdn

Sourceval em' : nary'

tag "em", see mdn

Sourceval fieldset : nary

tag "fieldset", see mdn

Sourceval fieldset' : nary'

tag "fieldset", see mdn

Sourceval figcaption : nary

tag "figcaption", see mdn

Sourceval figcaption' : nary'

tag "figcaption", see mdn

Sourceval figure : nary

tag "figure", see mdn

Sourceval figure' : nary'

tag "figure", see mdn

tag "footer", see mdn

Sourceval footer' : nary'

tag "footer", see mdn

Sourceval form : nary

tag "form", see mdn

Sourceval form' : nary'

tag "form", see mdn

Sourceval h1 : nary

tag "h1", see mdn

Sourceval h1' : nary'

tag "h1", see mdn

Sourceval h2 : nary

tag "h2", see mdn

Sourceval h2' : nary'

tag "h2", see mdn

Sourceval h3 : nary

tag "h3", see mdn

Sourceval h3' : nary'

tag "h3", see mdn

Sourceval h4 : nary

tag "h4", see mdn

Sourceval h4' : nary'

tag "h4", see mdn

Sourceval h5 : nary

tag "h5", see mdn

Sourceval h5' : nary'

tag "h5", see mdn

Sourceval h6 : nary

tag "h6", see mdn

Sourceval h6' : nary'

tag "h6", see mdn

Sourceval head : nary

tag "head", see mdn

Sourceval head' : nary'

tag "head", see mdn

Sourceval header : nary

tag "header", see mdn

Sourceval header' : nary'

tag "header", see mdn

Sourceval hgroup : nary

tag "hgroup", see mdn

Sourceval hgroup' : nary'

tag "hgroup", see mdn

Sourceval html : nary

tag "html", see mdn

Sourceval html' : nary'

tag "html", see mdn

Sourceval i : nary

tag "i", see mdn

Sourceval i' : nary'

tag "i", see mdn

Sourceval iframe : nary

tag "iframe", see mdn

Sourceval iframe' : nary'

tag "iframe", see mdn

Sourceval ins : nary

tag "ins", see mdn

Sourceval ins' : nary'

tag "ins", see mdn

Sourceval kbd : nary

tag "kbd", see mdn

Sourceval kbd' : nary'

tag "kbd", see mdn

Sourceval label : nary

tag "label", see mdn

Sourceval label' : nary'

tag "label", see mdn

Sourceval legend : nary

tag "legend", see mdn

Sourceval legend' : nary'

tag "legend", see mdn

Sourceval li : nary

tag "li", see mdn

Sourceval li' : nary'

tag "li", see mdn

Sourceval main : nary

tag "main", see mdn

Sourceval main' : nary'

tag "main", see mdn

Sourceval map : nary

tag "map", see mdn

Sourceval map' : nary'

tag "map", see mdn

Sourceval mark : nary

tag "mark", see mdn

Sourceval mark' : nary'

tag "mark", see mdn

Sourceval math : nary

tag "math", see mdn

Sourceval math' : nary'

tag "math", see mdn

Sourceval menu : nary

tag "menu", see mdn

Sourceval menu' : nary'

tag "menu", see mdn

Sourceval meter : nary

tag "meter", see mdn

Sourceval meter' : nary'

tag "meter", see mdn

Sourceval nav : nary

tag "nav", see mdn

Sourceval nav' : nary'

tag "nav", see mdn

Sourceval noscript : nary

tag "noscript", see mdn

Sourceval noscript' : nary'

tag "noscript", see mdn

Sourceval object_ : nary

tag "object", see mdn

Sourceval object_' : nary'

tag "object", see mdn

Sourceval ol : nary

tag "ol", see mdn

Sourceval ol' : nary'

tag "ol", see mdn

Sourceval optgroup : nary

tag "optgroup", see mdn

Sourceval optgroup' : nary'

tag "optgroup", see mdn

Sourceval option : nary

tag "option", see mdn

Sourceval option' : nary'

tag "option", see mdn

Sourceval output : nary

tag "output", see mdn

Sourceval output' : nary'

tag "output", see mdn

Sourceval p : nary

tag "p", see mdn

Sourceval p' : nary'

tag "p", see mdn

Sourceval picture : nary

tag "picture", see mdn

Sourceval picture' : nary'

tag "picture", see mdn

Sourceval pre : nary

tag "pre", see mdn

Sourceval pre' : nary'

tag "pre", see mdn

Sourceval progress : nary

tag "progress", see mdn

Sourceval progress' : nary'

tag "progress", see mdn

Sourceval q : nary

tag "q", see mdn

Sourceval q' : nary'

tag "q", see mdn

Sourceval rb : nary

tag "rb", see mdn

Sourceval rb' : nary'

tag "rb", see mdn

Sourceval rp : nary

tag "rp", see mdn

Sourceval rp' : nary'

tag "rp", see mdn

Sourceval rt : nary

tag "rt", see mdn

Sourceval rt' : nary'

tag "rt", see mdn

Sourceval rtc : nary

tag "rtc", see mdn

Sourceval rtc' : nary'

tag "rtc", see mdn

Sourceval ruby : nary

tag "ruby", see mdn

Sourceval ruby' : nary'

tag "ruby", see mdn

Sourceval s : nary

tag "s", see mdn

Sourceval s' : nary'

tag "s", see mdn

Sourceval samp : nary

tag "samp", see mdn

Sourceval samp' : nary'

tag "samp", see mdn

Sourceval script : nary

tag "script", see mdn

Sourceval script' : nary'

tag "script", see mdn

Sourceval section : nary

tag "section", see mdn

Sourceval section' : nary'

tag "section", see mdn

Sourceval select : nary

tag "select", see mdn

Sourceval select' : nary'

tag "select", see mdn

Sourceval slot : nary

tag "slot", see mdn

Sourceval slot' : nary'

tag "slot", see mdn

Sourceval small : nary

tag "small", see mdn

Sourceval small' : nary'

tag "small", see mdn

Sourceval span : nary

tag "span", see mdn

Sourceval span' : nary'

tag "span", see mdn

Sourceval strong : nary

tag "strong", see mdn

Sourceval strong' : nary'

tag "strong", see mdn

Sourceval style : nary

tag "style", see mdn

Sourceval style' : nary'

tag "style", see mdn

Sourceval sub : nary

tag "sub", see mdn

Sourceval sub' : nary'

tag "sub", see mdn

Sourceval summary : nary

tag "summary", see mdn

Sourceval summary' : nary'

tag "summary", see mdn

Sourceval sup : nary

tag "sup", see mdn

Sourceval sup' : nary'

tag "sup", see mdn

Sourceval svg : nary

tag "svg", see mdn

Sourceval svg' : nary'

tag "svg", see mdn

Sourceval table : nary

tag "table", see mdn

Sourceval table' : nary'

tag "table", see mdn

Sourceval tbody : nary

tag "tbody", see mdn

Sourceval tbody' : nary'

tag "tbody", see mdn

Sourceval td : nary

tag "td", see mdn

Sourceval td' : nary'

tag "td", see mdn

Sourceval template : nary

tag "template", see mdn

Sourceval template' : nary'

tag "template", see mdn

Sourceval textarea : nary

tag "textarea", see mdn

Sourceval textarea' : nary'

tag "textarea", see mdn

Sourceval tfoot : nary

tag "tfoot", see mdn

Sourceval tfoot' : nary'

tag "tfoot", see mdn

Sourceval th : nary

tag "th", see mdn

Sourceval th' : nary'

tag "th", see mdn

Sourceval thead : nary

tag "thead", see mdn

Sourceval thead' : nary'

tag "thead", see mdn

Sourceval time : nary

tag "time", see mdn

Sourceval time' : nary'

tag "time", see mdn

Sourceval title : nary

tag "title", see mdn

Sourceval title' : nary'

tag "title", see mdn

Sourceval tr : nary

tag "tr", see mdn

Sourceval tr' : nary'

tag "tr", see mdn

Sourceval u : nary

tag "u", see mdn

Sourceval u' : nary'

tag "u", see mdn

Sourceval ul : nary

tag "ul", see mdn

Sourceval ul' : nary'

tag "ul", see mdn

Sourceval var : nary

tag "var", see mdn

Sourceval var' : nary'

tag "var", see mdn

Sourceval video : nary

tag "video", see mdn

Sourceval video' : nary'

tag "video", see mdn

Sourcemodule A : sig ... end

Attributes.

Sourceval to_output : ?top:bool -> elt -> Tiny_httpd_core.IO.Output.t -> unit

Write an HTML element to this output.

  • parameter top

    if true, add DOCTYPE at the beginning. The top element should then be a "html" tag.

  • since 0.14
Sourceval to_string : ?top:bool -> elt -> string

Convert a HTML element to a string.

  • parameter top

    if true, add DOCTYPE at the beginning. The top element should then be a "html" tag.

Sourceval to_string_l : elt list -> string

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.

Sourceval to_string_top : elt -> string
Sourceval to_out_channel_top : elt -> Tiny_httpd_core.IO.Output.t -> unit

Write a toplevel element to an output channel.

  • since 0.14
Sourceval to_writer : ?top:bool -> elt -> Tiny_httpd_core.IO.Writer.t

Produce a streaming writer from this HTML element.

  • parameter top

    if true, add a DOCTYPE. See to_out_channel.

  • since 0.14

Convert a HTML element to a stream. This might just convert it to a string first, do not assume it to be more efficient.

OCaml

Innovation. Community. Security.