abc
local export = {}
local module_name_aliases = {
sc = "scripts",
script = "scripts",
gc = "category",
generalcategory = "category",
}
local function get_pattern(prop)
if type(prop) ~= "string" then
error("prop is not a string")
end
local module_name, value = prop:match "^(%l+):(%a+)$"
if not module_name then
error("prop '" .. prop .. "' is invalid")
end
module_name = module_name:lower()
module_name = module_name_aliases or module_name
return require "Module:Unicode data/patterns".make_pattern {
args = { module = module_name, value = value }
}
end
local function make_funcs(name, func)
export = function (str, properties)
local pattern = properties:map(get_pattern):concat()
return func(str, pattern)
end
export = function (frame)
local args = require "Module:array".shallowCopy(frame.args)
local str = args:remove(1)
return export(str, args)
end
end
make_funcs("remove_all", function (str, pattern)
return (mw.ustring.gsub(str, "", ""))
end)
make_funcs("contains_any", function (str, pattern)
return mw.ustring.find(str, "") ~= nil
end)
make_funcs("filter", function (str, pattern)
return (mw.ustring.gsub(str, "", ""))
end)
return export