模組:Documentation/functions/translit

維基詞典,自由的多語言詞典


return function (title, cats)
	-- Check that the title begins in a language or script code.
	-- If so, expand {{translit module documentation}} with that code
	-- as the first parameter.
	local code = title.text:match("^([%l-]+)%-translit$")
	
	if not (code and require("Module:languages").getByCode(code)) then
		code = title.text:match("^(%u%l%l%l)%-")
		if not require("Module:scripts").getByCode(code) then
			return
		end
	end
	
	return mw.getCurrentFrame():expandTemplate {
		title = "translit module documentation",
		args = { code },
	}
end