summaryrefslogtreecommitdiff
path: root/lib/citation/sigla.mli
blob: d21877a27421a0989e85e415d823f47df8da6eea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(* SPDX-License-Identifier: AGPL-3.0-or-later *)

(** The whole citation pipeline as one TOTAL function, so a call site needs
    one value and one call rather than a parse/map/render dance.

    {!format} never raises and never drops text: a citation that does not
    parse is returned UNCHANGED. That combination is deliberate -- graceful
    in production, while [test_citation_coverage.ml] asserts strictly that
    no shipped citation actually takes that path. *)

type t

val make :
  style:Render.style ->
  tradition:Book.tradition ->
  names:(Book.id -> [ `Full | `Abbr ] -> string) ->
  t

(** Returns every citation exactly as given. This is what [--raw] uses, the
    same shape as {!Colitur_naming.Lang.raw}: raw output is one value passed
    around, not a special case threaded through every call site.

    [--raw] must NOT merely use an identity name table -- that would still
    reformat punctuation and apply a tradition. Byte-exact output is what
    makes [--raw] usable for diffing against lectio, and it also keeps the
    raw view independent of the parser, so a parser bug cannot corrupt the
    output used to diagnose it. *)
val verbatim : t

val format : t -> string -> string