fix(cmus): HTML formatting error on notification when text contains &
This commit is contained in:
parent
31d15e6416
commit
63581953db
1 changed files with 50 additions and 50 deletions
|
@ -13,9 +13,9 @@ process_args() {
|
||||||
escape() {
|
escape() {
|
||||||
local string
|
local string
|
||||||
string=$1
|
string=$1
|
||||||
|
string=${string//"&"/"&"}
|
||||||
string=${string//"<"/"<"}
|
string=${string//"<"/"<"}
|
||||||
string=${string//">"/">"}
|
string=${string//">"/">"}
|
||||||
string=${string//"&"/"&"}
|
|
||||||
printf "%s" "$string"
|
printf "%s" "$string"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ main() {
|
||||||
if [[ ${#title} -gt 25 ]]; then
|
if [[ ${#title} -gt 25 ]]; then
|
||||||
title="${title:0:24}…"
|
title="${title:0:24}…"
|
||||||
fi
|
fi
|
||||||
title="<b>$title</b>"
|
title="<b>$(escape "$title")</b>"
|
||||||
|
|
||||||
if [ -n "$artist" ]; then
|
if [ -n "$artist" ]; then
|
||||||
if [[ ${#artist} -gt 22 ]]; then
|
if [[ ${#artist} -gt 22 ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue