-- simple replacements demo function span_text(class, str) return string.format("
%s
", class, str) end function wobble_text(str) return span_text("wobble", str) end function explode_text(str) return span_text("explode", str) end function flashy_text(str) return string.format("%s", str) end function psy_text(str) return string.format("%s", str) end function red_text(str) return string.format("%s", str) end function pre_text(str) str = str:gsub("%(", "(") str = str:gsub("%)", ")") str = str:gsub("%[", "[") str = str:gsub("\\", "\") str = str:gsub("/", "/") str = str:gsub("%]", "]") str = str:gsub("=", "=") str = str:gsub("@", "@") return span_text("code", str:gsub("%|", "|")) end -- generate extra markup function memeposting(body, prefix) body = string.gsub(body, "`(.-)`", pre_text) body = string.gsub(body, "%(%(%((.-)%)%)%)", function(str) return string.format("
%s
", prefix, str) end) body = string.gsub(body, "|(.-)|", wobble_text) body = string.gsub(body, "%[%[%[(.-)%]%]%]", flashy_text) body = string.gsub(body, "==(.-)==", red_text) body = string.gsub(body, "@@(.-)@@", psy_text) body = string.gsub(body, "//(.-)\\\\", explode_text) body = string.gsub(body, "/@(.-)@\\", psy_text) return body end