package bracetax

  1. Overview
  2. Docs

This module is the main entry point to use bracetax as a library.

The functions here are used to transform Bracetax input to the formats currently handled by the library (XHTML, LaTeX, or a bracetax table of contents).

val brtx_to_html : writer:Bracetax_HTML_printer.Signatures.writer -> ?make_section_links:[ `always | `never | `when_labeled ] -> ?doc:bool -> ?title:string -> ?css_link:string -> ?print_comments:bool -> ?filename:string -> ?class_hook:string -> ?img_hook:(string -> string) -> ?url_hook:(string -> string) -> input_char:(unit -> char option) -> ?separate_header:(string * string * string) ref -> ?deny_bypass:bool -> unit -> unit

Transformation from Bracetax to HTML (actually almost XHTML). Most optional parameters correspond to command line options of brtx -html.

  • parameter writer

    The Signatures.writer to use for output.

  • parameter doc

    If true, output a whole document with header and footer (Default: false)).

  • parameter title

    If doc = true, use title as HTML header title.

  • parameter css_link

    Add a "meta" link to a CSS URL.

  • parameter print_comments

    If true, output Bracetax comments as HTML comments (Default: false).

  • parameter filename

    Filename used in error messages (Default: "<IN>"))

  • parameter class_hook

    Add a

    class="class_hook"

    to all tags in the HTML (it is the -css-hook option of brtx).

  • parameter img_hook

    A "hook" function to transform each image path.

  • parameter url_hook

    A "hook" function to transform each URL.

  • parameter input_char

    The "input" function.

  • parameter separate_header

    If this reference is provided, after the call to brtx_to_html, this reference will contain the title, authors, and subtitle fields; and they won't be output to the writer.

  • parameter deny_bypass

    If true, treat \{bypass\} commands as \{code\} (Default: false).

val brtx_to_latex : writer:Bracetax_latex_printer.Signatures.writer -> ?doc:bool -> ?title:string -> ?use_package:string -> ?deny_bypass:bool -> ?print_comments:bool -> ?href_is_footnote:bool -> ?img_hook:(string -> string) -> ?url_hook:(string -> string) -> ?separate_header:(string * string * string) ref -> ?table_caption_after:bool -> ?filename:string -> input_char:(unit -> char option) -> unit -> unit

Transform from Bracetax to LaTeX. Most parameters have the same meaning as for brtx_to_html, except the following ones.

  • parameter title

    The title will be used for the PDF meta-data (for doc = true).

  • parameter use_package

    Add a \\usepackage\{<package>\} call in the LaTeX header (doc = true).

  • parameter href_is_footnote

    If true, render links as footnotes (Default: false).

val get_TOC : writer:Bracetax_generic_printer.Signatures.writer -> ?filename:string -> ?make_links:[ `always | `never | `when_labeled ] -> ?list_type:[ `enum | `item ] -> ?numbering:[ `integers | `none ] -> input_char:(unit -> char option) -> unit -> unit

Retrieve a table of contents from a Bracetax input. The TOC is itself in Bracetax; it is a set of lists with links.

val string_io : string -> Buffer.t -> Buffer.t -> Bracetax_signatures.writer * (unit -> char option)

Create a writer and a input_char from a string and two Buffer.t. With let w, ic = (string_io input_str output_buffer error_buffer), the writer w will write to output_buffer, transform errors to strings, and output them to error_buffer; ic will take characters from input_str. w and ic can then be used with brtx_to_html and brtx_to_latex.

val str_to_html : ?make_section_links:[ `always | `never | `when_labeled ] -> ?doc:bool -> ?title:string -> ?css_link:string -> ?print_comments:bool -> ?filename:string -> ?class_hook:string -> ?img_hook:(string -> string) -> ?url_hook:(string -> string) -> ?separate_header:(string * string * string) ref -> ?deny_bypass:bool -> string -> string * Bracetax_signatures.Error.error list

This function is a convenience replacement for brtx_to_html, to transform a string into another string together with a list of Error.errors.

val str_to_latex : ?doc:bool -> ?title:string -> ?use_package:string -> ?deny_bypass:bool -> ?print_comments:bool -> ?href_is_footnote:bool -> ?img_hook:(string -> string) -> ?url_hook:(string -> string) -> ?table_caption_after:bool -> ?separate_header:(string * string * string) ref -> ?filename:string -> string -> string * Bracetax_signatures.Error.error list

This function is a convenience replacement for brtx_to_latex, to transform a string into another string together with a list of Error.errors.

val str_to_TOC : ?make_links:[ `always | `never | `when_labeled ] -> ?list_type:[ `enum | `item ] -> ?numbering:[ `integers | `none ] -> ?filename:string -> string -> string * Bracetax_signatures.Error.error list

This function is a convenience replacement for get_TOC, to get the table of contents from a string into another string together with a list of Error.errors.