Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/lua/memeposting.lua

27 lines
553 B
Lua
Raw Normal View History

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-28 15:12:00 -05:00
function psy_text(str)
return span_text("psy", str)
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-28 11:46:32 -05:00
body = string.gsub(body, "|(.-)|", wobble_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