@@ -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=...`):
|
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`)
|
* **Pre-defined template files**: Setting the `X-Template` header or query parameter to a pre-defined template name (one of `github`,
|
||||||
to a pre-defined template name (e.g. `github`, `grafana`, or `alertmanager`) will use the template with that name.
|
`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.
|
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`)
|
* **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`).
|
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.
|
* [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 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`
|
* [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.
|
* [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`
|
* [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.
|
* [Encoding Functions](publish/template-functions.md#encoding-functions): `b64enc`, `b64dec`, etc.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ The original set of template functions is based on the [Sprig library](https://m
|
|||||||
- [String List Functions](#string-list-functions)
|
- [String List Functions](#string-list-functions)
|
||||||
- [Integer Math Functions](#integer-math-functions)
|
- [Integer Math Functions](#integer-math-functions)
|
||||||
- [Integer List Functions](#integer-list-functions)
|
- [Integer List Functions](#integer-list-functions)
|
||||||
|
- [Float Math Functions](#float-math-functions)
|
||||||
- [Date Functions](#date-functions)
|
- [Date Functions](#date-functions)
|
||||||
- [Default Functions](#default-functions)
|
- [Default Functions](#default-functions)
|
||||||
- [Encoding Functions](#encoding-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
|
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
|
## Date Functions
|
||||||
|
|
||||||
### now
|
### now
|
||||||
|
|||||||
Reference in New Issue
Block a user