chore: refactor 2

This commit is contained in:
eggy 2023-10-21 22:36:52 -04:00
parent 19a5af8798
commit 987f255a87
2 changed files with 12 additions and 53 deletions

View File

@ -1,5 +1,5 @@
#import "fontawesome.typ": fa, globe, github, linkedin, envelope
#import "lib.typ": template, education_entry, work_entry, project, indent, SMALL_STRONG, DEFAULT_STRONG
#import "lib.typ": template, work_entry, project, indent, SMALL_STRONG, DEFAULT_STRONG
// orange!!
#let color = rgb("#ff983e")
@ -108,10 +108,13 @@
= Education
#indent[
#education_entry(
"University of Waterloo", "B.A.Sc. in Computer Engineering", start_date: "Sep 2022", end_date: "Apr 2027 (expected)",
#work_entry(
"University of Waterloo",
"B.A.Sc. in Computer Engineering",
start_date: "Sep 2022", end_date: "Apr 2027 (expected)",
location: "Waterloo, ON",
details: (
tasks: (
[Courses: Object-oriented programming, data structures & algorithms, digital computers & circuits],
))
)
)
]

52
lib.typ
View File

@ -17,21 +17,6 @@
// rest = not top
#let PAGE_MARGINS = (rest: 0.5in, top: 0.4in)
// Format start and end dates.
#let format_date(start_date: none, end_date: none) = {
let date = {
if end_date == none {
start_date
} else if start_date == none {
end_date
} else {
[#start_date -- #end_date]
}
}
[*#date*]
}
// Format locations.
#let format_location(location) = {
[_#block(above: 0.7em, location)_]
@ -48,11 +33,12 @@
#let cv_entry(left_content: none, right_content: none, details: none) = {
stack(
dir: ttb,
spacing: 0.75em,
spacing: 0.9em,
grid(
columns: (11fr, 6fr),
column-gutter: 1cm,
{
set strong(delta: DEFAULT_STRONG)
set align(left)
left_content
},
@ -70,33 +56,6 @@
)
}
// Entry for education.
#let education_entry(university, degree, start_date: none, end_date: none, location: none, details: none) = {
let details_list = if details != none {
let list = []
for detail in details {
list += [- #detail]
}
list
} else {
none
}
cv_entry(
left_content: {
set strong(delta: DEFAULT_STRONG)
text(1.2em)[*#university*] + "\n" + emph[#degree]
},
right_content: {
format_date(start_date: start_date, end_date: end_date)
if location != none {
"\n" + format_location(location)
}
},
details: details_list
)
}
// Entry for work.
#let work_entry(role, company, tasks: none, start_date: none, end_date: none, location: none) = {
let task_list = if tasks != none {
@ -113,7 +72,7 @@
text(1.1em)[*#role*] + "\n" + text[#emph[#company]]
},
right_content: {
format_date(start_date: start_date, end_date: end_date)
[*#start_date -- #end_date*]
if location != none {
"\n" + format_location(location)
@ -130,7 +89,6 @@
// Set name and contact data and format headings
#let template(name, contact_data, color, doc) = {
set page(margin: PAGE_MARGINS, paper: "us-letter")
set list(indent: 1.25em, marker: [•])
set text(font: (BODY_FONT), BODY_FONT_SIZE)
@ -151,6 +109,7 @@
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)
@ -158,8 +117,6 @@
line(length: 100% - HEADING_LINE_GAP - size.width, stroke: (paint: color, thickness: 2pt, cap: "round"))
})
// add line to right of heading
set block(above: 0.9em, below: 0.75em)
set text(size: 1em, fill: color, font: HEADING_FONT)
stack(
@ -174,6 +131,5 @@
)
}
doc
}