let to_string ?(style:style=`comas) (authors:t) =
match style with
| `bibtex ->
String.concat " and "
(Ls.map (function
| ("", last) -> sprintf "{%s}" last
|(first, last) -> sprintf " {%s}, {%s}" last first)
authors)
| `comas_and ->
let lgth = Ls.length authors in
String.concat ", "
(Ls.mapi (fun i (first, last) ->
let strand =
if i = lgth - 1 && i <> 0 then "and " else "" in
sprintf "%s%s %s" strand first last) authors)
| `comas ->
String.concat ", "
(Ls.map (fun (first, last) ->
sprintf "%s %s" first last) authors)
| `acm ->
let lgth = Ls.length authors in
String.concat ", "
(Ls.mapi (fun i (first, last) ->
let strand =
if i = lgth - 1 && i <> 0 then "and " else "" in
let initials_str =
match initials first with
| None -> ""
| Some s -> ", " ^ s in
sprintf "%s%s%s" strand last initials_str) authors)
| `et_al ->
match authors with
| [] -> ""
| [(onef,onel)] -> onel
| [(onef,onel); (twof,twol) ] -> sprintf "%s and %s" onel twol
| (onef,onel) :: l -> onel ^ " et al."