Module Markup_lwtSource

Lwt interface to Markup.ml.

The majority of the functions in this interface are listed in the signature Markup.ASYNCHRONOUS, and are not directly included on this page. There are also additional Lwt functions in module Markup_lwt_unix. Those are based on Lwt_io, and have been separated to make this module Markup_lwt usable on js_of_ocaml, which does not support Lwt_io.

This module is available if Markup.ml is installed when Lwt is installed, i.e.

opam install lwt markup

To link with this module, depend on the findlib package markup.lwt instead of package markup.

include Markup.ASYNCHRONOUS with type 'a io := 'a Lwt.t

Promises

Encodings

Sourcemodule Encoding : sig ... end

Asynchronous counterpart to Markup.Encoding.

XML

Sourceval parse_xml : ?report:(Markup.location -> Markup.Error.t -> unit Lwt.t) -> ?encoding:Encoding.t -> ?namespace:(string -> string option) -> ?entity:(string -> string option) -> ?context:[< `Document | `Fragment ] -> (char, _) Markup.stream -> Markup.async Markup.parser
Sourceval write_xml : ?report:((Markup.signal * int) -> Markup.Error.t -> unit Lwt.t) -> ?prefix:(string -> string option) -> ([< Markup.signal ], _) Markup.stream -> (char, Markup.async) Markup.stream

HTML

Sourceval parse_html : ?report:(Markup.location -> Markup.Error.t -> unit Lwt.t) -> ?encoding:Encoding.t -> ?context:[< `Document | `Fragment of string ] -> (char, _) Markup.stream -> Markup.async Markup.parser
Sourceval write_html : ?escape_attribute:(string -> string) -> ?escape_text:(string -> string) -> ([< Markup.signal ], _) Markup.stream -> (char, Markup.async) Markup.stream

I/O

Sourceval fn : (unit -> char option Lwt.t) -> (char, Markup.async) Markup.stream
Sourceval to_string : (char, _) Markup.stream -> string Lwt.t
Sourceval to_buffer : (char, _) Markup.stream -> Buffer.t Lwt.t

Stream manipulation

Sourceval stream : (unit -> 'a option Lwt.t) -> ('a, Markup.async) Markup.stream
Sourceval next : ('a, _) Markup.stream -> 'a option Lwt.t
Sourceval peek : ('a, _) Markup.stream -> 'a option Lwt.t
Sourceval transform : ('a -> 'b -> ('c list * 'a option) Lwt.t) -> 'a -> ('b, _) Markup.stream -> ('c, Markup.async) Markup.stream
Sourceval fold : ('a -> 'b -> 'a Lwt.t) -> 'a -> ('b, _) Markup.stream -> 'a Lwt.t
Sourceval map : ('a -> 'b Lwt.t) -> ('a, _) Markup.stream -> ('b, Markup.async) Markup.stream
Sourceval filter : ('a -> bool Lwt.t) -> ('a, _) Markup.stream -> ('a, Markup.async) Markup.stream
Sourceval filter_map : ('a -> 'b option Lwt.t) -> ('a, _) Markup.stream -> ('b, Markup.async) Markup.stream
Sourceval iter : ('a -> unit Lwt.t) -> ('a, _) Markup.stream -> unit Lwt.t
Sourceval drain : ('a, _) Markup.stream -> unit Lwt.t
Sourceval to_list : ('a, _) Markup.stream -> 'a list Lwt.t

load s converts a general stream s to a synchronous stream by buffering it.

Utility

Sourceval tree : ?text:(string list -> 'a) -> ?element:(Markup.name -> (Markup.name * string) list -> 'a list -> 'a) -> ?comment:(string -> 'a) -> ?pi:(string -> string -> 'a) -> ?xml:(Markup.xml_declaration -> 'a) -> ?doctype:(Markup.doctype -> 'a) -> ([< Markup.signal ], _) Markup.stream -> 'a option Lwt.t
Sourceval lwt_stream : 'a Lwt_stream.t -> ('a, Markup.async) Markup.stream

Adapts an Lwt stream to a Markup.ml stream.

Sourceval to_lwt_stream : ('a, _) Markup.stream -> 'a Lwt_stream.t

Adapts a Markup.ml stream to an Lwt stream.

Sourceval ensure_tail_calls : ?hook:(exn -> unit) ref -> unit -> unit
  • deprecated

    Not necessary since Markup.ml 0.7.4.