New method to escape markdown.

Improvements to patterns.lua.
This commit is contained in:
topkecleon
2016-04-02 19:20:28 -04:00
parent 1eb434f198
commit c74d1913a4
4 changed files with 17 additions and 28 deletions

View File

@@ -77,7 +77,7 @@ local lc_list = {
-- Replaces letters with corresponding Cyrillic characters.
latcyr = function(str)
for k,v in pairs(lc_list) do
str = string.gsub(str, k, v)
str = str:gsub(k, v)
end
return str
end
@@ -140,6 +140,15 @@ table_size = function(tab)
end
-- Just an easy way to get a user's full name.
build_name = function(first, last)
if last then
return first .. ' ' .. last
else
return first
end
end
resolve_username = function(input)
input = input:gsub('^@', '')
@@ -186,10 +195,7 @@ user_from_message = function(msg)
if not target.first_name then target.first_name = 'User' end
target.name = target.first_name
if target.last_name then
target.name = target.first_name .. ' ' .. target.last_name
end
target.name = build_name(target.first_name, target.last_name)
return target
@@ -264,12 +270,3 @@ function string:md_escape()
text = text:gsub('`', '\\`')
return text
end
-- Just an easy way to get a user's full name.
build_name = function(first, last)
if last then
return first .. ' ' .. last
else
return first
end
end