3.19) The HTML compiler.

type AnchorMode = HREF | NAME;;
type AnchorType = 
{ 
  mutable AnchorType : AnchorMode; 
  mutable AnchorFile : string; 
  mutable AnchorName : string
};;
The type AnchorType is composed of values that define a HTML anchor. It can be an anchor (AnchorType=NAME) or a reference (AnchorType=HREF).
type AlignType = AlignBottom | AlignTop | AlignMiddle;;

type ImageType = 
{ 
  mutable ImageAlign : AlignType; 
  mutable ImageFile : string; 
  mutable ImageAlt : string 
};;
type HTML_type = ANCHOR     of AnchorType
               | HtmlText   of string
               | H1         of HTML_type list
               | H2         of HTML_type list
               | H3         of HTML_type list
               | H4         of HTML_type list
               | H5         of HTML_type list
               | H6         of HTML_type list
               | LineBreak
               | UList      of HTML_type list
               | OList      of HTML_type list 
               | DList      of HTML_type list 
               | DD         of HTML_type list
               | DT         of HTML_type list
               | LI         of HTML_type list
               | PRE        of HTML_type list
               | BLOCKQUOTE of HTML_type list
               | ADDRESS    of HTML_type list
               | DFN        of HTML_type list
               | EM         of HTML_type list
               | CITE       of HTML_type list
               | CODE       of HTML_type list
               | KBD        of HTML_type list
               | SAMP       of HTML_type list
               | STRONG     of HTML_type list
               | VAR        of HTML_type list
               | BOLD       of HTML_type list
               | ITALIC     of HTML_type list
               | TT         of HTML_type list
               | IMG        of ImageType 
               | HLine
               | Ignore     of string
;;
the HTML_type list code an HTML file into a tree that represents the document structure.
gr_html_interpreter : in_channel -> HTML_type list
gr_html_interpreter in_file computes the HTML file in_file into the HTML_type list. This computation is necessary in order to display the file.
gr_html_save : HTML_type list -> out_channel -> unit
gr_html_save HtmlList out_file writes the internal HTML tree in out_file. The file format is HTML.
gr_save_HTML_type : string -> HTML_type list -> out_channel -> unit
gr_save_HTML_type Title HtmlList out_file writes the caml code that code the internal tree. The file can be compiled with camlc.
gr_html_anchor_list : HTML_type list -> AnchorType list