package oepub
Module type Book.ChapterContentSource
Input signature of the functor Make. This module type drives how the content into the epub archive should be parsed to build a book. It also describes the type of content in each chapter.
Each function in ChapterContent are called at different stages of the parsing.
val empty : tthe empty value for a 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) optionof_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 listof_tag ~tag ~title ~dirname attributes epub opt toc chapters content buffer is called when an html tag is encontered.
tagis the name of the html tag being parsed.titleis the name of chapter being parsed.dirnameis the name of directory containing the file currently being parsed.dirnameis 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.