From f8856ae7423d2b969b02094cc002e75388ee6374 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 26 Apr 2024 08:24:06 +0200 Subject: 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! --- mod/notification-telegram.rsc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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={ -- cgit v1.2.3-70-g09d2