Module:For: Difference between revisions

119 bytes added ,  5 years ago
Updated from sandbox: prints error if first parameter is empty (previously defaulted to "other uses"); exact-match "other uses" is still categorized
m (1 revision imported: Mass importing office templates & modules)
enwiki>Nihiltres
(Updated from sandbox: prints error if first parameter is empty (previously defaulted to "other uses"); exact-match "other uses" is still categorized)
Line 1:
local mArguments --initialize lazily
local yesno = require('Module:Yesno')
local mHatlist = require('Module:Hatnote list')
local mHatnote = require('Module:Hatnote')
local yesnoyesNo = require('Module:Yesno')
local p = {}
 
Line 15:
function p._For (args)
local use = args[1]
if (not use) then
local category = ''
return mHatnote.makeWikitextError(
if (not use or use == 'other uses') and
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
(not args.category or yesno(args.category)) then
'Template:For#Errors',
category = '[[Category:Hatnote templates using unusual parameters]]'
args.category
)
end
local pages = {}
Line 26 ⟶ 28:
mHatlist.forSeeTableToString({{use = use, pages = pages}}),
{selfref = args.selfref}
) .. category(
(use == 'other uses') and yesNo(args.category) and
category = '[[Category:Hatnote templates using unusual parameters]]' or ''
)
end
 
Anonymous user