-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.typ
139 lines (116 loc) · 2.99 KB
/
template.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#let contact(text: "", link: none) = {
(text: text, link: link)
}
#let subSection(title: "", titleEnd: none, subTitle: none, subTitleEnd: none, content: []) = {
(title: title, titleEnd: titleEnd, subTitle: subTitle, subTitleEnd: subTitleEnd, content: content)
}
#let section(title: "", content: subSection()) = {
(title: title, content: content)
}
#let project(
theme: rgb("#4273B0"),
name: "",
email: none,
title: none,
contact: ((text: [], link: "")),
skills: (
languages: ()
),
main: (
(title: "", content: [])
),
sidebar: (),
body) = {
let backgroundTitle(content) = {
align(center, box(fill: theme, text(white, size: 1.25em, weight: "bold", upper(content)), width: 1fr, inset: 0.3em))
}
let secondaryTitle(content) = {
text(weight: "bold", size: 1.125em, upper(content))
}
let italicColorTitle(content) = {
text(weight: "bold", style: "italic", size: 1.125em, theme, content)
}
let formattedName = block(upper(text(2.5em, weight: "bold", theme, name)))
let formattedTitle = block(upper(text(2.25em, gray.darken(50%), title)))
let titleColumn = align(center)[
#formattedName
#formattedTitle
]
let contactColumn = align(center)[#contact.map(c => {
if c.link == none [
#c.text\
] else [
#underline(link(c.link, text(theme, c.text)))\
]
}).join()]
grid(
columns: (1fr, 2fr),
column-gutter: 2em,
contactColumn,
titleColumn,
)
set par(justify: true)
let formattedLanguageSkills = [
#text(skills.languages.join(" • "))
]
let createLeftRight(left: [], right: none) = {
if (right == none) {
align(start, text(left))
} else {
grid(
columns: (1fr, 1fr),
align(start, text(left)),
align(end, right),
)
}
}
// let parseContentList(contentList) = {
// if contentList.format == "bulletJoin" [
// #text(contentList.content.join(" • "))
// ] else if contentList.format == "bulletList" [
// #contentList.content.map(c => list(c)).join()
// ]
// }
let parseSubSections(subSections) = {
subSections.map(s => {
[
#createLeftRight(
left: secondaryTitle(s.title),
right: if s.titleEnd != none {
italicColorTitle(s.titleEnd)
}
)
#if s.subTitle != none or s.subTitleEnd != none [
#text(
top-edge: 0.2em,
createLeftRight(
left: italicColorTitle(s.subTitle),
right: s.subTitleEnd
),
)
]
#s.content
]
}).join()
}
let parseSection(section) = {
section.map(m => {
[
#backgroundTitle(m.title)
#parseSubSections(m.content)
]
}).join()
}
let mainSection = parseSection(main)
let sidebarSection = parseSection(sidebar)
grid(
columns: (1fr, 2fr),
column-gutter: 1em,
sidebarSection,
mainSection,
)
// Main body.
set par(justify: true)
show: columns.with(3, gutter: 1.3em)
// body
}