encoding() -> unescape()
This commit is contained in:
parent
0e830fefda
commit
33080bc388
@ -1,7 +1,7 @@
|
||||
-- See http://www.ascii.cl/htmlcodes.htm
|
||||
-- str = string.gsub(str, '', '')
|
||||
|
||||
function encoding(str)
|
||||
function unescape(str)
|
||||
-- Symbols
|
||||
str = string.gsub(str, ' ', ' ') -- space
|
||||
str = string.gsub(str, '!', '!') -- exclamation point
|
||||
|
@ -310,23 +310,23 @@ function rss:cron(self_plz)
|
||||
local subscribers = {}
|
||||
local text = '' -- Send one message per feed with the latest entries
|
||||
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'
|
||||
if v2.content then
|
||||
content = v2.content:gsub("%b<>", "")
|
||||
if string.len(v2.content) > 300 then
|
||||
content = encoding(content)
|
||||
content = unescape(content)
|
||||
content = string.sub(content, 1, 300)..'...'
|
||||
else
|
||||
content = encoding(content)
|
||||
content = unescape(content)
|
||||
end
|
||||
elseif v2.summary then
|
||||
content = v2.summary:gsub("%b<>", "")
|
||||
if string.len(v2.summary) > 300 then
|
||||
content = encoding(content)
|
||||
content = unescape(content)
|
||||
content = string.sub(content, 1, 300)..'...'
|
||||
else
|
||||
content = encoding(content)
|
||||
content = unescape(content)
|
||||
end
|
||||
else
|
||||
content = ''
|
||||
|
@ -29,8 +29,8 @@ function wordpress_recent_post:get_full_url(blog, tag)
|
||||
local data = json.decode(res).posts[1]
|
||||
if not data then return 'NOTFOUND' end
|
||||
|
||||
local title = encoding(data.title)
|
||||
local from = encoding(data.author.name)
|
||||
local title = unescape(data.title)
|
||||
local from = unescape(data.author.name)
|
||||
local posted_at = makeOurDate(data.date)
|
||||
local content = data.excerpt:match('<p>(.*)<span')
|
||||
if not content then
|
||||
@ -39,7 +39,7 @@ function wordpress_recent_post:get_full_url(blog, tag)
|
||||
if not content then
|
||||
content = ""
|
||||
else
|
||||
content = '\n'..encoding(content)..'...'
|
||||
content = '\n'..unescape(content)..'...'
|
||||
end
|
||||
local url = data.url
|
||||
if data.thumbnail then
|
||||
|
Reference in New Issue
Block a user