package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
2.5.1.tar.gz
md5=b26b6f4e3d14b976c3d5018c97b81b94
sha512=f0c794ed4330485b5255639720ad7201488b77ef947b0736a847fa4f56f93d3f03a22fd2a3319bbe867bab827a4b5ae73b2426a1067911b29fe178d21dd99e73
doc/src/forester.render/Render_bibtex.ml.html
Source file Render_bibtex.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
open Prelude open Core module E = Render_effect.Perform module Printer = struct module P0 = struct type out = Format.formatter let text txt fmt = Format.fprintf fmt "%s" txt end include Printer_kit.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 -> Render_latex.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" (String_util.sentence_case taxon) (Fun.flip Render_latex.render) title | None -> Render_latex.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 Xml 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 -> 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)"
>