feat: Add escapeHTML function (#1303)

This commit is contained in:
Kroese
2026-07-18 22:00:45 +02:00
committed by GitHub
parent 949c288565
commit 81536818df
2 changed files with 14 additions and 1 deletions
+2 -1
View File
@@ -11,8 +11,9 @@ escape() {
s=${s//</\&lt;}
s=${s//>/\&gt;}
s=${s//'"'/\&quot;}
s=${s//"'"/\&#39;}
printf -- %s "$s"
printf '%s' "$s"
return 0
}
+12
View File
@@ -373,6 +373,18 @@ escape () {
return 0
}
escapeXML() {
printf '%s' "$1" | sed \
-e 's/&/\&amp;/g' \
-e 's/</\&lt;/g' \
-e 's/>/\&gt;/g' \
-e 's/"/\&quot;/g' \
-e "s/'/\&apos;/g"
return 0
}
html() {
local title