Jump to content

Module:StepHarvest

From StepHarvest Wiki
Revision as of 14:43, 11 June 2026 by Admin (talk | contribs) (Create StepHarvest helper module)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:StepHarvest/doc

-- Shared helpers for StepHarvest templates.
-- Keeps palette logic in one place so templates stay thin.
local p = {}

-- Renders a comma separated season list ("spring, fall") as Season tags.
function p.seasons( frame )
	local arg = frame.args[1] or ''
	local out = {}
	for season in mw.text.gsplit( arg, ',' ) do
		season = mw.text.trim( season )
		if season ~= '' then
			table.insert( out, frame:expandTemplate{ title = 'Season', args = { season } } )
		end
	end
	if #out == 0 then
		return ''
	end
	return table.concat( out, ' ' )
end

return p