Reference

Formatters

The 12 formatters and the 5 totals of Brevier, each with an input, an output and the rule it follows.

On this page

Community

A formatter changes how a value prints. Write it after a pipe: {{ amount | money }}. Formatters run from left to right.

  • money, date, number, int and the DIN 5008 formatters return display text. A second one of them after the first fails, because the text is no longer a number: {{ x | money | number }}.
  • uppercase reads any text, so it can follow any formatter: {{ day | date | uppercase }}.
  • A total comes first.
  • A value that does not fit the formatter fails. The error names the value and the template line.

brevier pdf, brevier html and brevier serve read a JSON number such as 1234.5 exactly. money, number, eur and the totals reject a Python float.

The Python Builder method with_json and brevier preview read 1234.5 as a float. There, and in Python code, write the number as text ("1234.5"), or pass an int or a Decimal.

iban, bic, blz, postfach, time and phone need text. A JSON number fails.

The spaces inside the outputs below are no-break spaces, so a value never wraps inside.

Formatters

Formatter Input Output Does
money "1234.5" 1.234,50 € German amount with 2 decimals, rounded half up.
date "2026-10-25" 25.10.2026 ISO 8601 date or date-time as DD.MM.YYYY.
number "1234567" 1 234 567 Groups of three digits, as DIN 5008 writes numbers. A number with 4 digits before the comma is not grouped. Decimals are kept.
int "1500" 1500 The same as number. It does not cut decimals.
uppercase "Müller" MÜLLER Capital letters. ß becomes SS.
iban "de89370400440532013000" DE89 3704 0044 0532 0130 00 Groups of four. It checks the shape, not the check digits.
bic "erfbde8e759" ERFBDE8E759 Capitals, 8 or 11 characters.
blz "37040044" 370 400 44 A German bank code of 8 digits, in groups of 3, 3 and 2.
postfach "123456" 12 34 56 A P.O. box number in groups of two, counted from the right.
time "14:05" 14:05 Uhr A time with Uhr. Seconds are kept only when they are not zero: 14:05:30 Uhr.
eur "1234.5" 1.234,50 EUR An amount with the letters EUR and no euro sign.
phone "05444/347687-350" 05444 347687-350 A phone number as DIN 5008 writes it. A hyphen before the last group is the extension. The area code must be set off by a separator, except in a mobile number or a 0180 or 0900 number.

Totals

A total reads a list and prints one number. It must be the first formatter of its tag. {{ rows.price | sum }} reads the price of every row of rows.

A total returns a number, so money, number, int or eur can follow it: {{ rows.price | sum | money }}. See ADR-038.

Total Input Output Does
count ["a", "b", "c"] 3 The number of items. It takes any list.
sum ["10", "2.5", "3"] 15.5 The sum. An empty list gives 0.
avg ["10", "2.5", "3"] 5.2 The average, rounded half up. An empty list prints nothing.
min ["10", "2.5", "3"] 2.5 The lowest number. An empty list prints nothing.
max ["10", "2.5", "3"] 10 The highest number. An empty list prints nothing.