encoding() -> unescape()

This commit is contained in:
Andreas Bielawski 2016-08-16 13:05:26 +02:00
parent 0e830fefda
commit 33080bc388
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
-- See http://www.ascii.cl/htmlcodes.htm -- See http://www.ascii.cl/htmlcodes.htm
-- str = string.gsub(str, '', '') -- str = string.gsub(str, '', '')
function encoding(str) function unescape(str)
-- Symbols -- Symbols
str = string.gsub(str, ' ', ' ') -- space str = string.gsub(str, ' ', ' ') -- space
str = string.gsub(str, '!', '!') -- exclamation point str = string.gsub(str, '!', '!') -- exclamation point

View File

@ -310,23 +310,23 @@ function rss:cron(self_plz)
local subscribers = {} local subscribers = {}
local text = '' -- Send one message per feed with the latest entries local text = '' -- Send one message per feed with the latest entries
for k2, v2 in pairs(newentr) do for k2, v2 in pairs(newentr) do
local title = encoding(v2.title) or 'Kein Titel' local title = unescape(v2.title) or 'Kein Titel'
local link = v2.link or v2.id or 'Kein Link' local link = v2.link or v2.id or 'Kein Link'
if v2.content then if v2.content then
content = v2.content:gsub("%b<>", "") content = v2.content:gsub("%b<>", "")
if string.len(v2.content) > 300 then if string.len(v2.content) > 300 then
content = encoding(content) content = unescape(content)
content = string.sub(content, 1, 300)..'...' content = string.sub(content, 1, 300)..'...'
else else
content = encoding(content) content = unescape(content)
end end
elseif v2.summary then elseif v2.summary then
content = v2.summary:gsub("%b<>", "") content = v2.summary:gsub("%b<>", "")
if string.len(v2.summary) > 300 then if string.len(v2.summary) > 300 then
content = encoding(content) content = unescape(content)
content = string.sub(content, 1, 300)..'...' content = string.sub(content, 1, 300)..'...'
else else
content = encoding(content) content = unescape(content)
end end
else else
content = '' content = ''

View File

@ -29,8 +29,8 @@ function wordpress_recent_post:get_full_url(blog, tag)
local data = json.decode(res).posts[1] local data = json.decode(res).posts[1]
if not data then return 'NOTFOUND' end if not data then return 'NOTFOUND' end
local title = encoding(data.title) local title = unescape(data.title)
local from = encoding(data.author.name) local from = unescape(data.author.name)
local posted_at = makeOurDate(data.date) local posted_at = makeOurDate(data.date)
local content = data.excerpt:match('<p>(.*)<span') local content = data.excerpt:match('<p>(.*)<span')
if not content then if not content then
@ -39,7 +39,7 @@ function wordpress_recent_post:get_full_url(blog, tag)
if not content then if not content then
content = "" content = ""
else else
content = '\n'..encoding(content)..'...' content = '\n'..unescape(content)..'...'
end end
local url = data.url local url = data.url
if data.thumbnail then if data.thumbnail then