Module Bracetax_generic_printer


module Bracetax_generic_printer: sig .. end
A generic printer, it implements Signatures.printer functions from GenericPrinter.output_ts.


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 : Commands.Raw.t -> string option -> string; (*Begin a non-parsed bloc, the string option is the optional post-processing plugin "identifier".*)
   raw_line : Commands.Raw.t ->
transform_string_fun
;
   stop_raw : 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;
   link : Commands.Link.kind ->
string option -> string option -> string
;
(*(o.link kind target text) to create a link.*)
   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 ->
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 ->
Commands.Stack.image_size -> string -> string
;
   print_table : (string -> unit) -> 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:Signatures.writer ->
output_funs:output_t ->
unit -> 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.