sig
module Commands :
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
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 Signatures :
sig
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
type writer =
Bracetax_signatures.writer = {
w_write : string -> unit;
w_error : Error.error -> unit;
}
val make_writer :
write:(string -> unit) -> error:(Error.error -> unit) -> writer
type printer =
Bracetax_signatures.printer = {
print_comment : Error.location -> string -> unit;
print_text : Error.location -> string -> unit;
enter_cmd : Error.location -> string -> string list -> unit;
leave_cmd : Error.location -> unit;
terminate : Error.location -> unit;
is_raw : string -> bool;
default_raw_end : string -> string;
enter_raw : Error.location -> string -> string list -> unit;
print_raw : Error.location -> string -> unit;
leave_raw : Error.location -> unit;
error : Error.error -> unit;
}
end
module Escape :
sig
val ( ~% ) : ('a, unit, string) format -> 'a
val p : string -> unit
val string_of_char : char -> string
val replace_string :
src:string -> find:string -> replace_with:string -> string
val replace_chars :
src:string -> patterns:(char * string) list -> string
val is_white_space : string -> bool
val clean_string : string -> string
end
module CS :
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 Commands.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
type t =
Bracetax_HTML_printer.t = {
stack : Commands.Stack.t;
mutable write : string -> unit;
write_mem : (string -> unit) Stack.t;
mutable current_line : int;
mutable started_text : bool;
mutable inside_header : bool;
mutable current_table : Commands.Table.table option;
mutable current_section : (int * string * Buffer.t) option;
error : Error.error -> unit;
mutable loc : Error.location;
class_hook : string option;
url_hook : string -> string;
img_hook : string -> string;
separate_header : (string * string * string) ref option;
make_section_links : [ `always | `never | `when_labeled ];
}
val ( ~% ) : ('a, unit, string) format -> 'a
module AddClass :
sig
val name : string option -> string -> string
val attribute : string option -> string -> string
end
val create :
writer:Bracetax_signatures.writer ->
?class_hook:string ->
?separate_header:(string * string * string) ref ->
?make_section_links:[ `always | `never | `when_labeled ] ->
?img_hook:(string -> string) -> ?url_hook:(string -> string) -> unit -> t
val strstat : Error.location -> string
val debugstr : t -> Error.location -> string -> string
val sanitize_comments : string -> string
val sanitize_pcdata : string -> string
val sanitize_xml_attribute : string -> string
val quotation_open_close : t -> string list -> string * string
val list_start : t -> [< `itemize | `numbered ] -> string
val list_item : t -> [< `itemize | `numbered ] -> string
val list_firstitem : t -> [< `itemize | `numbered ] -> string
val list_stop : 'a -> [< `itemize | `numbered ] -> string
val section_start : t -> int -> string -> unit
val section_stop : t -> 'a -> 'b -> string
val link_start : t -> string list -> [> `link of Commands.Link.t ]
val link_stop : t -> Commands.Link.t -> unit
val image_start :
t ->
string list -> [> `image of string * Commands.Stack.image_size * string ]
val image_stop : string
val header_start : t -> unit
val header_stop : t -> unit
val title_start : t -> unit
val title_stop : t -> unit
val authors_start : t -> unit
val authors_stop : t -> unit
val subtitle_start : t -> unit
val subtitle_stop : t -> unit
val table_start : t -> string list -> [> `table of int * string option ]
val print_table : t -> Bracetax_commands.Table.table -> unit
val table_stop : t -> unit
val cell_start :
t -> string list -> [> `cell of bool * int * Commands.Table.alignment ]
val cell_stop : t -> 'a -> unit
val note_start : t -> [> `note ]
val note_stop : t -> string
val may_start_text : t -> unit
val start_environment :
?is_begin:bool -> t -> Error.location -> string -> string list -> unit
val start_command : t -> Error.location -> string -> string list -> unit
val stop_command : t -> Error.location -> unit
val handle_comment_line : t -> Error.location -> string -> unit
val handle_text : t -> Error.location -> string -> unit
val terminate : t -> Error.location -> unit
val start_raw_mode : t -> Error.location -> string -> string list -> unit
val handle_raw_text : t -> Error.location -> string -> unit
val stop_raw_mode : t -> Error.location -> unit
val build :
?print_comments:bool ->
?make_section_links:[ `always | `never | `when_labeled ] ->
?separate_header:(string * string * string) ref ->
?img_hook:(string -> string) ->
?url_hook:(string -> string) ->
?class_hook:string ->
writer:Signatures.writer -> unit -> Signatures.printer
val header :
?title:string ->
?comment:string -> ?stylesheet_link:string -> unit -> string
val footer : unit -> string
end