From c87fe21a93709ec707d9bb08341c78405f5522f4 Mon Sep 17 00:00:00 2001 From: "quentin@aristote.fr" Date: Wed, 28 Feb 2024 16:29:58 +0100 Subject: publications: update and split selected --- html/publications/default.nix | 84 +++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 35 deletions(-) (limited to 'html/publications') diff --git a/html/publications/default.nix b/html/publications/default.nix index 800d3aa..87dfb37 100644 --- a/html/publications/default.nix +++ b/html/publications/default.nix @@ -4,7 +4,6 @@ lib, ... }: let - publications = data.publications; attrValsOpt = attrs: attrSet: lib.attrVals (builtins.filter (attr: lib.hasAttr attr attrSet) attrs) attrSet; @@ -26,12 +25,18 @@ lib.optionalAttrs (authorsOther != []) { authors = "With ${lib.concatStringsSep ", " authorsOther}"; }) + // lib.optionalAttrs (publication ? note) { + note = publication.note; + } // lib.optionalAttrs (publication ? container-title) { published = "In ${em container-title}" + concatStringsPrefix ", " (attrValsOpt ["volume" "issue" "publisher"] publication); } + // lib.optionalAttrs (publication ? event-title) { + published = "At ${em event-title}"; + } // lib.optionalAttrs (publication ? ISBN) { isbn = "${small "ISBN"}: ${ISBN}"; } @@ -41,42 +46,51 @@ // lib.optionalAttrs (publication ? DOI) { doi = "${small "DOI"}: ${href "https://doi.org/${DOI}" (code DOI)}"; }; + listPublications = collection: collectionTitle: + with html; + section {id = "Publications#${collectionTitle}";} [ + (h2 collectionTitle) + (dl (for (sort.reverse.byPath ["issued" "date-parts"] collection) + (publication: let + formatted = format publication; + in + with formatted; + lines [ + (dt {id = "Publications#${id}";} + "${href {target = "_blank";} url title} (${year})") + (dd [ + (concatStringsSuffix ". " + (attrValsOpt ["authors" "note" "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") + ]) + ]) + ]) + ]) + ]))) + ]; 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") - ]) - ]) - ]) - ]) - ])); + lines [ + (listPublications data.publications.selected "Selected works") + (listPublications (with data.publications; lib.subtractLists selected all) "Other works") + ]; } -- cgit v1.2.3