instead-modules/emphasis.lua

18 lines
514 B
Lua
Raw Normal View History

2015-08-14 14:30:47 +03:00
require 'format'
format.filter = function(text)
for _, s in ipairs {"%*%*", "%_%_"} do
text = text:gsub(s .. "([^%s][^<>]-[^%s][%*%_]?)" .. s, txtb("%1"));
end;
2015-08-15 02:33:13 +03:00
for _, s in ipairs {"%*"} do
2015-08-14 14:30:47 +03:00
text = text:gsub(s .. "([^%s_][^<>_]-[^%s_])" .. s, txtem("%1"));
end;
2015-08-15 02:33:13 +03:00
for _, s in ipairs {"%_"} do
text = text:gsub(s .. "([^%s_][^<>_]-[^%s_])" .. s, txtu("%1"));
end;
for _, s in ipairs {"%-"} do
text = text:gsub(s .. " ([^%s_][^<>_]-[^%s_]) " .. s, txtst("%1"));
end;
2015-08-14 14:30:47 +03:00
return text;
end