package oepub

  1. Overview
  2. Docs
type t

the type representing the content of a chapter.

val empty : t

the empty value for a chapter.

val finalize : Buffer.t -> t -> t

finalize buffer content is called at the end of a parsed chapter.

val of_file : filename:string -> media_type:string -> title:string -> EpubArchive.t -> Opf.t -> Toc.t -> t Chapter.t list -> t -> Buffer.t -> string -> (string * t * Buffer.t * t Chapter.t list) option

of_file ~filename ~media_type epub opf toc chpaters content buffer file_bytes is called when a file is being read from the manifest link. If the function returns None, a default handler is called to handle a xml file.

filename refers to the exact name of filename in the epub archive.

val of_tag : tag:string -> title:string -> dirname:string -> (string * string) list -> EpubArchive.t -> Opf.t -> Toc.t -> t Chapter.t list -> t -> Buffer.t -> string * t * Buffer.t * t Chapter.t list

of_tag ~tag ~title ~dirname attributes epub opt toc chapters content buffer is called when an html tag is encontered.

  • tag is the name of the html tag being parsed.
  • title is the name of chapter being parsed.
  • dirname is the name of directory containing the file currently being parsed. dirname is useful if you need to deal with relative links (eg. src attribute the in tag img)

chapters should not be reversed in this function. Newly created chapter should be add a the head of the list.

OCaml

Innovation. Community. Security.