Module:Infobox Episode: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Manually define premium here) |
(Add default sort for episodes via "sequence_number" param) |
||
Line 17: | Line 17: | ||
parse.release, |
parse.release, |
||
-- Premium manually defined in episode infoboxes |
-- Premium manually defined in episode infoboxes |
||
{name = 'premium', func = parse.yes_no, smw_property = 'Premium', smw_func = parse.yes_no_smw, category_incomplete = 'Needs premium status'} |
{ name = 'premium', func = parse.yes_no, smw_property = 'Premium', smw_func = parse.yes_no_smw, category_incomplete = 'Needs premium status' }, |
||
{ name = 'sequence_number', func = parse.number, smw_property = 'Episode sequence number', smw_func = parse.number, category_incomplete = 'Needs episode sequence number' }, |
|||
} |
} |
||
local infobox = Infobox.new(config, params, args) |
local infobox = Infobox.new(config, params, args) |
||
infobox |
infobox |
||
Line 37: | Line 38: | ||
} |
} |
||
:pad(20) |
:pad(20) |
||
if infobox:is_param_defined(Infobox.param('sequence_number')) > 0 then |
|||
local sequence_number = tonumber(infobox:get_param(Infobox.param('sequence_number'), 0)) |
|||
if sequence_number > 10 then |
|||
error('Please change [[Module:Infobox Episode]] to pad episode number to be 2 digits long (e.g., "Episode 01: Hopeport") to preserve sorting') |
|||
end |
|||
frame:callParserFunction{ name = 'DEFAULTSORT', args = ('Episode %d: %s'):format(sequence_number, infobox:get_param(Infobox.param('name'), 0)) } |
|||
end |
|||
return infobox |
return infobox |
||
end |
end |