2017-01-28 10:39:58 -05:00
|
|
|
|
|
|
|
-- simple replacements demo
|
|
|
|
|
2017-01-28 11:29:57 -05:00
|
|
|
function span_text(class, str)
|
|
|
|
return string.format("<div class='%s'>%s</div>", class, str)
|
2017-01-28 10:39:58 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
function wobble_text(str)
|
|
|
|
return span_text("wobble", str)
|
|
|
|
end
|
|
|
|
|
2017-01-28 14:39:31 -05:00
|
|
|
function explode_text(str)
|
|
|
|
return span_text("explode", str)
|
|
|
|
end
|
|
|
|
|
2017-01-29 10:25:41 -05:00
|
|
|
function flashy_text(str)
|
2017-01-29 10:32:16 -05:00
|
|
|
return string.format("<span class='flashy'>%s</span>", str)
|
2017-01-29 10:25:41 -05:00
|
|
|
end
|
|
|
|
|
2017-01-28 15:12:00 -05:00
|
|
|
function psy_text(str)
|
2017-01-29 10:21:05 -05:00
|
|
|
return string.format("<span class='psy'>%s</span>", str)
|
2017-01-28 15:12:00 -05:00
|
|
|
end
|
|
|
|
|
2017-01-29 10:12:43 -05:00
|
|
|
function red_text(str)
|
2017-01-29 10:20:44 -05:00
|
|
|
return string.format("<span class='redtext'>%s</span>", str)
|
2017-01-29 10:12:43 -05:00
|
|
|
end
|
|
|
|
|
2017-01-29 09:46:12 -05:00
|
|
|
function pre_text(str)
|
2017-01-29 09:52:05 -05:00
|
|
|
|
|
|
|
str = str:gsub("%(", "(")
|
|
|
|
str = str:gsub("%)", ")")
|
|
|
|
str = str:gsub("%[", "[")
|
|
|
|
str = str:gsub("\\", "\")
|
2017-01-29 14:52:34 -05:00
|
|
|
str = str:gsub("//", "//")
|
2017-01-29 09:52:05 -05:00
|
|
|
str = str:gsub("%]", "]")
|
2017-01-29 14:42:40 -05:00
|
|
|
str = str:gsub("==", "==")
|
2017-01-29 10:08:00 -05:00
|
|
|
str = str:gsub("@", "@")
|
2017-01-29 09:46:12 -05:00
|
|
|
return span_text("code", str:gsub("%|", "|"))
|
|
|
|
end
|
|
|
|
|
2017-01-28 10:39:58 -05:00
|
|
|
-- generate extra markup
|
2017-01-28 10:47:24 -05:00
|
|
|
function memeposting(body, prefix)
|
2017-01-29 09:46:12 -05:00
|
|
|
body = string.gsub(body, "`(.-)`", pre_text)
|
2017-01-29 09:34:18 -05:00
|
|
|
body = string.gsub(body, "%(%(%((.-)%)%)%)", function(str) return string.format("<div class='nazi' style='background-image: url(%sstatic/nazi.png);'>%s</div>", prefix, str) end)
|
2017-01-29 09:46:12 -05:00
|
|
|
body = string.gsub(body, "|(.-)|", wobble_text)
|
2017-01-29 10:25:41 -05:00
|
|
|
body = string.gsub(body, "%[%[%[(.-)%]%]%]", flashy_text)
|
2017-01-29 10:08:00 -05:00
|
|
|
body = string.gsub(body, "==(.-)==", red_text)
|
|
|
|
body = string.gsub(body, "@@(.-)@@", psy_text)
|
2017-01-28 14:39:31 -05:00
|
|
|
body = string.gsub(body, "//(.-)\\\\", explode_text)
|
2017-01-28 15:12:00 -05:00
|
|
|
body = string.gsub(body, "/@(.-)@\\", psy_text)
|
2017-01-28 10:39:58 -05:00
|
|
|
return body
|
|
|
|
end
|