sig
val ( ~% ) : ('a, unit, string) format -> 'a
module Error :
sig
type gravity = [ `error | `fatal_error | `warning ]
type message =
[ `bad_size_specification_in_image of string
| `begin_without_arg
| `cell_inside_cell
| `cell_out_of_table
| `closing_brace_matching_begin
| `command_shouldnot_have_args of string
| `end_of_input_not_in_text of string
| `ignored_text_after_verbatim_begin of string
| `invalid_end_pattern of string
| `item_out_of_list
| `malformed_verbatim_begin
| `non_matching_end
| `nothing_to_end_with_brace
| `terminating_with_open_environments of string list
| `transformer_lost of string
| `unknown_command of string
| `unknown_list_style of string
| `unknown_quotation_style of string ]
type location =
Bracetax_error.location = {
l_line : int;
l_char : int;
l_file : string;
}
type error =
[ `message of location * gravity * message | `undefined of string ]
type error_fun = error -> unit
val mk : location -> gravity -> message -> error
val to_string :
location * [< `error | `fatal_error | `warning ] * message -> string
end
module Raw :
sig
type t = [ `bypass | `code | `ignore | `text ]
val str_of_raw_cmd : t -> string
val raw_cmd_of_str : string -> t
val is_raw_cmd : string -> bool
val default_raw_end : 'a -> string
end
module Link :
sig
type kind = [ `generic | `local ]
type t =
Bracetax_commands.Link.t = {
kind : kind;
linkto : string option;
other_args : string list;
contents : Buffer.t;
}
val get_kind : string -> [> `generic | `local ] * string
val create :
?kind:kind -> ?linkto:string -> ?other_args:string list -> unit -> t
val start :
?url_hook:(string -> string) ->
string list -> [> `link of t ] * (string -> unit)
val stop : t -> kind * string option * string option
val unparse :
[< `generic | `local ] -> string option -> string option -> string
end
module Stack :
sig
type image_size = [ `none | `wpercent of int | `wpx of int ]
type environment =
[ `authors
| `bold
| `bypass
| `cell of bool * int * [ `center | `left | `right ]
| `close_brace
| `cmd_begin of string * string list
| `cmd_end
| `cmd_inside of environment
| `code of string list
| `em_dash
| `en_dash
| `header
| `horizontal_ellipsis
| `ignore
| `image of string * image_size * string
| `italic
| `item
| `link of Link.t
| `list of [ `itemize | `numbered ] * string list * bool ref
| `mono_space
| `new_line
| `non_break_space
| `note
| `open_brace
| `paragraph
| `quotation of string * string
| `quote
| `section of int * string
| `sharp
| `subscript
| `subtitle
| `superscript
| `table of int * string option
| `text
| `title
| `unknown of string * string list
| `utf8_char of int ]
type t = environment list ref
val empty : unit -> 'a list ref
val push : 'a list ref -> 'a -> unit
val pop : 'a list ref -> 'a option
val head : 'a list ref -> 'a option
val to_list : 'a ref -> 'a
end
module Names :
sig
val is_italic : string -> bool
val is_bold : string -> bool
val is_mono_space : string -> bool
val is_superscript : string -> bool
val is_subscript : string -> bool
val is_quotation : string -> bool
val is_non_break_space : string -> bool
val is_ellipsis : string -> bool
val is_en_dash : string -> bool
val is_em_dash : string -> bool
val is_open_brace : string -> bool
val is_close_brace : string -> bool
val is_sharp : string -> bool
val is_paragraph : string -> bool
val is_new_line : string -> bool
val is_utf8_char : string -> bool
val is_begin : string -> bool
val is_end : string -> bool
val is_list : string -> bool
val list_style :
(Error.message -> unit) -> string -> [> `itemize | `numbered ]
val is_item : string -> bool
val is_section : string -> bool
val section_params : string list -> int * string
val is_link : string -> bool
val is_image : string -> bool
val image_params :
?img_hook:(string -> string) ->
(Error.message -> unit) ->
string list -> string * Stack.image_size * string
val is_header : string -> bool
val is_title : string -> bool
val is_authors : string -> bool
val is_subtitle : string -> bool
val is_table : string -> bool
val is_cell : string -> bool
val is_note : string -> bool
val is_quote : string -> bool
end
val non_env_cmd_of_name : string -> string list -> Stack.environment
val env_to_string : Stack.environment -> string
module Table :
sig
type alignment = [ `center | `left | `right ]
type cell =
Bracetax_commands.Table.cell = {
is_head : bool;
cols_used : int;
rows_used : int;
align : alignment;
cell_text : Buffer.t;
}
val default_default_align : alignment
type table =
Bracetax_commands.Table.table = {
col_nb : int;
label : string option;
mutable cells : cell list;
mutable current_cell : cell option;
caption : Buffer.t;
default_align : alignment;
}
val table_args : string list -> int * string option * alignment
val cell_arguments :
table -> string list -> bool * int * int * alignment
val write : table -> string -> unit
val start :
string list ->
table * [> `table of int * string option ] * (string -> unit)
val cell_start :
loc:Error.location ->
error:Error.error_fun ->
table -> string list -> [> `cell of bool * int * alignment ]
val cell_stop : loc:'a -> error:Error.error_fun -> table -> unit
module Util :
sig
val nb_rows : table -> int
val make_riddle : table -> (int * int) array array
val fill_riddle :
(int * int) array array -> int -> int -> int -> int -> unit
val next_coordinates :
(int * int) array array -> table -> int -> int -> int * int
type in_table = [ `cell of cell | `filed of int * int | `none ]
val matrix_next_coordinates :
[> `none ] array array -> table -> int -> int -> int * int
val cells_to_matrix :
table ->
int * int *
[> `cell of cell | `filled of int * int | `none ] array array
end
end
end