package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
2.3.tar.gz
md5=00fff94216aacd334351c2b1741d5246
sha512=724770d12a91674da76cc7842020ce7af2d37950d4429fe1ffac3b05d73a2079648f00c8eb33595e3dfa4874b2cd6b6a8c9d1f9034276a00b44d302091630cdb
doc/src/forester.render/RenderBibTeX.ml.html
Source file RenderBibTeX.ml
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
open Prelude open Core module E = RenderEff.Perform module Printer = struct module P0 = struct type out = Format.formatter let text txt fmt = Format.fprintf fmt "%s" txt end include PrinterKit.Kit (P0) let newline = text "\n" end module Metas = Map.Make (String) let = match E.get_doc author with | None -> Printer.text author | Some doc -> match doc.title with | None -> Printer.text author | Some title -> RenderLaTeX.render title let : string list -> Printer.t = function | [] -> Printer.text "Anonymous" | -> Printer.iter ~sep:(Printer.text " and ") render_author authors let render_title ~taxon title = match taxon with | Some taxon -> Format.dprintf "%s: %a" (StringUtil.sentence_case taxon) (Fun.flip RenderLaTeX.render) title | None -> RenderLaTeX.render @@ Sem.sentence_case title let render_auto_bibtex ~base_url (doc : Sem.doc) : Printer.t = match doc.addr with | None -> Printer.nil | Some addr -> let contributors = E.contributors addr in Printer.seq ~sep:Printer.newline [ Printer.nil; Format.dprintf "@misc{%s," addr; begin doc.title |> Printer.option @@ fun title -> Format.dprintf "title = {%a}," (Fun.flip @@ render_title ~taxon:doc.taxon) title end; Format.dprintf "author = {%a}," (Fun.flip render_authors) doc.authors; begin base_url |> Printer.option @@ fun url -> Format.dprintf "url = {%s/%s}," url @@ E.route addr end; begin match contributors with | [] -> Printer.nil | _ -> let pp_sep fmt () = Format.fprintf fmt ", " in Format.dprintf "note = {With contributions from %a.}," (Format.pp_print_list ~pp_sep (Fun.flip render_author)) contributors end; Format.dprintf "}"; Printer.nil ] let render_bibtex ~base_url (doc : Sem.doc) : Printer.t = let metas = Metas.of_seq @@ List.to_seq doc.metas in match Metas.find_opt "bibtex" metas with | None -> if doc.taxon = Some "reference" then Printer.nil else render_auto_bibtex ~base_url doc | Some [Text txt] -> let lines = String.split_on_char '\n' txt in lines |> Printer.iter ~sep:Printer.newline @@ fun line -> Printer.text @@ String.trim line | Some other -> failwith @@ Format.asprintf "Unexpected contents of bibtex meta %a" Sem.pp other
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>