feat: add disable-smallcaps option

This commit is contained in:
Tim van der Heide
2025-02-24 20:45:31 +01:00
committed by GitHub
parent dab5adeb82
commit bf57a254b9

98
lib.typ
View File

@@ -70,22 +70,34 @@
] ]
} }
#let __coverletter_footer(author, language, date, lang_data) = { #let __coverletter_footer(author, language, date, lang_data, disable-smallcaps) = {
set text( set text(
fill: gray, fill: gray,
size: 8pt, size: 8pt,
) )
__justify_align_3[ __justify_align_3[
#smallcaps[#date] #if not disable-smallcaps [#smallcaps(date)] else [#date]
][ ][
#smallcaps[ #if not disable-smallcaps [
#if language == "zh" or language == "ja" [ #smallcaps(
#author.firstname#author.lastname {
] else [ let name = if language == "zh" or language == "ja" {
#author.firstname#sym.space#author.lastname str(author.firstname) + str(author.lastname)
] } else {
#sym.dot.c str(author.firstname) + " " + str(author.lastname)
#linguify("cover-letter", from: lang_data) }
name + " · " + linguify("cover-letter", from: lang_data)
}
)
] else [
{
let name = if language == "zh" or language == "ja" {
str(author.firstname) + str(author.lastname)
} else {
str(author.firstname) + " " + str(author.lastname)
}
name + " · " + linguify("cover-letter", from: lang_data)
}
] ]
][ ][
#context { #context {
@@ -94,22 +106,34 @@
] ]
} }
#let __resume_footer(author, language, lang_data, date) = { #let __resume_footer(author, language, lang_data, date, disable-smallcaps) = {
set text( set text(
fill: gray, fill: gray,
size: 8pt, size: 8pt,
) )
__justify_align_3[ __justify_align_3[
#smallcaps[#date] #if not disable-smallcaps [#smallcaps(date)] else [#date]
][ ][
#smallcaps[ #if not disable-smallcaps [
#if language == "zh" or language == "ja" [ #smallcaps(
#author.firstname#author.lastname {
] else [ let name = if language == "zh" or language == "ja" {
#author.firstname#sym.space#author.lastname str(author.firstname) + str(author.lastname)
] } else {
#sym.dot.c str(author.firstname) + " " + str(author.lastname)
#linguify("resume", from: lang_data) }
name + " · " + linguify("resume", from: lang_data)
}
)
] else [
{
let name = if language == "zh" or language == "ja" {
str(author.firstname) + str(author.lastname)
} else {
str(author.firstname) + " " + str(author.lastname)
}
name + " · " + linguify("resume", from: lang_data)
}
] ]
][ ][
#context { #context {
@@ -195,6 +219,7 @@
/// - accent-color (color): The accent color of the resume /// - accent-color (color): The accent color of the resume
/// - colored-headers (boolean): Whether the headers should be colored or not /// - colored-headers (boolean): Whether the headers should be colored or not
/// - language (string): The language of the resume, defaults to "en". See lang.toml for available languages /// - language (string): The language of the resume, defaults to "en". See lang.toml for available languages
/// - disable-smallcaps (boolean): Whether to disable small caps formatting throughout the template
/// - body (content): The body of the resume /// - body (content): The body of the resume
/// -> none /// -> none
#let resume( #let resume(
@@ -208,6 +233,7 @@
font: ("Source Sans Pro", "Source Sans 3"), font: ("Source Sans Pro", "Source Sans 3"),
header-font: ("Roboto"), header-font: ("Roboto"),
paper-size: "a4", paper-size: "a4",
disable-smallcaps: false,
body, body,
) = { ) = {
if type(accent-color) == "string" { if type(accent-color) == "string" {
@@ -240,6 +266,7 @@
language, language,
lang_data, lang_data,
date, date,
disable-smallcaps,
)] else [], )] else [],
footer-descent: 0pt, footer-descent: 0pt,
) )
@@ -286,7 +313,11 @@
size: 10pt, size: 10pt,
weight: "regular", weight: "regular",
) )
smallcaps[#it.body] if not disable-smallcaps [
#smallcaps(it.body)
] else [
#it.body
]
} }
let name = { let name = {
@@ -319,7 +350,13 @@
weight: "regular", weight: "regular",
) )
align(center)[ align(center)[
#smallcaps[ #if not disable-smallcaps [
#smallcaps(
author.positions.join(
text[#" "#sym.dot.c#" "],
)
)
] else [
#author.positions.join( #author.positions.join(
text[#" "#sym.dot.c#" "], text[#" "#sym.dot.c#" "],
) )
@@ -576,6 +613,7 @@
/// - font (array): The font families of the cover letter /// - font (array): The font families of the cover letter
/// - show-footer (boolean): Whether to show the footer or not /// - show-footer (boolean): Whether to show the footer or not
/// - closing (content): The closing of the cover letter. This defaults to "Attached Curriculum Vitae". You can set this to `none` to show the default closing or remove it completely. /// - closing (content): The closing of the cover letter. This defaults to "Attached Curriculum Vitae". You can set this to `none` to show the default closing or remove it completely.
/// - disable-smallcaps (boolean): Whether to disable small caps formatting throughout the template
/// - body (content): The body of the cover letter /// - body (content): The body of the cover letter
#let coverletter( #let coverletter(
author: (:), author: (:),
@@ -587,6 +625,7 @@
show-footer: true, show-footer: true,
closing: none, closing: none,
paper-size: "a4", paper-size: "a4",
disable-smallcaps: false,
body, body,
) = { ) = {
if type(accent-color) == "string" { if type(accent-color) == "string" {
@@ -624,6 +663,7 @@
language, language,
date, date,
lang_data, lang_data,
disable-smallcaps,
)] else [], )] else [],
footer-descent: 0pt, footer-descent: 0pt,
) )
@@ -686,7 +726,13 @@
weight: "regular", weight: "regular",
) )
align(right)[ align(right)[
#smallcaps[ #if not disable-smallcaps [
#smallcaps(
author.positions.join(
text[#" "#sym.dot.c#" "],
)
)
] else [
#author.positions.join( #author.positions.join(
text[#" "#sym.dot.c#" "], text[#" "#sym.dot.c#" "],
) )
@@ -823,7 +869,11 @@
#pad(top: 0.65em, bottom: 0.65em)[ #pad(top: 0.65em, bottom: 0.65em)[
#text(weight: "regular", fill: color-gray, size: 9pt)[ #text(weight: "regular", fill: color-gray, size: 9pt)[
#smallcaps[#entity-info.name] \ #if not disable-smallcaps [
#smallcaps(entity-info.name)
] else [
#entity-info.name
] \
#entity-info.street-address \ #entity-info.street-address \
#entity-info.city \ #entity-info.city \
] ]