Skip to content

Commit 5a2deb3

Browse files
Merge pull request #2 from j-bmn/awards
Papers: Add "Awards" field
2 parents 66a8179 + cc49ff4 commit 5a2deb3

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ assume them to be empty otherwise), while the other fields (`venue`, `year`,
177177

178178
- `title`: Title of your paper. Will be used as header of the block.
179179
- `authors`: List of authors.
180+
- `awards` (optional, string or list of string): Award(s) that your paper may
181+
have received.
180182
- `venue` (optional): Journal or conference.
181183
- `year` (optional): Date of the conference, if present it is going to be in
182184
parentheses after the venue (unless the venue is absent in which case it

pandoc/paper.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function jsondata(data)
88
newdata.venue = data.venue
99
newdata.year = data.year
1010
newdata.files = data.files or pandoc.List()
11+
newdata.awards = data.awards or pandoc.List()
1112

1213
return newdata
1314

@@ -38,6 +39,15 @@ function yamldata(data)
3839
return newfile
3940
end)
4041

42+
local awards = data["awards"] or pandoc.List()
43+
if pandoc.utils.type(awards) == 'List' then
44+
newdata.awards = awards:map(function(data)
45+
return pandoc.utils.stringify(data)
46+
end)
47+
else
48+
newdata.awards = pandoc.utils.stringify(awards)
49+
end
50+
4151
return newdata
4252

4353
end
@@ -47,6 +57,7 @@ function paper(data)
4757
local title = data.title
4858
local url = data.url
4959
local authors = data.authors
60+
local awards = data.awards
5061
local venue = data.venue
5162
local year = data.year
5263
local files = data.files
@@ -59,6 +70,22 @@ function paper(data)
5970
header = { title }
6071
end
6172

73+
local award_info = {}
74+
if awards then
75+
if not (pandoc.utils.type(awards) == 'List') then
76+
awards = pandoc.List({awards})
77+
end
78+
award_info = awards:map(function(awd)
79+
local icon = "<i class=\" fa-solid fa-award\"></i>"
80+
81+
local html_output = string.format(
82+
"<span>%s %s</span>",
83+
icon, awd
84+
)
85+
return pandoc.RawBlock("html", html_output)
86+
end)
87+
end
88+
6289
local sub = {}
6390

6491
if venue and year then
@@ -110,6 +137,7 @@ function paper(data)
110137

111138
local div_content = {
112139
pandoc.Header(3, header),
140+
pandoc.Div(award_info, {class = "awards"}),
113141
pandoc.Div(authors, {class = "authors"}),
114142
pandoc.Para(sub),
115143
pandoc.Div(file_info, {class = "files"})

src/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ My workflow is usually to use <kbd>Ctrl</kbd> + <kbd>C</kbd> /
5252
``` json {.paper}
5353
"title": "Towards automatic academic pages",
5454
"authors": "Templato Urnehm, U. N. Owen",
55+
"awards": "Automatic Award",
5556
"venue": "Principles of Awesomeness (PAW)",
5657
"year": "2023",
5758
"url": "https://basicpage.github.io",
@@ -67,6 +68,9 @@ My workflow is usually to use <kbd>Ctrl</kbd> + <kbd>C</kbd> /
6768
``` yaml {.paper}
6869
title: Yet another yaml parser 3
6970
authors: Templato Urnehm
71+
awards:
72+
- Yet another "Yet another" award
73+
- Never-ending Work Award
7074
venue: Proceedings of Nihilism
7175
year: 2029
7276
url: https://basicpage.github.io
@@ -94,6 +98,7 @@ papers:
9498
src: foo.bib
9599
- title: Yet another yaml parser
96100
authors: Templato Urnehm
101+
awards: Yet another "Yet another" award
97102
venue: Proceedings of Nihilism
98103
year: 2025
99104
files:
@@ -123,6 +128,10 @@ papers:
123128
``` json {.paper}
124129
"title": "TBD",
125130
"authors": "TBD",
131+
"awards": [
132+
"Best Draft Award",
133+
"Test-of-time Award for works which just never leave the draft stage"
134+
],
126135
"files": [
127136
{ "text": "🐱 video", "type": "video", "src": "foo.mov" },
128137
{ "text": "Poem", "type": "txt", "src": "foo.txt" },

website/style.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,23 @@ div.files a:hover {
335335
text-decoration: none;
336336
}
337337

338+
div.awards {
339+
display: flex;
340+
justify-content: flex-start;
341+
flex-direction: row;
342+
flex-wrap: wrap;
343+
align-items: baseline;
344+
gap: 5px 0;
345+
}
346+
347+
div.awards span {
348+
border-radius: 5px;
349+
padding: 4px;
350+
margin-right: 5px;
351+
background: #F6ECD0;
352+
color: #CF9C11;
353+
}
354+
338355
span.lastupdate {
339356
color: #9e9d9d;
340357
}

0 commit comments

Comments
 (0)