Module:pages/templates
Appearance
- පහත දැක්වෙන උපදෙස්, Module:pages/templates/documentation හි පිහිටා ඇත. Module:pages/templates/documentation]]. [සංස්කරණය] Categories were auto-generated by Module:documentation. [edit]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
This module implements {{pagetype}}
.
-- Prevent substitution.
if mw.isSubsting() then
return require("Module:unsubst")
end
local get_current_title = mw.title.getCurrentTitle
local new_title = mw.title.new
local export = {}
function export.pagetype_t(frame)
local args = require("Module:parameters").process(frame:getParent().args, {
["article"] = {type = "boolean"},
["pagename"] = {demo = true},
})
local pagename = args.pagename
local pagetype = require("Module:pages").pagetype(
not pagename and get_current_title() or new_title(pagename) or error(mw.dumpObject(pagename) .. " is not a valid page name.")
)
return not args.article and pagetype or
pagetype:sub(1, 4) == "user" and "a " .. pagetype or -- avoids "an user"
require("Module:string utilities").add_indefinite_article(pagetype)
end
return export