From f4a74dac57d0a55e1ae28660cfac3997c20500db Mon Sep 17 00:00:00 2001 From: Hunter Kehoe Date: Sat, 19 Jul 2025 21:51:00 -0600 Subject: [PATCH] doc corrections --- docs/publish.md | 5 +++-- docs/publish/template-functions.md | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/publish.md b/docs/publish.md index dc124dbc..2d347f22 100644 --- a/docs/publish.md +++ b/docs/publish.md @@ -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. diff --git a/docs/publish/template-functions.md b/docs/publish/template-functions.md index f20ae1fd..a08e4717 100644 --- a/docs/publish/template-functions.md +++ b/docs/publish/template-functions.md @@ -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