Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a2417f6d9dcb6c75

Jump to content

Module:NYCS SSI

Permanently protected module
From Wikipedia, the free encyclopedia

local p = {}

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

-- trim whitespace
local function trim(s)
	return s:match('^%s*(.-)%s*$')
end

function p._main(args)
	local shorthand = args[1]
	if shorthand then shorthand = trim(shorthand) end 
	
	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 trim(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 trim(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