devkit.core
Devkit_core.HtmlStream
HTML scanner
devkit
module Raw = HtmlStream_ragel.Raw
type elem =
| Tag of string * (string * Raw.t) list
| Script of (string * Raw.t) list * string
attributes and contents. TODO investigate script contents encoding
| Style of (string * Raw.t) list * string
| Text of Raw.t
| 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
<x/>
<x></x>
<a/>
val show_raw : elem -> string
html string for elem
elem
val show_raw' : elem -> string
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