Difference between revisions of "Module:Adjacent stations/Kaohsiung Rapid Transit"

From blackwiki
Jump to navigation Jump to search
blackwiki>Szqecs
blackwiki>Szqecs
Line 1: Line 1:
local function link(s1, s2)
+
local function link(s1, s2, s3)
if s2 then
+
if s3 then
return table.concat({'\[\[', s1, '|', s2, '\]\]'})
+
return table.concat({'\[\[', s1, '|', s3, '\]\]'})
 +
elseif s2 then
 +
return table.concat({'\[\[', s1, s2, '|', s1, '\]\]'})
 
elseif s1 then
 
elseif s1 then
 
return table.concat({'\[\[', s1, '\]\]'})
 
return table.concat({'\[\[', s1, '\]\]'})
Line 10: Line 12:
 
['system title'] = '\[\[File:Kaohsiung Mass Rapid Transit Logo(Logo Only).svg|18px\]\] ' .. link('Kaohsiung Rapid Transit System')
 
['system title'] = '\[\[File:Kaohsiung Mass Rapid Transit Logo(Logo Only).svg|18px\]\] ' .. link('Kaohsiung Rapid Transit System')
 
, ['Red'] = {
 
, ['Red'] = {
['line title'] = link('Red line (Kaohsiung MRT)', 'Red line')
+
['line title'] = link('Red line', ' (Kaohsiung MRT)')
 
, ['colour'] = 'ea0437'
 
, ['colour'] = 'ea0437'
 
, ['station link'] = function(s)
 
, ['station link'] = function(s)
 
local exception = {
 
local exception = {
['Ciaotou'] = link('Qiaotou station', 'Ciaotou')
+
['Ciaotou'] = link('Qiaotou station', nil, 'Ciaotou')
, ['Kaohsiung Main'] = link('Kaohsiung station', 'Kaohsiung Main station')
+
, ['Kaohsiung Main'] = link('Kaohsiung station', nil, 'Kaohsiung Main station')
, ['Zuoying'] = link('Zuoying HSR station', 'Zuoying')
+
, ['Zuoying'] = link('Zuoying', ' HSR station')
 
}
 
}
return exception[s] or link(s .. ' MRT station', s)
+
return exception[s] or link(s, ' MRT station')
 
end
 
end
 
, ['left terminus'] = 'Gangshan South'
 
, ['left terminus'] = 'Gangshan South'
Line 24: Line 26:
 
}
 
}
 
, ['Orange'] = {
 
, ['Orange'] = {
['line title'] = link('Orange line (Kaohsiung MRT)', 'Orange line')
+
['line title'] = link('Orange line', ' (Kaohsiung MRT)')
 
, ['colour'] = 'ff8800'
 
, ['colour'] = 'ff8800'
 
, ['station link'] = function(s)
 
, ['station link'] = function(s)
return link(s .. ' MRT station', s)
+
return link(s, ' MRT station')
 
end
 
end
 
, ['left terminus'] = 'Sizihwan'
 
, ['left terminus'] = 'Sizihwan'
Line 36: Line 38:
 
, ['colour'] = '00b14f'
 
, ['colour'] = '00b14f'
 
, ['station link'] = function(s)
 
, ['station link'] = function(s)
return link(s .. ' LRT station', s)
+
return link(s, ' LRT station')
 
end
 
end
 
, ['left terminus'] = 'Hamasen'
 
, ['left terminus'] = 'Hamasen'

Revision as of 04:40, 22 April 2018

Documentation for this module may be created at Module:Adjacent stations/Kaohsiung Rapid Transit/doc

local function link(s1, s2, s3)
	if s3 then
		return table.concat({'\[\[', s1, '|', s3, '\]\]'})
	elseif s2 then
		return table.concat({'\[\[', s1, s2, '|', s1, '\]\]'})
	elseif s1 then
		return table.concat({'\[\[', s1, '\]\]'})
	end
end

return {
	['system title'] = '\[\[File:Kaohsiung Mass Rapid Transit Logo(Logo Only).svg|18px\]\] ' .. link('Kaohsiung Rapid Transit System')
	, ['Red'] = {
		['line title'] = link('Red line', ' (Kaohsiung MRT)')
		, ['colour'] = 'ea0437'
		, ['station link'] = function(s)
			local exception = {
				['Ciaotou'] = link('Qiaotou station', nil, 'Ciaotou')
				, ['Kaohsiung Main'] = link('Kaohsiung station', nil, 'Kaohsiung Main station')
				, ['Zuoying'] = link('Zuoying', ' HSR station')
			}
			return exception[s] or link(s, ' MRT station')
		end
		, ['left terminus'] = 'Gangshan South'
		, ['right terminus'] = 'Siaogang'
	}
	, ['Orange'] = {
		['line title'] = link('Orange line', ' (Kaohsiung MRT)')
		, ['colour'] = 'ff8800'
		, ['station link'] = function(s)
			return link(s, ' MRT station')
		end
		, ['left terminus'] = 'Sizihwan'
		, ['right terminus'] = 'Daliao'
	}
	, ['Circular'] = {
		['line title'] = link('Circular light rail')
		, ['colour'] = '00b14f'
		, ['station link'] = function(s)
			return link(s, ' LRT station')
		end
		, ['left terminus'] = 'Hamasen'
		, ['right terminus'] = 'Lizihnei'
	}
}