မော်ဂျူး:redlink category
ပုံပန်းသွင်ပြင်
Documentation for this module may be created at မော်ဂျူး:redlink category/doc
local export = {}
function export.cat (frame)
local redlink_category = ""
if pcall(mw.incrementExpensiveFunctionCount) then
local m_languages = require("Module:languages")
local code = frame.args[1] -- language code
local template = frame.args["template"]
local lang = m_languages.getByCode(frame.args[1])
local entry = require("Module:links").getLinkPage(frame.args[2], lang) -- entry name (parameter 2 in Template:m, Template:l)
local link_object = mw.title.new (entry)
if not (link_object and link_object.exists) then
local langname = lang:getCanonicalName()
redlink_category = "[[Category:" .. langname .. " redlinks]]"
if template and template ~= "-" then
redlink_category = redlink_category .. "[[Category:" .. langname .. " redlinks/" .. template .. "]]"
end
end
end
return redlink_category
end
return export