This commit is contained in:
wunter8 2025-07-20 03:51:49 +00:00 committed by GitHub
commit b20dbc8a0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 2 deletions

View file

@ -954,8 +954,8 @@ is valid JSON).
You can enable templating by setting the `X-Template` header (or its aliases `Template` or `tpl`, or the query parameter `?template=...`):
* **Pre-defined template files**: Setting the `X-Template` header or query parameter to a template name (e.g. `?template=github`)
to a pre-defined template name (e.g. `github`, `grafana`, or `alertmanager`) will use the template with that name.
* **Pre-defined template files**: Setting the `X-Template` header or query parameter to a pre-defined template name (one of `github`,
`grafana`, or `alertmanager`, such as `?template=github`) will use the built-in template with that name.
See [pre-defined templates](#pre-defined-templates) for more details.
* **Custom template files**: Setting the `X-Template` header or query parameter to a custom template name (e.g. `?template=myapp`)
will use a custom template file from the template directory (defaults to `/etc/ntfy/templates`, can be overridden with `template-dir`).
@ -1244,6 +1244,7 @@ Below are the functions that are available to use inside your message/title temp
* [String List Functions](publish/template-functions.md#string-list-functions): `splitList`, `sortAlpha`, etc.
* [Integer Math Functions](publish/template-functions.md#integer-math-functions): `add`, `max`, `mul`, etc.
* [Integer List Functions](publish/template-functions.md#integer-list-functions): `until`, `untilStep`
* [Float Math Functions](publish/template-functions.md#float-math-functions): `maxf`, `minf`
* [Date Functions](publish/template-functions.md#date-functions): `now`, `date`, etc.
* [Defaults Functions](publish/template-functions.md#default-functions): `default`, `empty`, `coalesce`, `fromJSON`, `toJSON`, `toPrettyJSON`, `toRawJSON`, `ternary`
* [Encoding Functions](publish/template-functions.md#encoding-functions): `b64enc`, `b64dec`, etc.

View file

@ -10,6 +10,7 @@ The original set of template functions is based on the [Sprig library](https://m
- [String List Functions](#string-list-functions)
- [Integer Math Functions](#integer-math-functions)
- [Integer List Functions](#integer-list-functions)
- [Float Math Functions](#float-math-functions)
- [Date Functions](#date-functions)
- [Default Functions](#default-functions)
- [Encoding Functions](#encoding-functions)
@ -526,6 +527,28 @@ seq 0 2 10 => 0 2 4 6 8 10
seq 0 -2 -5 => 0 -2 -4
```
## Float Math Functions
### maxf
Return the largest of a series of floats:
This will return `3`:
```
maxf 1 2.5 3
```
### minf
Return the smallest of a series of floats.
This will return `1.5`:
```
minf 1.5 2 3
```
## Date Functions
### now