resume/lib.typ
2024-06-13 23:37:18 -04:00

150 lines
3.3 KiB
Plaintext

#import "fontawesome.typ": github, fa, link-icon
#let DEFAULT_STRONG = 300;
#let SMALL_STRONG = 200;
#let TITLE_FONT = "New Computer Modern"
#let HEADING_FONT = TITLE_FONT
#let BODY_FONT = "New Computer Modern"
#let BODY_FONT_SIZE = 11pt
#let HEADING_FONT_SIZE = 0.95em
#let TITLE_FONT_SIZE = 2em
#let HEADING_LINE_GAP = 3mm
#let BODY_LINE_HEIGHT = 0.65em
#let BODY_LINE_SPACING = 0.75em
// rest = not top
#let PAGE_MARGINS = (right: 0.4in, rest: 0.3in)
// Format locations.
#let format_location(location) = {
[_#block(above: 0.7em, location)_]
}
#let indent(content) = {
block(inset: (left: 0em, right: 0em), content)
}
// General entry that is split into a left and right half (for experience and education).
#let cv_entry(left_content: none, right_content: none, details: none) = {
stack(
dir: ttb,
spacing: 0.75em,
grid(columns: (9fr, 5fr), column-gutter: 1cm, {
set strong(delta: DEFAULT_STRONG)
set align(left)
left_content
}, {
set strong(delta: SMALL_STRONG)
set align(right)
right_content
}),
{
set align(left)
set strong(delta: SMALL_STRONG)
details
},
)
}
// Entry for work.
#let work_entry(
role,
company,
tools: none,
tasks: none,
start_date: none,
end_date: none,
location: none,
) = {
let task_list = if tasks != none {
let list = []
for task in tasks {
list += [- #task]
}
list
} else {
none
}
cv_entry(left_content: {
set par(justify: true)
text[*#company* | _#role _]
}, right_content: {
[#start_date -- #end_date]
// if location != none {
// format_location(location)
// }
}, details: task_list)
}
#let project(title, tools, repo_link: none, demo_link: none) = {
set strong(delta: DEFAULT_STRONG)
let text_link = if demo_link != none { demo_link } else { repo_link }
if text_link != none {
link(text_link)[#text[*#title*]]
} else {
text[*#title*]
}
if demo_link != none {
link(demo_link)[ #fa(link-icon) ]
}
if repo_link != none {
link(repo_link)[ #fa(github) ]
}
[ | _ #tools _ ]
}
#let render_contact_data(data) = {
align(center)[
#let elements = for el in data {
(link(el.link)[#{ el.service + " " + el.display }],)
}
#text(1em)[#elements.join(" | ")]
]
}
// Set name and contact data and format headings
#let template(name, color, doc) = {
set page(margin: PAGE_MARGINS, paper: "us-letter")
set list(indent: 0.75em, marker: [•])
set text(font: (BODY_FONT), BODY_FONT_SIZE)
set par(leading: BODY_LINE_HEIGHT)
align(center)[
#text(
size: TITLE_FONT_SIZE,
font: TITLE_FONT,
fill: color,
)[#smallcaps[*#name*]]
#block(above: 0em, below: 1em)
]
show heading.where(level: 1): i => {
set align(left + horizon)
let title = smallcaps(i.body)
let colored_line(header_text) = style(styles => {
let size = measure(header_text, styles)
// 100% - spacing - width of text
line(
length: 100% - HEADING_LINE_GAP - size.width,
stroke: (paint: color, thickness: 2pt, cap: "round"),
)
})
set block(above: 0.9em, below: 0.75em)
set text(size: HEADING_FONT_SIZE, fill: color, font: HEADING_FONT)
stack(
dir: ltr,
spacing: HEADING_LINE_GAP,
title,
box(height: 2pt, fill: color, colored_line(title)),
)
}
doc
}