mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-03 06:34:27 +02:00
mod/notification-matrix: fix double escaping
That was introduced with 2a232ad2f5
when
switching to :serialize...
This commit is contained in:
parent
8c1543a402
commit
3a36db6de8
1 changed files with 11 additions and 17 deletions
|
@ -86,21 +86,15 @@
|
|||
}
|
||||
|
||||
:local Return "";
|
||||
:local Chars {
|
||||
"plain"={ "\\"; "\""; "\n" };
|
||||
"format"={ "\\"; "\""; "\n"; "&"; "<"; ">" };
|
||||
}
|
||||
:local Subs {
|
||||
"plain"={ "\\\\"; "\\\""; "\\n" };
|
||||
"format"={ "\\\\"; """; "<br/>"; "&"; "<"; ">" };
|
||||
}
|
||||
:local Chars { "\""; "\n"; "&"; "<"; ">" };
|
||||
:local Subs { """; "<br/>"; "&"; "<"; ">" };
|
||||
|
||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||
:local Char [ :pick $Input $I ];
|
||||
:local Replace [ :find ($Chars->$2) $Char ];
|
||||
:local Replace [ :find $Chars $Char ];
|
||||
|
||||
:if ([ :typeof $Replace ] = "num") do={
|
||||
:set Char ($Subs->$2->$Replace);
|
||||
:set Char ($Subs->$Replace);
|
||||
}
|
||||
:set Return ($Return . $Char);
|
||||
}
|
||||
|
@ -117,17 +111,17 @@
|
|||
}
|
||||
|
||||
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ] });
|
||||
:local Plain [ $PrepareText ("## [" . $IdentityExtra . $Identity . "] " . \
|
||||
($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```") "plain" ];
|
||||
:local Plain ("## [" . $IdentityExtra . $Identity . "] " . \
|
||||
($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```");
|
||||
:local Formatted ("<h2>" . [ $PrepareText ("[" . $IdentityExtra . $Identity . "] " . \
|
||||
($Notification->"subject")) "format" ] . "</h2>" . "<pre><code>" . \
|
||||
[ $PrepareText ($Notification->"message") "format" ] . "</code></pre>");
|
||||
($Notification->"subject")) ] . "</h2>" . "<pre><code>" . \
|
||||
[ $PrepareText ($Notification->"message") ] . "</code></pre>");
|
||||
:if ([ :len ($Notification->"link") ] > 0) do={
|
||||
:set Plain ($Plain . "\\n" . [ $SymbolForNotification "link" ] . \
|
||||
[ $PrepareText ("[" . $Notification->"link" . "](" . $Notification->"link" . ")") "plain" ]);
|
||||
"[" . $Notification->"link" . "](" . $Notification->"link" . ")");
|
||||
:set Formatted ($Formatted . "<br/>" . [ $SymbolForNotification "link" ] . \
|
||||
"<a href=\\\"" . [ $PrepareText ($Notification->"link") "format" ] . "\\\">" . \
|
||||
[ $PrepareText ($Notification->"link") "format" ] . "</a>");
|
||||
"<a href=\"" . [ $PrepareText ($Notification->"link") ] . "\">" . \
|
||||
[ $PrepareText ($Notification->"link") ] . "</a>");
|
||||
}
|
||||
|
||||
:do {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue