package devkit

  1. Overview
  2. Docs

HTML scanner

type elem =
  1. | Tag of string * (string * Raw.t) list
  2. | Script of (string * Raw.t) list * string
    (*

    attributes and contents. TODO investigate script contents encoding

    *)
  3. | Style of (string * Raw.t) list * string
  4. | Text of Raw.t
  5. | Close of string
type ctx
val init : unit -> ctx
val get_lnum : ctx -> int
val parse : ?ctx:ctx -> (elem -> unit) -> string -> unit

Scan string for html tags. NB 1. self-closing tags (e.g. <x/>) will result in two tags generated <x></x> (except for <a/>) 2. unfinished tags at the end of input are ignored

val show_raw : elem -> string
  • returns

    html string for elem

val show_raw' : elem -> string
  • returns

    html string for elem using single quote for attributes

val attrs_include : (string * Raw.t) list -> (string * string) list -> bool
val tag : string -> ?a:(string * string) list -> elem -> bool
val close : string -> elem -> bool
val make_text : ?br:bool -> elem list -> Raw.t

extract text from the list elements

OCaml

Innovation. Community. Security.