Module:Used by/Sandbox
Documentation for this module may be created at Module:Used by/Sandbox/doc
local p = {} function common_string(args) return mw.getCurrentFrame():expandTemplate{title='Common string', args=args} end function get_args_and_count(frame) local args = frame.args local count = 0 for _ in pairs(args) do count = count + 1 end if count == 0 then args = frame:getParent().args for _ in pairs(args) do count = count + 1 end end return args, count end function p.all(frame) return common_string{'infobox-used-by-all'} end function p.all_except(frame) args, count = get_args_and_count(frame) assert(count >= 1) -- Must provide at least one "except" class assert(count <= 2) -- Dictionary strings only support up to two exceptions return common_string{'infobox-used-by-all-except-' .. #args, unpack(args)} end function p.classes(frame) args, count = get_args_and_count(frame) assert(count >= 1) -- Must provide at least one class assert(count <= 5) -- Dictionary strings only support up to five classes return common_string{'infobox-used-by-' .. #args, unpack(args)} end return p