Module:For: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
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: | Line 1: | ||
local mArguments --initialize lazily |
local mArguments --initialize lazily |
||
⚫ | |||
local mHatlist = require('Module:Hatnote list') |
local mHatlist = require('Module:Hatnote list') |
||
local mHatnote = require('Module:Hatnote') |
local mHatnote = require('Module:Hatnote') |
||
⚫ | |||
local p = {} |
local p = {} |
||
Line 15: | Line 15: | ||
function p._For (args) |
function p._For (args) |
||
local use = args[1] |
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', |
|||
⚫ | |||
args.category |
|||
) |
|||
end |
end |
||
local pages = {} |
local pages = {} |
||
Line 26: | Line 28: | ||
mHatlist.forSeeTableToString({{use = use, pages = pages}}), |
mHatlist.forSeeTableToString({{use = use, pages = pages}}), |
||
{selfref = args.selfref} |
{selfref = args.selfref} |
||
) .. |
) .. ( |
||
(use == 'other uses') and yesNo(args.category) and |
|||
⚫ | |||
) |
|||
end |
end |
||