diff options
author | Bence Ferdinandy <bence@ferdinandy.com> | 2024-07-10 22:26:22 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-03 17:41:15 +0200 |
commit | 9d8d74d9bf438c337ac0d6eed1b5dede5cc0ceb2 (patch) | |
tree | be09268e158dfbe03bf20fa0582f4ddf704e95ac /doc | |
parent | f8b74a9a9f1b607e20f7b5654e85b03be34ce0ed (diff) | |
download | aerc-9d8d74d9bf438c337ac0d6eed1b5dede5cc0ceb2.tar.gz |
templates: add head and tail functions
Add head and tail functions to get beginning or ends of strings.
E.g.:
{{"hello" | head 2}} will return "he"
{{"hello" | tail 2}} will return "lo"
Implements: https://todo.sr.ht/~rjarry/aerc/220
Changelog-added: New `head` and `tail` templates functions for strings.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/aerc-templates.7.scd | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd index b5681030..2c773bef 100644 --- a/doc/aerc-templates.7.scd +++ b/doc/aerc-templates.7.scd @@ -490,6 +490,20 @@ aerc provides the following additional functions: {{replace `(.+) - .+ at .+\..+` `$1` ((index .OriginalFrom 0).Name)}} ``` +*head* + Return first n characters from string. + + ``` + {{"hello" | head 2}} + ``` + +*tail* + Return last n characters from string. + + ``` + {{"hello" | tail 2}} + ``` + *.Style* Apply a user-defined style (see *aerc-stylesets*(7)) to a string. |