diff options
author | Moritz Poldrack <git@moritz.sh> | 2024-01-18 23:33:30 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-01-19 23:31:52 +0100 |
commit | 2d9d7e0bed87d11771a7264c08c02d110eef6751 (patch) | |
tree | f8aa544d86b1f3fae675e79f318db5556d1ddfba /doc/aerc-templates.7.scd | |
parent | 978b5e444215255a9671ce439f1594888697f799 (diff) | |
download | aerc-2d9d7e0bed87d11771a7264c08c02d110eef6751.tar.gz |
templates: add basic string functions
Some clients are sending a text/plain part that contains nothing but the
text/html part. This is rather suboptimal when replying. To be able to
filter these, it is important to be able to detect things like
<!doctype html>.
Add basic string operations to the template functions.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Tested-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'doc/aerc-templates.7.scd')
-rw-r--r-- | doc/aerc-templates.7.scd | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/aerc-templates.7.scd b/doc/aerc-templates.7.scd index 06b34781..160fb77f 100644 --- a/doc/aerc-templates.7.scd +++ b/doc/aerc-templates.7.scd @@ -440,6 +440,41 @@ aerc provides the following additional functions: {{compactDir .Folder}} ``` +*contains* + Checks if a string contains a substring. + + ``` + {{contains "<!DOCTYPE html>" .OriginalText}} + ``` + +*hasPrefix* + Checks if a string has a prefix. + + ``` + {{hasPrefix "Business" .Folder}} + ``` + +*toLower* + Convert a string to lowercase. + + ``` + {{toLower "SPECIAL OFFER!"}} + ``` + +*toUpper* + Convert a string to uppercase. + + ``` + {{toUpper "important"}} + ``` + +*replace* + Perform a regular expression substitution on the passed string. + + ``` + {{replace `(.+) - .+ at .+\..+` `$1` ((index .OriginalFrom 0).Name)}} + ``` + *.Style* Apply a user-defined style (see *aerc-stylesets*(7)) to a string. |