diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2023-09-30 21:25:03 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2023-09-30 21:25:03 +0200 |
| commit | 1036c49e9e3c3ff311a713cccf0054c8c16a9857 (patch) | |
| tree | 8a9495eb0181cef35f690879267120bc3de3defe /html/publications | |
| parent | add6bcd3c1984068e7122fa07a8f3e35ebaf58a9 (diff) | |
format
Diffstat (limited to 'html/publications')
| -rw-r--r-- | html/publications/default.nix | 113 |
1 files changed, 63 insertions, 50 deletions
diff --git a/html/publications/default.nix b/html/publications/default.nix index 289f9e3..800d3aa 100644 --- a/html/publications/default.nix +++ b/html/publications/default.nix @@ -1,6 +1,9 @@ -{ html, data, lib, ... }: - -let +{ + html, + data, + lib, + ... +}: let publications = data.publications; attrValsOpt = attrs: attrSet: lib.attrVals (builtins.filter (attr: lib.hasAttr attr attrSet) attrs) @@ -12,58 +15,68 @@ let format = publication: with html; with publication; - { - inherit id title url year abstract cite; - } // (let - authorsOther = - lib.remove "${data.basics.name.first} ${data.basics.name.last}" - (builtins.map (author: "${author.given} ${author.family}") author); - in lib.optionalAttrs (authorsOther != [ ]) { - authors = "With ${lib.concatStringsSep ", " authorsOther}"; - }) // lib.optionalAttrs (publication ? container-title) { - published = "In ${em container-title}" + concatStringsPrefix ", " - (attrValsOpt [ "volume" "issue" "publisher" ] publication); - } // lib.optionalAttrs (publication ? ISBN) { - isbn = "${small "ISBN"}: ${ISBN}"; - } // lib.optionalAttrs (publication ? ISSN) { - issn = "${small "ISSN"}: ${ISSN}"; - } // lib.optionalAttrs (publication ? DOI) { - doi = "${small "DOI"}: ${href "https://doi.org/${DOI}" (code DOI)}"; - }; + { + inherit id title url year abstract cite; + } + // (let + authorsOther = + lib.remove "${data.basics.name.first} ${data.basics.name.last}" + (builtins.map (author: "${author.given} ${author.family}") author); + in + lib.optionalAttrs (authorsOther != []) { + authors = "With ${lib.concatStringsSep ", " authorsOther}"; + }) + // lib.optionalAttrs (publication ? container-title) { + published = + "In ${em container-title}" + + concatStringsPrefix ", " + (attrValsOpt ["volume" "issue" "publisher"] publication); + } + // lib.optionalAttrs (publication ? ISBN) { + isbn = "${small "ISBN"}: ${ISBN}"; + } + // lib.optionalAttrs (publication ? ISSN) { + issn = "${small "ISSN"}: ${ISSN}"; + } + // lib.optionalAttrs (publication ? DOI) { + doi = "${small "DOI"}: ${href "https://doi.org/${DOI}" (code DOI)}"; + }; in { title = "Publications"; priority = 10; body = with html; - dl (for (sort.reverse.byPath [ "issued" "date-parts" ] publications) - (publication: - let formatted = format publication; - in with formatted; - lines [ - (dt { id = "Publications#${id}"; } - "${href { target = "_blank"; } url title} (${year})") - (dd [ - (concatStringsSuffix ". " - (attrValsOpt [ "authors" "published" "isbn" "issn" "doi" ] - formatted)) - (details [ - (summary "More") - (dl [ - (dt "Abstract.") - (dd (blockquote abstract)) - (dt "Cite.") - (let - citeWith = title: attr: - details [ - (summary title) - (pre (code (lib.getAttr attr cite))) - ]; - in dd [ - (citeWith "BibLaTeX" "biblatex") - (citeWith "BibTeX" "bibtex") - (citeWith "CSL JSON" "csljson") + dl (for (sort.reverse.byPath ["issued" "date-parts"] publications) + (publication: let + formatted = format publication; + in + with formatted; + lines [ + (dt {id = "Publications#${id}";} + "${href {target = "_blank";} url title} (${year})") + (dd [ + (concatStringsSuffix ". " + (attrValsOpt ["authors" "published" "isbn" "issn" "doi"] + formatted)) + (details [ + (summary "More") + (dl [ + (dt "Abstract.") + (dd (blockquote abstract)) + (dt "Cite.") + (let + citeWith = title: attr: + details [ + (summary title) + (pre (code (lib.getAttr attr cite))) + ]; + in + dd [ + (citeWith "BibLaTeX" "biblatex") + (citeWith "BibTeX" "bibtex") + (citeWith "CSL JSON" "csljson") + ]) ]) ]) ]) - ]) - ])); + ])); } |
