md_escape: Escape [] richtig (danke @Akamaru)
This commit is contained in:
parent
709b31ae8e
commit
faf06cca2a
@ -98,7 +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 = utilities.markdown_escape_simple(data.snippet.localized.title)
|
local title = utilities.md_escape(data.snippet.localized.title)
|
||||||
-- 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)
|
||||||
|
@ -490,15 +490,8 @@ end
|
|||||||
|
|
||||||
function utilities.markdown_escape(text)
|
function utilities.markdown_escape(text)
|
||||||
text = text:gsub('_', '\\_')
|
text = text:gsub('_', '\\_')
|
||||||
text = text:gsub('%[', '\\[')
|
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
|
return text
|
||||||
|
Reference in New Issue
Block a user