diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2023-08-21 17:50:43 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2023-08-23 18:29:57 +0200 |
| commit | baea04747697ad5039139ef44bca7b3965147696 (patch) | |
| tree | 6da0d87642c19120d913b66b1734d3de6fbb385d | |
| parent | 5752f0a1017f33c78428a915d3bcf2ccd80f3e79 (diff) | |
update info api
| -rw-r--r-- | flake.lock | 18 | ||||
| -rw-r--r-- | html/basics/default.nix | 18 | ||||
| -rw-r--r-- | html/default.nix | 7 | ||||
| -rw-r--r-- | html/education/default.nix | 45 | ||||
| -rw-r--r-- | html/experience/default.nix | 38 | ||||
| -rw-r--r-- | html/languages/default.nix | 7 | ||||
| -rw-r--r-- | html/publications/default.nix | 3 | ||||
| -rw-r--r-- | html/software/default.nix | 3 | ||||
| -rw-r--r-- | lib/html.nix | 57 |
9 files changed, 116 insertions, 80 deletions
@@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1682852116, - "narHash": "sha256-5li0CpsqimwXlu/UksbPs8mVD4irI47OhiO+Bccmlws=", + "lastModified": 1692720006, + "narHash": "sha256-yM/quM30O8aq/Cnte2e13xIWI89pEPycWSipf7l3vPA=", "owner": "qaristote", "repo": "info", - "rev": "ecf9d48f7395914ebe86295bfd06065f00a8eac7", + "rev": "f5ffcc09b782d286e658a5599443bbe711df6281", "type": "github" }, "original": { @@ -28,11 +28,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", "type": "github" }, "original": { @@ -42,11 +42,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1685677062, - "narHash": "sha256-zoHF7+HNwNwne2XEomphbdc4Y8tdWT16EUxUTXpOKpQ=", + "lastModified": 1692742407, + "narHash": "sha256-faLzZ2u3Wki8h9ykEfzQr19B464eyADP3Ux7A/vjKIY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "95be94370d09f97f6af6a1df1eb9649b5260724e", + "rev": "a2eca347ae1e542af3f818274c38305c1e00604c", "type": "github" }, "original": { diff --git a/html/basics/default.nix b/html/basics/default.nix index 7ee8be4..55de692 100644 --- a/html/basics/default.nix +++ b/html/basics/default.nix @@ -1,7 +1,9 @@ { html, data, lib, ... }: let - basics = data.basics; + basics = data.basics // { + fullname = with data.basics.name; "${first} ${last}"; + }; col = html.div { class = "col"; style = "align-self: center"; @@ -13,8 +15,7 @@ in { title = "About me"; priority = 0; body = with html; - with data.basics; - lines [ + with basics; [ br (div { class = "row"; } [ (col [ @@ -27,7 +28,7 @@ in { "512" ] ++ [ "${avatar} 934w" ]); sizes = "(max-width: 480px) 60vw, 30vw"; - alt = "Quentin Aristote"; + alt = fullname; style = '' aspect-ratio: 1 / 1; border-radius: 50%; @@ -35,13 +36,14 @@ in { display: block; ''; }) - (center h3 name) - (center p (with institution; [ position br "@ ${href url name}" ])) + (center h3 fullname) + (center p (with institution; [ position wbr "@ ${href url name}" ])) ]) (col (dl [ (dt "${icon "las la-at"} e-mail") - (dd (for email - (email: "${mailto email.address} (${email.name}) ${br}"))) + (dd + (lib.mapAttrsToList (name: value: "${mailto value} (${name}) ${br}") + email)) (dt "${icon "las la-key"} keys") (dd (for keys.pgp (name: path: href path name))) (dt "${icon "las la-map-marker"} address") diff --git a/html/default.nix b/html/default.nix index 61e7a96..0d4f19a 100644 --- a/html/default.nix +++ b/html/default.nix @@ -1,4 +1,4 @@ -{ html, make, ... }: +{ html, make, data, ... }: let sections = html.sort.byKey "priority" (make ./sections.nix { }); @@ -8,15 +8,16 @@ let rel = "preload"; as = "font"; }; + fullname = with data.basics.name; "${first} ${last}"; in with html; doctype "html" + html.html { lang = "en"; } [ (head [ # Basic page needs (metaWith { charset = "utf-8"; }) - (title "Quentin Aristote") + (title fullname) (metaWith { name = "description"; - content = "Personal webpage of Quentin Aristote"; + content = "Personal webpage of ${fullname}"; }) (metaWith { name = "author"; diff --git a/html/education/default.nix b/html/education/default.nix index e1027e3..56f0915 100644 --- a/html/education/default.nix +++ b/html/education/default.nix @@ -1,38 +1,37 @@ { html, data, lib, ... }: -let education = data.education; +let + education = data.education; + sortByDateStart = html.sort.reverse.byFun + (item: with item.date.start; day + 100 * month + 10000 * year); in { title = "Education"; priority = 30; body = with html; - dl (for (sort.reverse.byPath [ "date" "start" ] education) (item: - with item; - lines [ + dl (for (sortByDateStart education) (item: + with item; [ (dt [ (with institution; "${studyType} @ ${href url name}, ${location}") br (with date; small (timerange start end)) ]) (dd [ - (lib.optionalString (lib.hasAttr "years" item) (lines - (for (sort.reverse.byPath [ "date" "start" ] years) (year: - with year; - details [ - (summary [ - (with program; - "${studyType} @ ${ - href url (abbr { title = name; } acronym) - }") - br - (with date; small (timerange start end)) - ]) - description - (lines (for courses (category: list: - details [ - (summary "${category} courses") - (lib.concatStringsSep " · " (lib.naturalSort list)) - ]))) - ])))) + (lib.optionalString (item ? years) (for (sortByDateStart years) (year: + with year; + details [ + (summary [ + (with program; + "${studyType} @ ${href url (abbr { title = name; } acronym)}") + br + (with date; small (timerange start end)) + ]) + description + (for courses (category: list: + details [ + (summary "${category} courses") + (lib.concatStringsSep " · " (lib.naturalSort list)) + ])) + ]))) description ]) ])); diff --git a/html/experience/default.nix b/html/experience/default.nix index b89396b..abe1109 100644 --- a/html/experience/default.nix +++ b/html/experience/default.nix @@ -5,22 +5,24 @@ in { title = "Experience"; priority = 20; body = with html; - dl (for (sort.reverse.byPath [ "date" "start" ] experience) (item: - with item; - lines [ - (dt [ - (with institution; "${position} @ ${href url name}, ${location}") - br - (small (lib.concatStringsSep " · " - ([ (with date; timerange start end) ] - ++ lib.optional (lib.hasAttr "supervisors" item) - "supervised by ${ - lib.concatStringsSep " " - (for supervisors (supervisor: with supervisor; href url name)) - }" ++ lib.optional (lib.hasAttr "assets" item) - (lib.concatStringsSep " " (for assets - (asset: with asset; href "#${type}#${id}" "${icon "las la-paperclip"} ${name}")))))) - ]) - (dd description) - ])); + dl (for + (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}")))))) + ]) + (dd description) + ])); } diff --git a/html/languages/default.nix b/html/languages/default.nix index 36780db..f7c49f0 100644 --- a/html/languages/default.nix +++ b/html/languages/default.nix @@ -5,6 +5,9 @@ in { title = "Languages"; priority = 40; body = with html; - lines (for languages - (language: with language; "${icon} ${name} (${proficiency})")); + (for languages (language: + with language; + "${ + lib.concatStrings (for icon.codepoints (codepoint: "&x${codepoint}")) + } ${name} (${proficiency})")); } diff --git a/html/publications/default.nix b/html/publications/default.nix index 1a2688b..289f9e3 100644 --- a/html/publications/default.nix +++ b/html/publications/default.nix @@ -15,7 +15,8 @@ let { inherit id title url year abstract cite; } // (let - authorsOther = lib.remove data.basics.name + 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}"; diff --git a/html/software/default.nix b/html/software/default.nix index d0ed803..49f4627 100644 --- a/html/software/default.nix +++ b/html/software/default.nix @@ -20,8 +20,7 @@ in { body = with html; dl (for (sort.byPath [ "title" ] software) (softwarePiece: let formatted = format softwarePiece; - in with formatted; - lines [ + in with formatted; [ (dt { id = "Software#${id}"; } (href { target = "_blank"; } url title)) (dd abstract) ])); diff --git a/lib/html.nix b/lib/html.nix index 8bda47c..f66184b 100644 --- a/lib/html.nix +++ b/lib/html.nix @@ -2,10 +2,16 @@ let comment = content: "<!-- ${content} -->"; - lines = lib.concatStringsSep "\n"; - sortByPath = cmp: keys: - lib.sort - (x: y: cmp (lib.getAttrFromPath keys x) (lib.getAttrFromPath keys y)); + lines = content: + if lib.isList content then + (if content == [ ] then + "" + else + lines (builtins.head content) + "\n" + lines (builtins.tail content)) + else + content; + sortByFun = cmp: f: lib.sort (x: y: cmp (f x) (f y)); + sortByPath = cmp: keys: sortByFun cmp (lib.getAttrFromPath keys); sortByKey = cmp: key: sortByPath cmp [ key ]; for = iterable: f: if lib.isList iterable then @@ -18,16 +24,14 @@ let "<${tag}${ lib.concatMapStrings (x: " ${x}") (lib.mapAttrsToList setAttr attrs) }>"; - lineOrLines = f: content: - if lib.isList content then f (lines content) else f content; tryOverride = f: arg: if lib.isAttrs arg then tryOverride (attrs: content: f (arg // attrs) content) else f { } arg; container = tag: - tryOverride (attrs: - lineOrLines (content: "${tagWithAttrs tag attrs}${content}</${tag}>")); + tryOverride + (attrs: content: "${tagWithAttrs tag attrs}${lines content}</${tag}>"); empty = tagWithAttrs; @@ -198,13 +202,36 @@ let icon = tryOverride (attrs: id: tagsContainerFuns.i (attrs // { class = id; }) ""); mailto = tryOverride (attrs: address: href attrs "mailto:${address}" address); - timerange = start: end: - "${tagsContainerFuns.time { date = start; } start} - ${ - tagsContainerFuns.time { date = end; } end - }"; - doctype = type: "<!DOCTYPE ${type}>\n"; + 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; + in tagsContainerFuns.time { date = "${year}-${month}-${day}"; } + "${monthPretty}. ${year}"; + in start: end: "${print start} - ${print end}"; + doctype = type: '' + <!DOCTYPE ${type}> + ''; in tagsContainerFuns // tagsEmptyFuns // { - inherit for comment container doctype empty file href icon lines mailto timerange; + inherit for comment container doctype empty file href icon lines mailto + timerange; } // { sort = let lt = x: y: x < y; @@ -212,9 +239,11 @@ in tagsContainerFuns // tagsEmptyFuns // { in { byKey = sortByKey lt; byPath = sortByPath lt; + byFun = sortByFun lt; reverse = { byKey = sortByKey gt; byPath = sortByPath gt; + byFun = sortByFun gt; }; }; } |
