package bracetax

  1. Overview
  2. Docs

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 = {
  1. start_text : string_fun;
    (*

    Function called when printing starts.

    *)
  2. terminate : string_fun;
    (*

    Function called before stopping the printing.

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

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

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

    Handle a line of "pure" text.

    *)
  7. comment_line : transform_string_fun;
  8. quotation_open : string -> string;
    (*

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

    *)
  9. quotation_close : string -> string;
  10. start_italic : string_fun;
  11. start_bold : string_fun;
  12. start_type : string_fun;
  13. start_sup : string_fun;
  14. start_sub : string_fun;
  15. stop_italic : string_fun;
  16. stop_bold : string_fun;
  17. stop_type : string_fun;
  18. stop_sup : string_fun;
  19. stop_sub : string_fun;
  20. list_start : [ `itemize | `numbered ] -> string;
  21. list_first_item : [ `itemize | `numbered ] -> string;
  22. list_item : [ `itemize | `numbered ] -> string;
  23. list_stop : [ `itemize | `numbered ] -> string;
  24. section_start : int -> string -> string;
    (*

    Start a section title given its level and its label.

    *)
  25. section_stop : int -> string -> string;
  26. paragraph : string_fun;
  27. new_line : string_fun;
  28. non_break_space : string_fun;
  29. horizontal_ellipsis : string_fun;
  30. en_dash : string_fun;
  31. em_dash : string_fun;
  32. open_brace : string_fun;
  33. close_brace : string_fun;
  34. sharp : string_fun;
  35. utf8_char : int -> string;
  36. start_header : string_fun;
  37. start_title : string_fun;
  38. start_authors : string_fun;
  39. start_subtitle : string_fun;
  40. stop_header : string_fun;
  41. stop_title : string_fun;
  42. stop_authors : string_fun;
  43. stop_subtitle : string_fun;
  44. 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.

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

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

    *)
  47. start_note : string_fun;
  48. stop_note : string_fun;
  49. start_quote : string_fun;
  50. 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.