Difference between revisions of "Module:Adjacent stations/Taiwan High Speed Rail"
Jump to navigation
Jump to search
blackwiki>Szqecs m |
blackwiki>Szqecs |
||
| Line 55: | Line 55: | ||
end | end | ||
end | end | ||
| − | local | + | local style = mw.loadData('Module:L-rail') |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
local row = { | local row = { | ||
['start'] = '{| class="wikitable" ' .. style['table'] | ['start'] = '{| class="wikitable" ' .. style['table'] | ||
Revision as of 18:53, 19 January 2018
Documentation for this module may be created at Module:Adjacent stations/Taiwan High Speed Rail/doc
local p = {}
function p.l(frame)
local f = frame.args -- 'f' for 'frame'
local THSR = {
'Nangang',
'Taipei',
'Banqiao',
'Taoyuan',
'Hsinchu',
'Miaoli',
'Taichung',
'Changhua',
'Yunlin',
'Chiayi',
'Tainan',
'Zuoying',
}
local function s_link(x) -- 's' for 'station'
if x then
if x == 'Nangang' or x == 'Taipei' or x == 'Banqiao' then
return '\[\[' .. x .. ' station|' .. x .. '\]\]'
else
return '\[\[' .. x .. ' HSR station|' .. x .. '\]\]'
end
end
end
local index = tonumber(f[2])
if index then
if index > 2 and index < #THSR-1 then
left = s_link(THSR[index-1])
right = s_link(THSR[index+1])
left_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[1]) .. '</div>'
right_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[#THSR]) .. '</div>'
elseif index == 1 then
left = '<div style="font-style: italic">Terminus</div>'
right = s_link(THSR[index+1])
left_toward = ''
right_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[#THSR]) .. '</div>'
elseif index == 2 then
left = s_link(THSR[index-1])
right = s_link(THSR[index+1])
left_toward = '<br><div style="font-size: smaller;font-style: italic">Terminus</div>'
right_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[#THSR]) .. '</div>'
elseif index == #THSR-1 then
left = s_link(THSR[index-1])
right = s_link(THSR[index+1])
left_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[1]) .. '</div>'
right_toward = '<br><div style="font-size: smaller;font-style: italic">Terminus</div>'
elseif index == #THSR then
left = s_link(THSR[index-1])
right = '<div style="font-style: italic">Terminus</div>'
left_toward = '<br><div style="font-size: smaller;font-style: italic">toward ' .. s_link(THSR[1]) .. '</div>'
right_toward = ''
end
end
local style = mw.loadData('Module:L-rail')
local row = {
['start'] = '{| class="wikitable" ' .. style['table']
,['header'] = '\n|-'
.. '\n! ' .. style['header leftcell'] .. 'Preceding station'
.. '\n! ' .. style['header midcell'] .. '\[\[Taiwan High Speed Rail\]\]'
.. '\n! ' .. style['header rightcell'] .. 'Following station'
,['body'] = '\n|-'
.. '\n| ' .. style['body leftcell'] .. left .. left_toward
.. '\n| ' .. style['body banner'] .. '#C35617"|'
.. '\n| ' .. style['body midcell'] .. '\[\[Taiwan High Speed Rail\]\]'
.. '\n| ' .. style['body banner'] .. '#C35617"|'
.. '\n| ' .. style['body rightcell'] .. right .. right_toward
,['end'] = '\n|}'
}
local position = {
['all'] = row['start'] .. row['header'] .. row['body'] .. row['end']
,['top'] = row['start'] .. row['header'] .. row['body']
,['mid'] = row['body']
,['bottom'] = row['body'] .. row['end']
,['header mid'] = row['header'] .. row['body']
,['header bottom'] = row['header'] .. row['body'] .. row['end']
}
return position[f[1]]
end
return p