add some forumoji
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
local babycode = {}
|
||||
|
||||
local string_trim = require("lapis.util").trim
|
||||
local emoji = require("lib.babycode-emoji")
|
||||
|
||||
local function s_split(s, delimiter, max_matches, trim, allow_empty)
|
||||
local result = {}
|
||||
@ -121,6 +122,14 @@ function babycode.to_html(s, escape_html)
|
||||
|
||||
-- these can be nested, so replace open and closed separately
|
||||
text = text:gsub("%[(/?)quote%]", "<%1blockquote>")
|
||||
|
||||
text = text:gsub(":(.-):", function(code)
|
||||
if emoji[code] then
|
||||
return emoji[code]
|
||||
else
|
||||
return code
|
||||
end
|
||||
end)
|
||||
|
||||
-- replace loose links
|
||||
text = text:gsub("(https?://[%w-_%.%?%.:/%+=&~%@#%%]+[%w-/])", function(url)
|
||||
|
Reference in New Issue
Block a user