summaryrefslogtreecommitdiff
path: root/html/research/talks.nix
blob: 9e1fd56e0159d1d06eb094cf1ab5504ffa1d54a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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")
                    ])
                ]
              )
            )
          ])
        ])
      ]))