- 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.
15 lines
467 B
Typst
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 + " €"
|
|
}
|