module Transform: Bracetax_transform
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) Pervasives.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
.
writer
: The Signatures.writer
to use for output.
doc
: If true
, output a whole document with header and
footer (Default: false
)).
title
: If doc = true
, use title
as HTML header title.
css_link
: Add a "meta" link to a CSS URL.
print_comments
: If true
, output Bracetax comments as HTML
comments (Default: false
).
filename
: Filename used in error messages (Default: "<IN>"
))
class_hook
: Add a
class="class_hook"
to all tags in
the HTML (it is the
-css-hook
option of
brtx
).
img_hook
: A "hook" function to transform each image path.
url_hook
: A "hook" function to transform each URL.
input_char
: The "input" function.
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
.
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) Pervasives.ref ->
?table_caption_after:bool ->
?filename:string -> input_char:(unit -> char option) -> unit -> unit
title
: The title
will be used for the PDF meta-data (for
doc = true
).
use_package
: Add a \\usepackage{<package>}
call in the
LaTeX header (doc = true).
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
Bracetax_transform.brtx_to_html
and
Bracetax_transform.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) Pervasives.ref ->
?deny_bypass:bool -> string -> string * Bracetax_signatures.Error.error list
This function is a convenience replacement for
Bracetax_transform.brtx_to_html
,
to transform a
string
into another
string
together with a list of
Error.error
s.
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) Pervasives.ref ->
?filename:string -> string -> string * Bracetax_signatures.Error.error list
This function is a convenience replacement for
Bracetax_transform.brtx_to_latex
, to transform a
string
into another
string
together with a list of
Error.error
s.
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
Bracetax_transform.get_TOC
, to get the table of contents from a
string
into another
string
together with a list of
Error.error
s.