summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraristote <quentin.aristote@irif.fr>2025-07-27 17:47:32 +0200
committeraristote <quentin.aristote@irif.fr>2025-07-27 17:47:32 +0200
commit8622e40e675c72b9402625189517f99891a046c9 (patch)
treee1384995b609e7154f38725a29183f2f442d2c75 /lib
parent90b687b24ca7f64bd4087144a40c6a2f6e3c14a9 (diff)
add talks to publications, rename to research, split into tabbox
Diffstat (limited to 'lib')
-rw-r--r--lib/html.nix75
1 files changed, 53 insertions, 22 deletions
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: ''
<!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,10 +271,16 @@ in
icon
lines
mailto
+ makeDate
timerange
+ tab
+ tabbox
;
}
// {
+ blockquote = tryOverride (attrs: content: tagsContainerFuns.blockquote attrs (builtins.replaceStrings ["\n"] ["<br>"] content));
+ }
+ // {
sort = let
lt = x: y: x < y;
gt = x: y: x > y;