My agentic slop goes here. Not intended for anyone else!
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2019 University of Bern. All rights reserved. 3 Distributed under the ISC license, see terms at the end of the file. 4 ---------------------------------------------------------------------------*) 5 6(** {{:https://www.ctan.org/pkg/bibtex}BibT{_E}X} codec. 7 8 {b Limitations.} At the moment [@string], [@preamble] 9 and [@comment] are not supported. For values we assume UTF-8 without 10 escape sequences. Nested braces are handled though. *) 11 12val escape : string -> string 13(** [escape s] escapes [s] for BibT{_E}X. *) 14 15type t 16(** The type for bibtex entries. *) 17 18module Tloc : sig 19 type t 20end 21 22module SM : Map.S with type key := string 23 24val v : 25 type':string -> cite_key:string -> fields:string SM.t -> unit -> t 26(** [v ~type' ~id ~fields] is an entry of type [type'], identifier [id], 27 and with field [fields]. *) 28 29val type' : t -> string 30(** [type' e] is the type of entry. *) 31 32val cite_key : t -> string 33(** [cite_key e] is the citation key of the entry. *) 34 35val fields : t -> string SM.t 36(** [fields e] are the BibTeX fields. Fields are lowercased according 37 to {!B0_std.String.Ascii.lowercase}. *) 38 39val pp : t Fmt.t 40(** [pp] formats an entry using BibT{_E}X syntax. *) 41 42(** {1:fields Field queries} *) 43 44val list_value : string -> string list 45(** [list_value] splits on comma and trims the results. *) 46 47val doi : t -> string option 48(** [doi e] is the [doi] field of e. Note that if the field happens to 49 hold an URI, the scheme and authority are stripped. *) 50 51val keywords : t -> string list option 52(** [keywords e] is the comma seperated [keywords] field. *) 53 54val annote : t -> string option 55(** [annote e] is the [annote] field. *) 56 57(** {1:codec Codec} *) 58 59type error_kind 60(** The type for kinds of decoding errors. *) 61 62type error = error_kind * Tloc.t 63(** The type for errors. The error and its location. *) 64 65val pp_error : error Fmt.t 66 67val of_string : ?file:Fpath.t -> string -> (t list, error) result 68(** [of_string ~file s] parses entries from [s] assuming it 69 was read from [file] (defaults to {!B0_std.Fpath.dash}). *) 70 71val of_string' : ?file:Fpath.t -> string -> (t list, string) result 72(** [of_string'] is like {!of_string} but converts the error to an 73 error message. *) 74 75val to_string : t list -> string 76(** [to_string es] formats the list of entries using BibT{_E}X syntax. *) 77 78(*--------------------------------------------------------------------------- 79 Copyright (c) 2019 University of Bern 80 81 Permission to use, copy, modify, and/or distribute this software for any 82 purpose with or without fee is hereby granted, provided that the above 83 copyright notice and this permission notice appear in all copies. 84 85 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 86 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 87 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 88 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 89 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 90 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 91 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 92 ---------------------------------------------------------------------------*)