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 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").get_pagetype(
pagename == nil and mw.title.getCurrentTitle() or
mw.title.new(pagename) or
error(("%s is not a valid page name"):format(mw.dumpObject(pagename)))
)
return args.article and (
pagetype:match("^user%f[%W]") and "a " .. pagetype or -- avoids "an user"
require("Module:string utilities").add_indefinite_article(pagetype)
) or pagetype
end
return export