diff options
author | Christian Hesse <mail@eworm.de> | 2024-04-26 08:24:06 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2024-04-29 23:02:48 +0200 |
commit | f8856ae7423d2b969b02094cc002e75388ee6374 (patch) | |
tree | d0c28a2c0e991c0f6108a84a4f3a3fe0b36d0509 | |
parent | 4b6cd7ba2911b44f8d0890c19c5342ce28a6b3a8 (diff) |
mod/notification-telegram: support excluding characters from escaping...
... to support formatting in plain text.
Handle with care, this can break the request if done wrong!
-rw-r--r-- | mod/notification-telegram.rsc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mod/notification-telegram.rsc b/mod/notification-telegram.rsc index efde85a..858ab1b 100644 --- a/mod/notification-telegram.rsc +++ b/mod/notification-telegram.rsc @@ -83,6 +83,7 @@ :local EscapeMD do={ :local Text [ :tostr $1 ]; :local Mode [ :tostr $2 ]; + :local Excl [ :tostr $3 ]; :global CharacterReplace; :global IfThenElse; @@ -93,7 +94,9 @@ "#"; "+"; "-"; "="; "|"; "{"; "}"; "."; "!" }; } :foreach Char in=($Chars->$Mode) do={ - :set Text [ $CharacterReplace $Text $Char ("\\" . $Char) ]; + :if ([ :typeof [ :find $Excl $Char ] ] = "nil") do={ + :set Text [ $CharacterReplace $Text $Char ("\\" . $Char) ]; + } } :if ($Mode = "body") do={ |