bracetax

Simple and deterministic text processing syntax

The so-called "outputs" are structures of type GenericPrinter.output_t.

type write_fun = string -> unit
type string_of_args_fun = string list -> string
type string_fun = unit -> string
type transform_string_fun = string -> string
type output_t = {
start_text : string_fun;(*

Function called when printing starts.

*)
terminate : string_fun;(*

Function called before stopping the printing.

*)
start_raw : Bracetax_commands.Raw.t -> string option -> string;(*

Begin a non-parsed bloc, the string option is the optional post-processing plugin "identifier".

*)
raw_line : Bracetax_commands.Raw.t -> transform_string_fun;
stop_raw : Bracetax_commands.Raw.t -> string option -> string;
line : transform_string_fun;(*

Handle a line of "pure" text.

*)
comment_line : transform_string_fun;
quotation_open : string -> string;(*

Open "quotation marks" of the kind given as argument.

*)
quotation_close : string -> string;
start_italic : string_fun;
start_bold : string_fun;
start_type : string_fun;
start_sup : string_fun;
start_sub : string_fun;
stop_italic : string_fun;
stop_bold : string_fun;
stop_type : string_fun;
stop_sup : string_fun;
stop_sub : string_fun;
list_start : [ `itemize | `numbered ] -> string;
list_first_item : [ `itemize | `numbered ] -> string;
list_item : [ `itemize | `numbered ] -> string;
list_stop : [ `itemize | `numbered ] -> string;
section_start : int -> string -> string;(*

Start a section title given its level and its label.

*)
section_stop : int -> string -> string;
paragraph : string_fun;
new_line : string_fun;
non_break_space : string_fun;
horizontal_ellipsis : string_fun;
en_dash : string_fun;
em_dash : string_fun;
open_brace : string_fun;
close_brace : string_fun;
sharp : string_fun;
utf8_char : int -> string;
start_header : string_fun;
start_title : string_fun;
start_authors : string_fun;
start_subtitle : string_fun;
stop_header : string_fun;
stop_title : string_fun;
stop_authors : string_fun;
stop_subtitle : string_fun;
start_image : string -> Bracetax_commands.Stack.image_size -> string -> string;(*

Start an "image" (i.e. just before the caption), given the URL, the size, and the optional label.

*)
stop_image : string -> Bracetax_commands.Stack.image_size -> string -> string;
print_table : ( string -> unit ) -> Bracetax_commands.Table.table -> unit;(*

Print the table using the first argument (print function).

*)
start_note : string_fun;
stop_note : string_fun;
start_quote : string_fun;
stop_quote : string_fun;
}

The type to "implement" to use the generic printer.

val build : ?print_comments:bool -> writer:Bracetax_signatures.writer -> output_funs:output_t -> unit -> Bracetax_signatures.printer

Build a printer from a GenericPrinter.output_t to feed Parser.do_transformation, the optional argument has the same meaning than for Transform.brtx_to_latex.