模块:标题替换

来自维阿百科
跳转至: 导航搜索

此模块的文档可以在模块:标题替换/doc创建

local module = { }

function module.main(frame)
	local parent = frame:getParent()
	if parent and parent:getTitle() == "Template:Sandbox/Func/Universnal" then
		frame = parent
	end
	if not frame.args[1] then
		return
	end
	local title = frame.args[1]
	local words_ustr = mw.ustring.gsub(title, "[^%a]", "")
	local words_str = mw.ustring.gsub(title, "[^A-Za-z]", "")
	if words_ustr == words_str then
		frame:callParserFunction("DISPLAYTITLE", title)
	end
	return
end

return module