183 lines
3.5 KiB
Typst
183 lines
3.5 KiB
Typst
|
#let crude(
|
|||
|
title: if sys.inputs.keys().contains("title") {
|
|||
|
sys.inputs.title
|
|||
|
} else {
|
|||
|
none
|
|||
|
},
|
|||
|
author: if sys.inputs.keys().contains("author") {
|
|||
|
sys.inputs.author
|
|||
|
} else {
|
|||
|
none
|
|||
|
},
|
|||
|
sigil: if sys.inputs.keys().contains("sigil") {
|
|||
|
sys.inputs.sigil
|
|||
|
} else {
|
|||
|
"sigil.svg"
|
|||
|
},
|
|||
|
font: (
|
|||
|
text: {
|
|||
|
if sys.inputs.keys().contains("font") {
|
|||
|
let argFont = sys.inputs.font
|
|||
|
if argFont == "mono" {
|
|||
|
"Fira Mono"
|
|||
|
} else if argFont == "sans" {
|
|||
|
"Fira Sans"
|
|||
|
} else if argFont == "orb" {
|
|||
|
"Orbitron"
|
|||
|
} else {
|
|||
|
argFont
|
|||
|
}
|
|||
|
} else {
|
|||
|
"Fira Sans"
|
|||
|
}
|
|||
|
},
|
|||
|
decoration: {
|
|||
|
if sys.inputs.keys().contains("decoFont") {
|
|||
|
let argFont = sys.inputs.decoFont
|
|||
|
if argFont == "mono" {
|
|||
|
"Fira Mono"
|
|||
|
} else if argFont == "sans" {
|
|||
|
"Fira Sans"
|
|||
|
} else if argFont == "orb" {
|
|||
|
"Orbitron"
|
|||
|
} else {
|
|||
|
argFont
|
|||
|
}
|
|||
|
} else {
|
|||
|
"Orbitron"
|
|||
|
}
|
|||
|
}
|
|||
|
),
|
|||
|
colors: if sys.inputs.keys().contains("colorScheme") {
|
|||
|
let cs = sys.inputs.colorScheme
|
|||
|
if cs == "light" {
|
|||
|
(
|
|||
|
background: "ccccce",
|
|||
|
foreground: "0d0d1b",
|
|||
|
)
|
|||
|
} else if cs == "pink" {
|
|||
|
(
|
|||
|
background: "0d0d1b",
|
|||
|
foreground: "E60073"
|
|||
|
)
|
|||
|
} else {
|
|||
|
(
|
|||
|
background: "0d0d1b",
|
|||
|
foreground: "ccccce",
|
|||
|
)
|
|||
|
}
|
|||
|
} else {
|
|||
|
(
|
|||
|
background: "0d0d1b",
|
|||
|
foreground: "ccccce",
|
|||
|
)
|
|||
|
},
|
|||
|
nixPath: if sys.inputs.keys().contains("nixPath") {
|
|||
|
sys.inputs.nixPath
|
|||
|
} else {
|
|||
|
"cd389898-51c9-53ee-8d27-4885055eed67"
|
|||
|
},
|
|||
|
titleHash: if sys.inputs.keys().contains("titleHash") {
|
|||
|
sys.inputs.titleHash
|
|||
|
} else {
|
|||
|
"ad3ebf6b-7c3a-5986-a46e-89777e5c2554"
|
|||
|
},
|
|||
|
doc,
|
|||
|
) = {
|
|||
|
counter(page).update(0)
|
|||
|
|
|||
|
set document(
|
|||
|
title: title,
|
|||
|
author: author
|
|||
|
)
|
|||
|
|
|||
|
show heading: head => {
|
|||
|
set text(font: font.decoration, 1.2em)
|
|||
|
head
|
|||
|
v(0.8em)
|
|||
|
}
|
|||
|
|
|||
|
show quote: q => {
|
|||
|
set text(font: font.decoration)
|
|||
|
q
|
|||
|
}
|
|||
|
|
|||
|
set quote(
|
|||
|
block: true,
|
|||
|
quotes: true
|
|||
|
)
|
|||
|
|
|||
|
set page(
|
|||
|
numbering: "I",
|
|||
|
paper: "a4",
|
|||
|
fill: color.rgb(colors.background),
|
|||
|
header: context {
|
|||
|
if counter(page).get().first() > 0 [
|
|||
|
#set text(font: font.decoration)
|
|||
|
_#nixPath _
|
|||
|
#h(1fr)
|
|||
|
*#document.author.join()*
|
|||
|
]
|
|||
|
},
|
|||
|
footer: context {
|
|||
|
if counter(page).get().first() > 0 [
|
|||
|
#set text(font: font.decoration)
|
|||
|
*#(document.title, titleHash).join(" – ")*
|
|||
|
#h(1fr)
|
|||
|
#counter(page).display("I")
|
|||
|
]
|
|||
|
}
|
|||
|
)
|
|||
|
|
|||
|
set par(
|
|||
|
justify: true
|
|||
|
)
|
|||
|
|
|||
|
set text(
|
|||
|
fill: color.rgb(colors.foreground),
|
|||
|
font: (font.text, font.decoration),
|
|||
|
lang: "en"
|
|||
|
)
|
|||
|
|
|||
|
|
|||
|
figure(
|
|||
|
image(sigil, width: 100%),
|
|||
|
)
|
|||
|
|
|||
|
align(center)[
|
|||
|
#set text(font: font.decoration, 36pt, weight: "black")
|
|||
|
#context { document.title }
|
|||
|
]
|
|||
|
|
|||
|
align(center)[
|
|||
|
#set text(font: font.decoration, 24pt)
|
|||
|
#context { document.author.join() }
|
|||
|
]
|
|||
|
|
|||
|
let prependHash(color) = {
|
|||
|
if color.first() != "#" {
|
|||
|
upper("#" + color)
|
|||
|
} else {
|
|||
|
upper(color)
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
v(1fr)
|
|||
|
|
|||
|
context {
|
|||
|
set text(font: font.decoration, 13pt)
|
|||
|
align(right, (
|
|||
|
colors.values().map(x => prependHash(x)),
|
|||
|
{ if font.text != font.decoration {
|
|||
|
(font.text, font.decoration).zip(("Text", "Decoration")).map(x => x.join(" - "))
|
|||
|
} else {
|
|||
|
font.text
|
|||
|
} },
|
|||
|
).flatten().map(x => [#x]).join("\n") )
|
|||
|
}
|
|||
|
|
|||
|
pagebreak()
|
|||
|
|
|||
|
doc
|
|||
|
}
|