From 8622e40e675c72b9402625189517f99891a046c9 Mon Sep 17 00:00:00 2001 From: aristote Date: Sun, 27 Jul 2025 17:47:32 +0200 Subject: add talks to publications, rename to research, split into tabbox --- css/classless.nix | 44 +++++++++++++++++++ default.nix | 3 +- html/experience/default.nix | 29 +++++++------ html/publications/default.nix | 98 ------------------------------------------- html/research/default.nix | 40 ++++++++++++++++++ html/research/talks.nix | 81 +++++++++++++++++++++++++++++++++++ html/research/writings.nix | 94 +++++++++++++++++++++++++++++++++++++++++ html/sections.nix | 2 +- lib/html.nix | 75 +++++++++++++++++++++++---------- 9 files changed, 331 insertions(+), 135 deletions(-) delete mode 100644 html/publications/default.nix create mode 100644 html/research/default.nix create mode 100644 html/research/talks.nix create mode 100644 html/research/writings.nix diff --git a/css/classless.nix b/css/classless.nix index 5df5266..e32e430 100644 --- a/css/classless.nix +++ b/css/classless.nix @@ -32,6 +32,7 @@ in aside ? false, inputs ? false, printing ? false, + tabs ? false, ## Classes grid ? false, align ? false, @@ -398,6 +399,49 @@ in .row { flex-direction: row; } } '' + # Tab boxes + + lib.optionalString tabs '' + .tabs { + display: flex; + flex-wrap: wrap; + background: linear-gradient(0deg, ${cbg} 1rem, var(--clight) 0%); + border: ${border}; border-radius: 5px; + padding-bottom: 0.5em; + } + .tabs label { + order: 1; /*Put the labels first*/ + display: block; + cursor: pointer; + padding: .5rem .8rem; + margin: .5rem 0 -1px; + border-radius: 5px 5px 0 0; + color: ${clink}; + background: ${clight}; + } + .tabs label:first-of-type{ margin-left: 1rem; } + .tabs .tab { + order: 99; /*Put the tabs last*/ + flex-grow: 1; + width: 100%; + display: none; + z-index: 10; + padding: 0 1rem; + background: ${cbg}; + border-top: ${border}; + } + .tabs input[type="radio"]:not(:checked) + label:hover { filter: brightness(90%); } + .tabs input[type="radio"] { display: none; } + .tabs input[type="radio"]:checked + label { + border: ${border}; border-bottom: 0px; + background: ${cbg}; z-index: 11; + } + .tabs input[type="radio"]:checked + label + .tab { display: block; } + + @media (max-width: 45em) { + .tabs .tab, .tabs label { order: initial; } + .tabs label { width: 100%; margin: 0 0 -1px !important; } + } + @media print { .tabs label + .tab { display: block; } .tabs label { display: none; } }'' # Classes (Bootstrap-compatible) ––––––––––––––––––––– # Grid + lib.optionalString grid '' diff --git a/default.nix b/default.nix index a6e5645..1e2c4c6 100644 --- a/default.nix +++ b/default.nix @@ -27,7 +27,7 @@ ${image}.${size} ''; mkPushDir = dir: ''mkdir -p ${dir} && pushd "$_"''; - nixEvalExpr = "${nix}/bin/nix --extra-experimental-features nix-command --extra-experimental-features flakes eval --impure --raw --expr"; + nixEvalExpr = "${nix}/bin/nix --extra-experimental-features nix-command --extra-experimental-features flakes eval --impure --raw --show-trace --expr"; make = "import $src/make.nix {pkgs = import ${nixpkgsSrc} {}; dataSrc = $src/data;}"; in stdenvNoCC.mkDerivation { @@ -81,6 +81,7 @@ in tables = false; tooltip-citations = true; printing = true; + tabs = true; } " > classless.css ${clean} $out/index.html --stylesheets file://$(pwd)/classless.css \ diff --git a/html/experience/default.nix b/html/experience/default.nix index b7f258b..9fdc219 100644 --- a/html/experience/default.nix +++ b/html/experience/default.nix @@ -10,23 +10,26 @@ in { priority = 20; body = with html; dl (for - (sort.reverse.byFun (item: with item.date.start; day + 100 * month + 10000 * year) - experience) (item: + (sort.reverse.byFun + (item: with item.date.start; day + 100 * month + 10000 * year) + experience) + (item: with item; [ (dt [ (with institution; "${position} @ ${href url name}, ${location}") br - (small (lib.concatStringsSep " · " - ([(with date; timerange start end)] - ++ lib.optional (item ? supervisors) "supervised by ${ - lib.concatStringsSep " " (for supervisors - (supervisor: with supervisor; href url name)) - }" - ++ lib.optional (item ? assets) (lib.concatStringsSep " " - (for assets (asset: - with asset; - href "#${type}#${id}" - "${icon "las la-paperclip"} ${name}")))))) + (small (lib.concatStringsSep " · " ( + [(with date; timerange start end)] + ++ lib.optional (item ? supervisors) "supervised by ${ + lib.concatStringsSep " " (for supervisors + (supervisor: with supervisor; href url name)) + }" + # ++ lib.optional (item ? assets) (lib.concatStringsSep " " + # (for assets (asset: + # with asset; + # href "#${type}#${id}" + # "${icon "las la-paperclip"} ${name}"))) + ))) ]) (dd description) ])); diff --git a/html/publications/default.nix b/html/publications/default.nix deleted file mode 100644 index fbcfcee..0000000 --- a/html/publications/default.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ - html, - data, - lib, - ... -}: let - attrValsOpt = attrs: attrSet: - lib.attrVals (builtins.filter (attr: lib.hasAttr attr attrSet) attrs) - attrSet; - concatStringsPrefix = prefix: strings: - lib.concatStrings (builtins.map (string: prefix + string) strings); - concatStringsSuffix = suffix: strings: - lib.concatStrings (builtins.map (string: string + suffix) strings); - 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 ? 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}"; - } - // lib.optionalAttrs (publication ? ISSN) { - issn = "${small "ISSN"}: ${ISSN}"; - } - // 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: type: - details [ - (summary title) - (pre (code ( - lib.readFile "${data.publications.files}/${type}/${id}" - ))) - ]; - in - dd [ - (citeWith "BibLaTeX" "biblatex") - (citeWith "BibTeX" "bibtex") - (citeWith "CSL JSON" "csljson") - ]) - ]) - ]) - ]) - ]))) - ]; -in { - title = "Publications"; - priority = 10; - body = with html; - lines [ - (listPublications data.publications.selected "Selected works") - (listPublications (with data.publications; lib.subtractLists selected all) "Other works") - ]; -} diff --git a/html/research/default.nix b/html/research/default.nix new file mode 100644 index 0000000..21152e2 --- /dev/null +++ b/html/research/default.nix @@ -0,0 +1,40 @@ +{ + make, + html, + ... +}: let + writings = make ./writings.nix {}; + talks = make ./talks.nix {}; +in { + title = "Research"; + priority = 10; + body = with html; + tabbox "research" [ + { + id = "conferences"; + checked = true; + title = "Conference papers"; + content = writings.conferences; + } + { + id = "journals"; + title = "Journal papers"; + content = writings.journals; + } + { + id = "misc"; + title = "Non-peer-reviewed"; + content = writings.misc; + } + { + id = "reports"; + title = "Reports"; + content = writings.reports; + } + { + id = "talks"; + title = "Talks"; + content = talks; + } + ]; +} diff --git a/html/research/talks.nix b/html/research/talks.nix new file mode 100644 index 0000000..9e1fd56 --- /dev/null +++ b/html/research/talks.nix @@ -0,0 +1,81 @@ +{ + html, + data, + lib, + ... +}: let + matchFirst = regexp: str: let + results = builtins.match regexp str; + in + if results == null + then null + else builtins.head results; + join = url: name: with html; lib.optionalString (url != null) " · ${href url "${icon "las la-paperclip"} ${name}"}"; + talks = data.publications.talks; +in + with html; + dl (for (sort.reverse.byPath ["issued" "date-parts"] talks) (item: + with item; let + date-parts = builtins.head issued.date-parts; + date = { + year = builtins.elemAt date-parts 0; + month = builtins.elemAt date-parts 1; + day = builtins.elemAt date-parts 2; + }; + extra = + if item ? note + then note + else ""; + abstractURL = matchFirst ".*abstract: ([^\n ]*).*" extra; + slidesURL = matchFirst ".*slides: ([^\n ]*).*" extra; + # broken because of tabs + # paperURL = let + # paperId = matchFirst "([A-z0-9]*[0-9]{4})[a-z]" id; + # in + # if paperId == null + # then null + # else "#Writings#${paperId}"; + in [ + (dt [ + (( + if abstractURL == null + then (x: x) + else href abstractURL + ) (em title)) + ]) + (dd [ + (with (makeDate date); tag pretty) + "@ ${href url event-title}, ${publisher-place}" + (join slidesURL "slides") + # broken because of tabs + # (join paperURL "paper") + (details [ + (summary "More") + ( + dl ( + lib.optionals (item ? abstract) [ + (dt "Abstract.") + (dd (blockquote abstract)) + ] + ++ [ + (dt "Cite.") + (let + citeWith = title: type: + details [ + (summary title) + (pre (code ( + lib.readFile "${data.publications.files}/${type}/${id}" + ))) + ]; + in + dd [ + (citeWith "BibLaTeX" "biblatex") + (citeWith "BibTeX" "bibtex") + (citeWith "CSL JSON" "csljson") + ]) + ] + ) + ) + ]) + ]) + ])) diff --git a/html/research/writings.nix b/html/research/writings.nix new file mode 100644 index 0000000..d34ea66 --- /dev/null +++ b/html/research/writings.nix @@ -0,0 +1,94 @@ +{ + html, + data, + lib, + ... +}: let + attrValsOpt = attrs: attrSet: + lib.attrVals (builtins.filter (attr: lib.hasAttr attr attrSet) attrs) + attrSet; + concatStringsPrefix = prefix: strings: + lib.concatStrings (builtins.map (string: prefix + string) strings); + concatStringsSuffix = suffix: strings: + lib.concatStrings (builtins.map (string: string + suffix) strings); + 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 ? 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}"; + } + // lib.optionalAttrs (publication ? ISSN) { + issn = "${small "ISSN"}: ${ISSN}"; + } + // lib.optionalAttrs (publication ? DOI) { + doi = "${small "DOI"}: ${href "https://doi.org/${DOI}" (code DOI)}"; + }; + listPublications = collection: + with html; + section [ + (dl (for (sort.reverse.byPath ["issued" "date-parts"] collection) + (publication: let + formatted = format publication; + in + with formatted; + lines [ + (dt {id = "Writings#${id}";} + "${href {target = "_blank";} url (em 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: type: + details [ + (summary title) + (pre (code ( + lib.readFile "${data.publications.files}/${type}/${id}" + ))) + ]; + in + dd [ + (citeWith "BibLaTeX" "biblatex") + (citeWith "BibTeX" "bibtex") + (citeWith "CSL JSON" "csljson") + ]) + ]) + ]) + ]) + ]))) + ]; +in { + conferences = listPublications data.publications.conferences; + journals = listPublications data.publications.journals; + misc = listPublications data.publications.misc; + reports = listPublications data.publications.reports; +} diff --git a/html/sections.nix b/html/sections.nix index 3c4065f..78719f8 100644 --- a/html/sections.nix +++ b/html/sections.nix @@ -17,6 +17,6 @@ in ./education ./experience # ./languages - ./publications + ./research ./software ] diff --git a/lib/html.nix b/lib/html.nix index 105888e..a922e0e 100644 --- a/lib/html.nix +++ b/lib/html.nix @@ -202,35 +202,60 @@ icon = tryOverride (attrs: id: tagsContainerFuns.i (attrs // {class = id;}) ""); mailto = tryOverride (attrs: address: href attrs "mailto:${address}" address); + makeDate = date: let + year = builtins.toString date.year; + month = + lib.optionalString (date.month < 10) "0" + + builtins.toString date.month; + day = + if date ? day + then lib.optionalString (date.day < 10) "0" + builtins.toString date.day + else "0"; + monthPretty = builtins.head (lib.drop (date.month - 1) [ + "jan" + "feb" + "mar" + "apr" + "may" + "jun" + "jul" + "aug" + "sep" + "oct" + "nov" + "dev" + ]); + in { + tag = tagsContainerFuns.time {date = "${year}-${month}-${day}";}; + pretty = "${monthPretty}. " + lib.optionalString (day != "0") "${day}, " + year; + }; timerange = let - print = date: let - year = builtins.toString date.year; - month = - lib.optionalString (date.month < 10) "0" - + builtins.toString date.month; - monthPretty = builtins.head (lib.drop (date.month - 1) [ - "jan" - "feb" - "mar" - "apr" - "may" - "jun" - "jul" - "aug" - "sep" - "oct" - "nov" - "dev" - ]); - day = builtins.toString date.day; + print = dateValue: let + datePretty = (makeDate (builtins.removeAttrs dateValue ["day"])).pretty; in - tagsContainerFuns.time {date = "${year}-${month}-${day}";} - "${monthPretty}. ${year}"; + (makeDate dateValue).tag datePretty; in start: end: "${print start} - ${print end}"; doctype = type: '' ''; + + tab = name: { + id, + checked ? false, + title, + content, + }: + lines [ + (tagsEmptyFuns.inputWith ({ + inherit id name; + type = "radio"; + } + // lib.optionalAttrs checked {checked = "checked";})) + (tagsContainerFuns.label {for = id;} [(tagsContainerFuns.h4 title)]) + (tagsContainerFuns.div {class = "tab";} content) + ]; + tabbox = name: tabs: tagsContainerFuns.div {class = "tabs";} (builtins.map (tab name) tabs); in tagsContainerFuns // tagsEmptyFuns @@ -246,9 +271,15 @@ in icon lines mailto + makeDate timerange + tab + tabbox ; } + // { + blockquote = tryOverride (attrs: content: tagsContainerFuns.blockquote attrs (builtins.replaceStrings ["\n"] ["
"] content)); + } // { sort = let lt = x: y: x < y; -- cgit v1.2.3