-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.typ
61 lines (50 loc) · 1.45 KB
/
utils.typ
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
#let config = toml("config.toml")
// Create a consistent vertical spacing
#let space(h: 0.6em) = v(h, weak: true)
// Shortcut for evaluating a string as markup
#let markup(str) = eval(str, mode: "markup")
// Format a job entry
#let job(title: "", company: "", location: "", start: "", end: "Present", achievements: ()) = {
let format = "[month repr:long] [year]"
let end = if type(end) == str [#end] else [#end.display(format)]
stack(
dir: ltr,
align(alignment.start, [*#title* \ #company]),
align(alignment.end, [#start.display(format) --- #end \ #emph(location)])
)
space(h: 0.7em)
list(..achievements)
}
// Format a project entry
#let project(title: "", github: "", tags: (), achievements: ()) = {
if not config.projects.enabled.contains(github) {
return []
}
[
#link("https://github.com/" + github, title)
--
#tags.map(t => text(weight: "semibold", t)).join(", ")
]
space(h: 0.7em)
list(..achievements)
}
// Create a section heading
#let section(title: "", right: "") = {
[
*#upper(title)*
#h(1fr)
#right
]
line(length: 100%)
}
// Create a coloured header with some centered content
#let header(content, padding: 0.4in, alignment: center + horizon) = box(
width: 100%,
fill: rgb(38, 38, 38),
// we want to push the content below it down
inset: (bottom: padding - 0.1in),
// but since this is at the top, we want to fill
// the margin with the background of the box
outset: (x: padding, top: padding),
align(alignment, content)
)