Просмотр исходного кода

Merge pull request #1395 from wunter8/template-dir

doc corrections
Philipp C. Heckel 7 месяцев назад
Родитель
Сommit
0847a6406e
2 измененных файлов с 26 добавлено и 2 удалено
  1. 3 2
      docs/publish.md
  2. 23 0
      docs/publish/template-functions.md

+ 3 - 2
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.

+ 23 - 0
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