md_escape: Escape [] richtig (danke @Akamaru)

This commit is contained in:
Andreas Bielawski 2016-07-17 20:35:44 +02:00
parent 709b31ae8e
commit faf06cca2a
2 changed files with 3 additions and 10 deletions

View File

@ -98,7 +98,7 @@ function get_yt_thumbnail(data)
end
function send_youtube_data(data, msg, self, link, sendpic)
local title = utilities.markdown_escape_simple(data.snippet.localized.title)
local title = utilities.md_escape(data.snippet.localized.title)
-- local description = data.snippet.localized.description
local uploader = data.snippet.channelTitle
local upload_date = makeOurDate(data.snippet.publishedAt)

View File

@ -490,15 +490,8 @@ end
function utilities.markdown_escape(text)
text = text:gsub('_', '\\_')
text = text:gsub('%[', '\\[')
text = text:gsub('%]', '\\]')
text = text:gsub('%*', '\\*')
text = text:gsub('`', '\\`')
return text
end
function utilities.markdown_escape_simple(text)
text = text:gsub('_', '\\_')
text = text:gsub('%[', '[[')
text = text:gsub('%]', ']]')
text = text:gsub('%*', '\\*')
text = text:gsub('`', '\\`')
return text