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 --- lib/html.nix | 75 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 22 deletions(-) (limited to 'lib') 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