Difference between revisions of "Module:Adjacent stations/Taiwan High Speed Rail"

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:Taiwan High Speed Rail Logo(Log Only).svg|18px\]\] ' .. link('Taiwan High Speed Rail')
 
['system title'] = '\[\[File:Taiwan High Speed Rail Logo(Log Only).svg|18px\]\] ' .. link('Taiwan High Speed Rail')
 
, ['THSR'] = {
 
, ['THSR'] = {
['line title'] = link('Taiwan High Speed Rail#Stations_transportation', 'HSR')
+
['line title'] = link('Taiwan High Speed Rail#Stations_transportation', nil, 'HSR')
 
, ['colour'] = 'c35617'
 
, ['colour'] = 'c35617'
 
, ['station link'] = function(s)
 
, ['station link'] = function(s)
Line 16: Line 18:
 
or s == 'Taipei'
 
or s == 'Taipei'
 
or s == 'Banqiao' then
 
or s == 'Banqiao' then
return link(s .. ' station', s)
+
return link(s, ' station')
 
else
 
else
return link(s .. ' HSR station', s)
+
return link(s, ' HSR station')
 
end
 
end
 
end
 
end

Revision as of 04:35, 22 April 2018

Documentation for this module may be created at Module:Adjacent stations/Taiwan High Speed Rail/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:Taiwan High Speed Rail Logo(Log Only).svg|18px\]\] ' .. link('Taiwan High Speed Rail')
	, ['THSR'] = {
		['line title'] = link('Taiwan High Speed Rail#Stations_transportation', nil, 'HSR')
		, ['colour'] = 'c35617'
		, ['station link'] = function(s)
			if s == 'Nangang'
			or s == 'Taipei'
			or s == 'Banqiao' then
				return link(s, ' station')
			else
				return link(s, ' HSR station')
			end
		end
		, ['left terminus'] = 'Nangang'
		, ['right terminus'] = 'Zuoying'
	}
}