Merge pull request #2317 from dcooper16/fix_html

Fix HTML output in Bash 5.2 and newer
This commit is contained in:
Dirk Wetter 2023-02-04 09:22:03 +01:00 committed by GitHub
commit 05b4cdcc0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -535,11 +535,11 @@ html_reserved(){
local output
"$do_html" || return 0
#sed -e 's/\&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' -e 's/"/\&quot;/g' -e "s/'/\&apos;/g" <<< "$1"
output="${1//&/&amp;}"
output="${output//</&lt;}"
output="${output//>/&gt;}"
output="${output//\"/&quot;}"
output="${output//\'/&apos;}"
output="${1//&/$'&'amp;}"
output="${output//</$'&'lt;}"
output="${output//>/$'&'gt;}"
output="${output//\"/$'&'quot;}"
output="${output//\'/$'&'apos;}"
printf -- "%s" "$output"
return 0
}