Skip to content

Commit 7ad563c

Browse files
committed
feat: nerd font icon
1 parent f537b28 commit 7ad563c

File tree

7 files changed

+508
-40
lines changed

7 files changed

+508
-40
lines changed

src/components/sections.typ

Lines changed: 124 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#import "@preview/nerd-icons:0.2.0": nf-icon
12
#import "./share.typ": *
23
#import "./layouts.typ": *
34
#import "../locales.typ": *
@@ -23,11 +24,11 @@
2324
) = {
2425
align(position)[
2526
#upper(text(base-font-size + 16pt, weight: "extrabold")[#title])
26-
#v(-1em)
27+
#v(-0.8em)
2728
]
2829
align(position)[
2930
#upper(text(base-font-size + 6pt, weight: "bold")[#label])
30-
#v(-0.5em)
31+
#v(-0.3em)
3132
]
3233
}
3334

@@ -42,10 +43,26 @@
4243
#{
4344
let gap = 0.2em
4445
let items = (
45-
contact_item(location),
46-
contact_item(phone, link-type: "tel:"),
47-
contact_item(email, link-type: "mailto:"),
48-
contact_item(url, link-type: "https://"),
46+
[
47+
#nf-icon("map")
48+
#h(0.4em)
49+
#contact_item(location)
50+
],
51+
[
52+
#nf-icon("phone")
53+
#h(0.4em)
54+
#contact_item(phone, link-type: "tel:"),
55+
],
56+
[
57+
#nf-icon("email")
58+
#h(0.4em)
59+
#contact_item(email, link-type: "mailto:")
60+
],
61+
[
62+
#nf-icon("web")
63+
#h(0.4em)
64+
#contact_item(url, link-type: "https://")
65+
],
4966
)
5067

