added function unescape
This commit is contained in:
parent
69737edfd5
commit
f3571e2091
@ -527,6 +527,17 @@ function load_from_file(file, default_data)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function unescape(str)
|
||||||
|
str = string.gsub( str, '<', '<' )
|
||||||
|
str = string.gsub( str, '>', '>' )
|
||||||
|
str = string.gsub( str, '"', '"' )
|
||||||
|
str = string.gsub( str, ''', "'" )
|
||||||
|
str = string.gsub( str, '&#(%d+);', function(n) return string.char(n) end )
|
||||||
|
str = string.gsub( str, '&#x(%d+);', function(n) return string.char(tonumber(n,16)) end )
|
||||||
|
str = string.gsub( str, '&', '&' ) -- Be sure to do this after all others
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
-- See http://stackoverflow.com/a/14899740
|
-- See http://stackoverflow.com/a/14899740
|
||||||
function unescape_html(str)
|
function unescape_html(str)
|
||||||
local map = {
|
local map = {
|
||||||
|
@ -34,7 +34,6 @@ function run(msg, matches)
|
|||||||
|
|
||||||
local header = "Tweet von " .. response.user.name .. " (@" .. response.user.screen_name .. ")\n"
|
local header = "Tweet von " .. response.user.name .. " (@" .. response.user.screen_name .. ")\n"
|
||||||
local text = response.text
|
local text = response.text
|
||||||
text = string.gsub(text, "&", "&")
|
|
||||||
|
|
||||||
-- replace short URLs
|
-- replace short URLs
|
||||||
if response.entities.url then
|
if response.entities.url then
|
||||||
@ -58,6 +57,7 @@ function run(msg, matches)
|
|||||||
|
|
||||||
-- send the parts
|
-- send the parts
|
||||||
local receiver = get_receiver(msg)
|
local receiver = get_receiver(msg)
|
||||||
|
local text = unescape(text)
|
||||||
send_msg(receiver, header .. "\n" .. text, ok_cb, false)
|
send_msg(receiver, header .. "\n" .. text, ok_cb, false)
|
||||||
for k, v in pairs(images) do
|
for k, v in pairs(images) do
|
||||||
local file = download_to_file(v)
|
local file = download_to_file(v)
|
||||||
|
Reference in New Issue
Block a user