- Neue Funktion zum simplen Escapen von Markdown (ohne das "tanzende Männchen")

- RSS: Überflüssige \n werden rausgeschnitten
This commit is contained in:
Andreas Bielawski 2016-07-16 22:30:51 +02:00
parent 7c6337bf8a
commit 9c1dd2f9f7
3 changed files with 9 additions and 4 deletions

View File

@ -344,7 +344,7 @@ function rss:cron(self_plz)
else else
content = '' content = ''
end end
text = text..'\n#RSS: *'..title..'*\n'..utilities.md_escape(content)..' [Weiterlesen]('..link..')\n' text = text..'\n#RSS: *'..title..'*\n'..utilities.trim(utilities.markdown_escape_simple(content))..' [Weiterlesen]('..link..')\n'
end end
if text ~= '' then if text ~= '' then
local newlast = newentr[1].id local newlast = newentr[1].id

View File

@ -98,9 +98,7 @@ function get_yt_thumbnail(data)
end end
function send_youtube_data(data, msg, self, link, sendpic) function send_youtube_data(data, msg, self, link, sendpic)
local title = data.snippet.localized.title local title = utilities.markdown_escape_simple(data.snippet.localized.title)
local title = title:gsub('%*', '\\*')
local title = title:gsub('`', '\\`')
-- local description = data.snippet.localized.description -- local description = data.snippet.localized.description
local uploader = data.snippet.channelTitle local uploader = data.snippet.channelTitle
local upload_date = makeOurDate(data.snippet.publishedAt) local upload_date = makeOurDate(data.snippet.publishedAt)

View File

@ -497,6 +497,13 @@ function utilities.markdown_escape(text)
return text return text
end end
function utilities.markdown_escape_simple(text)
text = text:gsub('_', '\\_')
text = text:gsub('%*', '\\*')
text = text:gsub('`', '\\`')
return text
end
utilities.md_escape = utilities.markdown_escape utilities.md_escape = utilities.markdown_escape
utilities.triggers_meta = {} utilities.triggers_meta = {}