Module:Pagetype: Difference between revisions
add caps parameter per talk request
m (1 revision imported) |
(add caps parameter per talk request) |
||
Line 195: | Line 195: | ||
function p._main(args) | function p._main(args) | ||
local redirect = detectRedirects(args) | local redirect = detectRedirects(args) | ||
local pagetype = "" | |||
if redirect then | if redirect then | ||
pagetype = redirect | |||
else | else | ||
pagetype = getNsDetectValue(args) | |||
end | end | ||
if yesno(args.plural, false) then | |||
if cfg.irregularPlurals[pagetype] then | |||
pagetype = cfg.irregularPlurals[pagetype] | |||
else | |||
pagetype = pagetype .. cfg.plural -- often 's' | |||
end | |||
end | |||
if yesno(args.caps, false) then | |||
pagetype = mw.ustring.upper(mw.ustring.sub(pagetype, 1, 1)) .. | |||
mw.ustring.sub(pagetype, 2) | |||
end | |||
return pagetype | |||
end | end | ||