(** Public semantic AST types for Org Mode documents. *) (** {1 Inline objects} *) (** A link target. *) type link_target = | Url of string (** An external URL (https, http, ftp, etc.) *) | File of string (** A file path *) | Internal of string (** An internal link target (custom-id, fuzzy) *) | Protocol of string * string (** protocol:path *) (** {1 Timestamps} *) type date = { year : int; month : int; day : int; dayname : string option; hour : int option; minute : int option; } (** A date with optional time. *) (** Repeater or delay mark. *) type repeater_mark = | Plus (** + *) | Double_plus (** ++ *) | Dot_plus (** .+ *) | Minus (** - (warning delay) *) | Double_minus (** -- (warning delay) *) type duration_unit = Hour | Day | Week | Month | Year type repeater_or_delay = { mark : repeater_mark; value : int; unit_ : duration_unit; } (** A timestamp value. *) type timestamp = | Active of date * repeater_or_delay option | Inactive of date * repeater_or_delay option | Active_range of date * date | Inactive_range of date * date (** {1 Planning} *) type planning = { deadline : timestamp option; scheduled : timestamp option; closed : timestamp option; } (** {1 Properties} *) type property = { prop_name : string; prop_value : string option } (** {1 Affiliated keywords} *) type affiliated = { aff_name : string; aff_optional : string option; aff_value : string; } (** {1 Inline objects} *) (** Inline objects that can appear within paragraphs, headings, etc. *) type inline = | Plain of string (** Plain text *) | Bold of inline list (** *bold* *) | Italic of inline list (** /italic/ *) | Underline of inline list (** _underline_ *) | Strikethrough of inline list (** +strikethrough+ *) | Code of string (** ~code~ *) | Verbatim of string (** =verbatim= *) | Link of link (** A link object *) | Timestamp of timestamp (** A timestamp *) | Line_break (** Explicit line break \\\\ *) and link = { target : link_target; description : inline list option } (** A link with optional description. *) (** {1 Lists} *) type list_kind = Ordered | Unordered | Descriptive type checkbox = Checked | Unchecked | Partial (** {1 Tables} *) type table_cell = inline list type table_row = Table_row_standard of table_cell list | Table_row_rule type table = { rows : table_row list } (** {1 Blocks} *) type src_block = { src_language : string option; src_switches : string option; src_arguments : string option; src_value : string; src_affiliated : affiliated list; } (** {1 Keywords} *) type keyword = { kw_key : string; kw_value : string } (** {1 Elements} *) (** Elements are the building blocks of sections. *) type element = | Paragraph of inline list * affiliated list | Plain_list of list_kind * list_item list | Table of table | Block of block | Drawer of string * element list | Keyword of keyword | Comment of string list | Fixed_width of string list | Horizontal_rule and list_item = { li_bullet : string; li_counter_set : int option; li_checkbox : checkbox option; li_tag : inline list option; li_contents : element list; } and block = | Src_block of src_block | Example_block of { ex_value : string; ex_switches : string option; ex_affiliated : affiliated list; } | Export_block of { exp_backend : string; exp_value : string; exp_affiliated : affiliated list; } | Comment_block of { cb_value : string; cb_affiliated : affiliated list } | Quote_block of { qt_contents : element list; qt_affiliated : affiliated list; } | Center_block of { cn_contents : element list; cn_affiliated : affiliated list; } | Verse_block of { vs_contents : inline list; vs_affiliated : affiliated list; } | Custom_block of { cst_name : string; cst_params : string option; cst_contents : element list; cst_affiliated : affiliated list; } (** {1 Headings} *) type heading = { level : int; todo : string option; priority : char option; commented : bool; title : inline list; tags : string list; planning : planning option; properties : property list; contents : element list; children : heading list; } (** {1 Directives} *) type directive = { dir_key : string; dir_value : string } (** File-level directives like #+TITLE, #+AUTHOR, etc. *) (** {1 Document} *) type document = { directives : directive list; preamble : element list; headings : heading list; }