Improve recipe typst

This commit is contained in:
Joël von der Weid 2025-01-14 10:56:38 +01:00
parent 5a765e1112
commit 481c1d69d5

View File

@ -7,6 +7,7 @@
title: "",
subtitle: none,
persons: none,
quantity: none,
preptime: none,
cooktime: none,
waittime: none,
@ -38,30 +39,37 @@ align(center, {
let l = [#v(-0.25em)#line(length: 1.5em, angle: 90deg)]
let data = ()
if persons != none or persons != 0 {
if persons != none and persons != 0 {
data.push([#box([*#persons* pers], baseline: 3.5mm)])
data.push(l)
}
if preptime != none or preptime == "" {
if quantity != none and quantity != 0 {
data.push([#box([*#quantity* pièces], baseline: 3.5mm)])
data.push(l)
}
if preptime != none and preptime != "" {
data.push([#box(image.decode(knifesvg, format: "svg", height: 4.7mm), baseline: 1.2mm) *#preptime*])
data.push(l)
}
if cooktime != none or cooktime == "" {
if cooktime != none and cooktime != "" {
data.push([#box(image.decode(ovensvg, format: "svg", height: 4.4mm), baseline: 0.9mm) *#cooktime*])
data.push(l)
}
if waittime != none or waittime == "" {
if waittime != none and waittime != "" {
data.push([#box(image.decode(hourglasssvg, format: "svg", height: 4mm), baseline: 0.5mm) *#waittime*])
data.push(l)
}
let _ = data.pop()
if (data.len() > 0) {
let _ = data.pop() // remove last separator
grid(
columns: data.len(),
rows: 1,
gutter: 3.5mm,
..data
)
}
grid(
columns: data.len(),
rows: 1,
gutter: 3.5mm,
..data
)
})
v(0.5cm)