5168
items
@@ -79,8 +96,17 @@
7996
let period = start-date + " ~ " + end-date
8097
generic_2x2(
8198
(1fr, 1fr),
82-
strong(if website == "" { company } else { link(website)[#company] }),
83-
[_*#period*_],
99+
strong(
100+
if website == "" {
101+
company
102+
} else {
103+
[
104+
#underline[#link(website)[#company]]
105+
#nf-icon("web")
106+
]
107+
},
108+
),
109+
emph(period),
84110
emph(position),
85111
emph(location),
86112
)
@@ -99,8 +125,14 @@
99125
website: work-item.at("website", default: ""),
100126
location: location-to-str(work-item.at("location", default: "")),
101127
position: work-item.at("position", default: ""),
102-
start-date: date-to-str(work-item.at("startDate", default: "")),
103-
end-date: date-to-str(work-item.at("endDate", default: "")),
128+
start-date: date-to-str(
129+
date: work-item.at("startDate", default: ""),
130+
lang: lang,
131+
),
132+
end-date: date-to-str(
133+
date: work-item.at("endDate", default: ""),
134+
lang: lang,
135+
),
104136
summary: work-item.at("summary", default: ""),
105137
highlights: work-item.at("highlights", default: ()),
106138
))
@@ -125,12 +157,26 @@
125157
let period = start-date + " ~ " + end-date
126158
generic_2x2(
127159
(1fr, 1fr),
128-
strong(if website == "" { name } else { link(website)[#name] }),
129-
[_*#period*_],
160+
strong(
161+
if website == "" {
162+
name
163+
} else {
164+
[
165+
#underline[#link(website)[#name]]
166+
#nf-icon("web")
167+
]
168+
},
169+
),
170+
emph(period),
130171
if github-url == "" {
131172
""
132173
} else {
133-
underline(offset: 0.2em)[#emph(link(github-url)[#"Repo Link"])]
174+
[
175+
#underline(offset: 0.2em)[
176+
#emph(link(github-url)[#"Repo"])
177+
]
178+
#nf-icon("link")
179+
]
134180
},
135181
"",
136182
)
@@ -148,8 +194,14 @@
148194
name: project-item.at("name", default: ""),
149195
website: project-item.at("website", default: ""),
150196
github-url: project-item.at("githubUrl", default: ""),
151-
start-date: date-to-str(project-item.at("startDate", default: "")),
152-
end-date: date-to-str(project-item.at("endDate", default: "")),
197+
start-date: date-to-str(
198+
date: project-item.at("startDate", default: ""),
199+
lang: lang,
200+
),
201+
end-date: date-to-str(
202+
date: project-item.at("endDate", default: ""),
203+
lang: lang,
204+
),
153205
summary: project-item.at("summary", default: ""),
154206
highlights: project-item.at("highlights", default: ()),
155207
))
@@ -171,8 +223,17 @@
171223
) = {
172224
generic_2x2(
173225
(1fr, 1fr),
174-
strong(if url == "" { name } else { link(url)[#name] }),
175-
[_*#release-date*_],
226+
strong(
227+
if url == "" {
228+
name
229+
} else {
230+
[
231+
#underline[#link(url)[#name]]
232+
#nf-icon("web")
233+
]
234+
},
235+
),
236+
emph(release-date),
176237
emph(publisher),
177238
"",
178239
)
@@ -186,7 +247,10 @@
186247
.map(publication-item => single-publication-item(
187248
name: publication-item.at("name", default: ""),
188249
url: publication-item.at("url", default: ""),
189-
release-date: date-to-str(publication-item.at("releaseDate", default: "")),
250+
release-date: date-to-str(
251+
date: publication-item.at("releaseDate", default: ""),
252+
lang: lang,
253+
),
190254
publisher: publication-item.at("publisher", default: ""),
191255
summary: publication-item.at("summary", default: ""),
192256
))
@@ -214,7 +278,7 @@
214278
generic_2x2(
215279
(1fr, 1fr),
216280
[*#institution*],
217-
[_*#period*_],
281+
emph(period),
218282
emph(degree),
219283
emph(location),
220284
)
@@ -237,8 +301,14 @@
237301
major: education-item.at("major", default: ""),
238302
degree: education-item.at("degree", default: ""),
239303
gpa: education-item.at("gpa", default: ""),
240-
start-date: date-to-str(education-item.at("startDate", default: "")),
241-
end-date: date-to-str(education-item.at("endDate", default: "")),
304+
start-date: date-to-str(
305+
date: education-item.at("startDate", default: ""),
306+
lang: lang,
307+
),
308+
end-date: date-to-str(
309+
date: education-item.at("endDate", default: ""),
310+
lang: lang,
311+
),
242312
activities: education-item.at("activities", default: ()),
243313
courses: education-item.at("courses", default: ()),
244314
))
@@ -261,24 +331,41 @@
261331
let period = issue-date + " ~ " + exp-date
262332
generic_2x2(
263333
(1fr, 1fr),
264-
strong(if url == "" { name } else { link(url)[#name] }),
265-
[_*#period*_],
334+
strong(
335+
if url == "" {
336+
name
337+
} else {
338+
[
339+
#underline[#link(url)[#name]]
340+
#nf-icon("web")
341+
]
342+
},
343+
),
344+
emph(period),
266345
emph(issuer),
267346
"",
268347
)
269348
}
270349

271350
[
272351
= #i18n.title.certifications.at(lang)
273-
#for certificate-item in data {
274-
single-certificate-item(
275-
name: certificate-item.at("name", default: ""),
276-
url: certificate-item.at("url", default: ""),
277-
issue-date: date-to-str(certificate-item.at("issueDate", default: "")),
278-
exp-date: date-to-str(certificate-item.at("expDate", default: "")),
279-
issuer: certificate-item.at("issuer", default: ""),
280-
)
281-
}
352+
#(
353+
data
354+
.map(certificate-item => single-certificate-item(
355+
name: certificate-item.at("name", default: ""),
356+
url: certificate-item.at("url", default: ""),
357+
issue-date: date-to-str(
358+
date: certificate-item.at("issueDate", default: ""),
359+
lang: lang,
360+
),
361+
exp-date: date-to-str(
362+
date: certificate-item.at("expDate", default: ""),
363+
lang: lang,
364+
),
365+
issuer: certificate-item.at("issuer", default: ""),
366+
))
367+
.join(v(0.6em))
368+
)
282369
]
283370
}
284371

@@ -296,7 +383,7 @@
296383
generic_2x2(
297384
(auto, 1fr),
298385
strong(title),
299-
[_*#date*_],
386+
emph(date),
300387
emph(awarder),
301388
"",
302389
)
@@ -316,7 +403,10 @@
316403
data
317404
.map(award-item => single-award-item(
318405
title: award-item.at("title", default: ""),
319-
date: date-to-str(award-item.at("date", default: "")),
406+
date: date-to-str(
407+
date: award-item.at("date", default: ""),
408+
lang: lang,
409+
),
320410
awarder: award-item.at("awarder", default: ""),
321411
summary: award-item.at("summary", default: ""),
322412
description: award-item.at("description", default: ""),

src/jsume.typ

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#import "@preview/zh-format:0.1.0": *
2+
#import "@preview/nerd-icons:0.2.0": change-nerd-font
13
#import "./components/sections.typ": *
24

35
#let jsume(
@@ -6,7 +8,8 @@
68
bottom-margin: 0.3in,
79
left-margin: 0.3in,
810
right-margin: 0.3in,
9-
font: "Maple Mono NF",
11+
font: "New Computer Modern",
12+
nerd-font: "",
1013
font-size: 11pt,
1114
lang: "en",
1215
jsume-data: (),
@@ -26,6 +29,9 @@
2629
let author = basics.at("name", default: "")
2730
let label = basics.at("label", default: "")
2831

32+
show: zh-format
33+
change-nerd-font(nerd-font)
34+
2935
set document(
3036
title: title,
3137
author: author,
@@ -45,8 +51,8 @@
4551
)
4652

4753
set par(
48-
leading: 0.8em,
49-
spacing: 0.8em,
54+
leading: 0.7em,
55+
spacing: 0.7em,
5056
)
5157

5258
set text(

src/locales.typ

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@
3333
"zh": "语言",
3434
),
3535
),
36+
present: (
37+
"en": "Present",
38+
"zh": "现在",
39+
),
3640
)

src/utils.typ

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#import "./locales.typ": i18n
2+
13
#let location-to-str(location) = {
24
if type(location) == str {
35
return location
@@ -18,9 +20,12 @@
1820
}
1921
}
2022

21-
#let date-to-str(date) = {
23+
#let date-to-str(
24+
date: false,
25+
lang: "en",
26+
) = {
2227
if date == false {
23-
return "Present"
28+
return i18n.present.at(lang)
2429
} else if type(date) == str {
2530
return date
2631
} else if type(date) == type((:)) {

0 commit comments

Comments
 (0)