infoalloggi-monorepo/apps/infoalloggi/typst/utils.typ
Marco Pedone 8c48dbb4b6 feat: integrate Typst for PDF generation and add new fonts
- Added Typst templates for receipts and announcements.
- Implemented TypstRunner and TypstRunner2 services for PDF generation.
- Included necessary fonts for Typst rendering.
- Updated Dockerfile to install Typst and Pandoc.
- Enhanced API with new endpoints for Typst functionality.
- Added temporary directory handling for generated files.
- Updated .gitignore and .dockerignore to exclude temporary files.
2026-04-01 10:44:46 +02:00

15 lines
467 B
Typst

#import "@preview/oxifmt:1.0.0": strfmt
#let format-price(cents) = {
// Handle case where cents might be null or not a number
if cents == none { return "0,00 €" }
let euros = int(cents / 100)
let decimal = calc.rem(cents, 100)
// Create the decimal string and pad with a leading zero if needed (e.g., 5 cents -> "05")
let decimal-str = if decimal < 10 { "0" + str(decimal) } else { str(decimal) }
return str(euros) + "," + decimal-str + " €"
}