Remove manual XML entities escape in widgets

This commit is contained in:
Nguyễn Gia Phong 2018-10-22 00:20:01 +07:00
parent f1dd53edd2
commit 065bd1d009
6 changed files with 16 additions and 17 deletions

View File

@ -44,12 +44,10 @@ local function worker(format, warg)
for line in f:lines() do
for module, value in string.gmatch(line, "([%w]+) (.*)$") do
if module == "file" then
cmus_state["{"..module.."}"] = helpers.escape(value)
if module == "file" or module == "status" then
cmus_state["{"..module.."}"] = value
elseif module == "duration" then
cmus_state["{"..module.."}"] = tonumber(value)
elseif module == "status" then
cmus_state["{"..module.."}"] = value
else
for k, v in string.gmatch(value, "([%w]+) (.*)$") do
if module == "tag" then

View File

@ -41,7 +41,7 @@ local function worker(format, warg)
end
end
return {helpers.escape(np)}
return {np}
end
-- }}}

View File

@ -65,7 +65,7 @@ local function worker(format, warg)
end
-- Spam sanitize the subject and store
mail["{subject}"] = helpers.escape(title)
mail["{subject}"] = title
end
f:close()

View File

@ -46,7 +46,7 @@ local function worker(format, warg)
end
end
return {helpers.escape(subject)}
return {subject}
end
-- }}}

View File

@ -44,14 +44,15 @@ local function worker(format, warg)
for line in f:lines() do
for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do
if k == "volume" then mpd_state["{"..k.."}"] = v and tonumber(v)
elseif k == "state" then mpd_state["{"..k.."}"] = helpers.capitalize(v)
elseif k == "Artist" then mpd_state["{"..k.."}"] = helpers.escape(v)
elseif k == "Title" then mpd_state["{"..k.."}"] = helpers.escape(v)
elseif k == "Album" then mpd_state["{"..k.."}"] = helpers.escape(v)
elseif k == "Genre" then mpd_state["{"..k.."}"] = helpers.escape(v)
--elseif k == "Name" then mpd_state["{"..k.."}"] = helpers.escape(v)
--elseif k == "file" then mpd_state["{"..k.."}"] = helpers.escape(v)
local key = "{" .. k .. "}"
if k == "volume" then
mpd_state[key] = v and tonumber(v)
elseif k == "state" then
mpd_state[key] = helpers.capitalize(v)
elseif k == "Artist" or k == "Title" or
--k == "Name" or k == "file" or
k == "Album" or k == "Genre" then
mpd_state[key] = v
end
end
end

View File

@ -69,8 +69,8 @@ local function worker(format, warg)
-- Output differs from system to system, some stats can be
-- separated by =, and not all drivers report all stats
winfo["{ssid}"] = -- SSID can have almost anything in it
helpers.escape(string.match(iw, 'ESSID[=:]"(.-)"') or winfo["{ssid}"])
-- SSID can have almost anything in it
winfo["{ssid}"] = string.match(iw, 'ESSID[=:]"(.-)"') or winfo["{ssid}"]
winfo["{mode}"] = -- Modes are simple, but also match the "-" in Ad-Hoc
string.match(iw, "Mode[=:]([%w%-]*)") or winfo["{mode}"]
winfo["{chan}"] = -- Channels are plain digits