-
Notifications
You must be signed in to change notification settings - Fork 13
/
research.qmd
95 lines (79 loc) · 2.69 KB
/
research.qmd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
title: "Research"
echo: false
jupyter: python3
section-divs: false
keep-md: true
format: html
---
```{python}
import yaml
from IPython.display import display, Markdown, HTML
def readable_list(_s):
if len(_s) < 3:
return ' and '.join(map(str, _s))
*a, b = _s
return f"{', '.join(map(str, a))}, and {b}"
def button(url, str, icon):
icon_base = icon[:2]
return f"""<a class="btn btn-outline-dark btn-sm", href="{url}" target="_blank" rel="noopener noreferrer">
<i class="{icon_base} {icon}" role='img' aria-label='{str}'></i>
{str}
</a>"""
yaml_data = yaml.safe_load(open("papers.yaml"))
pub_strs = {"pubs": {}, "wps": {}}
for _, data in yaml_data.items():
title_str = data["title"]
authors = data.get("authors", ["me"])
authors = [aut if aut != "me" else "<strong>Drew Dimmery</strong>" for aut in authors]
author_str = readable_list(authors)
year_str = data["year"]
buttons = []
preprint = data.get("preprint")
if preprint is not None:
buttons.append(button(preprint, "Preprint", "bi-file-earmark-pdf"))
github = data.get("github")
if github is not None:
buttons.append(button(github, "Github", "bi-github"))
pub_url = data.get("published_url")
venue = data.get("venue")
working_paper = pub_url is None
pub_str = f'{author_str}. ({year_str}) "{title_str}."'
if venue is not None:
pub_str += f" <em>{venue}</em>"
if working_paper:
if year_str not in pub_strs["wps"]:
pub_strs["wps"][year_str] = []
pub_strs["wps"][year_str].append(
"<li class='list-group-item'>" + pub_str + "<br>" + " ".join(buttons) + "</li>"
)
else:
if year_str not in pub_strs["pubs"]:
pub_strs["pubs"][year_str] = []
buttons.append(button(pub_url, "Published", "ai-archive"))
pub_strs["pubs"][year_str].append(
"<li class='list-group-item'>" + pub_str + "<br>" + " ".join(buttons) + "</li>"
)
```
## Published
```{python}
#| label: "published-year"
#| id: "published-year"
#| output: asis
for year in sorted(pub_strs["pubs"].keys(), reverse=True):
display(Markdown(f"### {year}" + "{#" + f"published-{year}" + "}"))
display(HTML(
"<ul class='list-group list-group-flush'>" + '\n'.join(pub_strs["pubs"][year]) + "</ul>"
))
```
## Working Papers / Non-archival
```{python}
#| label: "not-published-year"
#| id: "not-published-year"
#| output: asis
for year in sorted(pub_strs["wps"].keys(), reverse=True):
display(Markdown(f"### {year}" + "{#" + f"not-published-{year}" + "}"))
display(HTML(
"<ul class='list-group list-group-flush'>" + '\n'.join(pub_strs["wps"][year]) + "</ul>"
))
```