Skip to content

Commit

Permalink
fix: refactor cover letter functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mintyfrankie committed Jul 12, 2024
1 parent f509404 commit 7c4719f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 13 deletions.
12 changes: 11 additions & 1 deletion brilliant-CV/letters.typ → brilliant-CV/letter.typ
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@
place(right, dx: -5%, dy: 0%, image(path, width: 25%))
}

#let letterFooter() = {
#let letterFooter(metadata) = {
// Parameters
let firstName = metadata.personal.first_name
let lastName = metadata.personal.last_name
let footerText = metadata.lang.at(metadata.language).letter_footer

// Styles
let footerStyle(str) = {
text(size: 8pt, fill: rgb("#999999"), smallcaps(str))
}

place(
bottom,
table(
Expand Down
50 changes: 50 additions & 0 deletions brilliant-CV/template.typ
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Packages */
#import "./cv.typ": *
#import "./letter.typ": *
#import "./utils/lang.typ": *

/* Layout */
Expand Down Expand Up @@ -41,4 +42,53 @@
}
doc
cvFooter(metadata)
}

#let letter(
metadata_path: "../metadata.toml",
myAddress: "Your Address Here",
recipientName: "Company Name Here",
recipientAddress: "Company Address Here",
date: datetime.today().display(),
subject: "Subject: Hey!",
signaturePath: "",
doc,
) = {

// Load metadata
let metadata = toml(metadata_path)

// Non Latin Logic
let lang = metadata.language
let fontList = latinFontList
if isNonLatin(lang) {
let nonLatinFont = metadata.lang.non_latin.font
fontList.insert(2, nonLatinFont)
}

// Page layout
set text(font: fontList, weight: "regular", size: 9pt)
set align(left)
set page(
paper: "a4",
margin: (left: 1.4cm, right: 1.4cm, top: .8cm, bottom: .4cm),
)
set text(size: 12pt)

letterHeader(
myAddress: myAddress,
recipientName: recipientName,
recipientAddress: recipientAddress,
date: date,
subject: subject,
metadata: metadata,
awesomeColors: awesomeColors,
)

doc
if signaturePath != "" {
letterSignature(signaturePath)
}
letterFooter(metadata)

}
20 changes: 9 additions & 11 deletions letter.typ
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#import "brilliant-CV/template.typ": *
#show: layout
#set text(size: 12pt) //set global font size

#letterHeader(
myAddress: [1 Rue Gonnet \ 75003 Paris, France],
recipientName: [ABC Company],
recipientAddress: [15 Boulevard Roi \ 75011 Paris, France],
date: [05/05/2023],
subject: "Subject: Job Application for Senior Data Analyst",
#show: letter.with(
metadata_path: "../metadata.toml",
myAddress: "Your Address Here",
recipientName: "Company Name Here",
recipientAddress: "Company Address Here",
date: datetime.today().display(),
subject: "Subject: Hey!",
signaturePath: "../src/signature.png",
)

Dear Hiring Manager,
Expand All @@ -28,6 +27,5 @@ Thank you for considering my application. I look forward to the opportunity to d

Sincerely,

#letterSignature("/src/signature.png")
#letterFooter()


2 changes: 1 addition & 1 deletion metadata.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language = "zh"
language = "en"

[layout]
awesome_color = "skyblue"
Expand Down

0 comments on commit 7c4719f

Please sign in to comment.