View raw

1 (** Document configuration from pre-scan. 2 3 This module holds document-level settings extracted from file-local 4 declarations such as #+TODO lines. These affect how the structural lexer and 5 normalization interpret the document. *) 6 7 type todo_sequence = { active : string list; done_ : string list } 8 (** A TODO keyword sequence: active keywords followed by done keywords. *) 9 10 type t = { 11 todo_sequences : todo_sequence list; 12 (** All TODO keyword sequences declared in the file. Default: one sequence 13 with active=["TODO"] done_=["DONE"]. *) 14 } 15 (** Document configuration. *) 16 17 (** The default configuration when no #+TODO declarations are present. *) 18 let default = 19 { todo_sequences = [ { active = [ "TODO" ]; done_ = [ "DONE" ] } ] } 20 21 (** Return all TODO keywords (both active and done) from the config. *) 22 let all_todo_keywords config = 23 List.concat_map (fun seq -> seq.active @ seq.done_) config.todo_sequences 24 25 (** Check if a word is a known TODO keyword. *) 26 let is_todo_keyword config word = 27 List.exists 28 (fun seq -> List.mem word seq.active || List.mem word seq.done_) 29 config.todo_sequences 30