Jump to content

Module:NYCS SSI

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Izno (talk | contribs) at 19:52, 31 March 2022 (make it so synonyms work). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

local cfg = mw.loadData('Module:NYCS SSI/configuration')

function p._main(args)
	local shorthand = args[1]
	local return_table
	if cfg[shorthand] and type(cfg[shorthand]) == 'table' then
		return_table = cfg[shorthand]
	elseif cfg[shorthand] and type(cfg[shorthand]) == 'string' then
		return_table = cfg[cfg[shorthand]]
	else
		return_table = cfg.default
	end
	local noimage = args[2]
	if noimage and noimage ~= '' then return return_table.text end
	
	if not return_table.image then return return_table.image_substitute end

	local text = return_table.text
	local other_text = args['text']
	if other_text and other_text ~= '' then text = other_text end
	
	return '[[File:' .. return_table.image ..
		'.svg|10px|link=List of New York City Subway services#Time periods|' ..
		text .. ']]'
end

function p.main(frame)
	return p._main(frame:getParent().args)
end

return p