summaryrefslogtreecommitdiff
path: root/html/publications/default.nix
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2022-11-12 11:41:51 +0100
committerQuentin Aristote <quentin@aristote.fr>2022-11-12 11:41:51 +0100
commitdbf48a4665a66dd37150f3886026ecd9bd82967f (patch)
tree65bc5167f7c71952cf2ce4072197f6e23e81f98b /html/publications/default.nix
parent056ee77ab2ed3cf488ac9b1b8ac82664948a42a3 (diff)
restructure directories
Diffstat (limited to 'html/publications/default.nix')
-rw-r--r--html/publications/default.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/html/publications/default.nix b/html/publications/default.nix
new file mode 100644
index 0000000..04bb502
--- /dev/null
+++ b/html/publications/default.nix
@@ -0,0 +1,64 @@
+{ html, data, lib, ... }:
+
+let
+ publications = data.publications;
+ attrValsOpt = attrs: attrSet:
+ lib.attrVals (builtins.filter (attr: lib.hasAttr attr attrSet) attrs)
+ attrSet;
+ format = publication:
+ with html;
+ with publication;
+ {
+ inherit id title url year abstract cite;
+ } // (let
+ authorsOther = lib.remove data.basics.name
+ (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}, " + lib.concatStringsSep ", "
+ (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 [
+ (lib.concatStringsSep ". "
+ (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")
+ ])
+ ])
+ ])
+ ])
+ ]));
+}