跳转到内容

模块:站台配置

本页使用了标题或全文手工转换
被永久保护的模块
维基百科,自由的百科全书
文档图示 模块文档[查看] [编辑] [历史] [清除缓存]

本模板用作产生铁路车站的站台配置表格,通常配合{{車站構造}}使用。

注意:本模板使用Module:Adjacent stations的子模块列表的数据。在使用本模板前,请先检查是否存在该铁路系统的子模块页面(Module:Adjacent stations/{{{system}}},例:Module:Adjacent stations/港铁) 。

参数

参数 描述 类型 状态
高级 complex 进阶 站台组是否包含西班牙式站台等高级站台配置,影响站台编号的显示位置。需传入{{Yesno}}接受的内容,默认为否。 字符串 选填
系统 system 系统 站台组的所属系统,填入内容必须为Module:Adjacent stations子页面
例子
字符串 必填
组别 gn n n行显示内容的组别
可填选项
  • p:站台
    • 可在此参数输入pf台來表示为未来(未启用)之站台
  • t:路轨
    • 可在此参数输入tf轨来表示为未来(未启用)之路轨
    • 可附lr选项使用(例:trf轨右来即未来往右的路轨)
  • x:文字
字符串 必填
风格 style 影响整个表格的CSS风格 字符串 选填
stylen 影响第n行的CSS风格 字符串 选填
延伸内容 pren 在第n行前方附加储存格内容 字符串 选填
apn 在第n行后方附加储存格内容 字符串 选填
延伸内容风格 prens 在第n行前方附加储存格内容的CSS格式 字符串 选填
apns 在第n行后方附加储存格内容的CSS格式 字符串 选填
组别参数为站台的相关参数
站台类型 pn n n行的站台的类型
可填选项
  • side侧式站台
    • 需在选项后添加方向(上或下,up或dn)来表示站台面对轨道的方向,其他单侧站台同理。
  • split分离式站台(显示与侧式相同,站台描述文字显示为分离式)
  • island岛式站台
  • bay港湾式站台(显示与岛式相同,站台描述文字显示为港湾式)
  • narrow:自定义窄站台(显示与侧式相同,站台描述文字不自动显示站台类型)
  • wide:自定义阔站台(显示与岛式相同,站台描述文字不自动显示站台类型)
字符串 组别必填
乘降门方向 dn n n行的站台的列车乘降门开启方向
可填选项
  • 上X下X(例:上左下右
  • 自定义文字
字符串 选填
文字 tn n n行的站台的自定义补充描述文字 字符串 选填
边框 bln 左边框n
brn 右边框n
btn 上边框n
bbn 下边框n
自定义第n行的站台的边框CSS格式(例:2px solid black 字符串 选填
组别参数为路轨的相关参数
线路 ln 线n n行路轨的线路 字符串 选填
站台编号 pn n
pun 上台n
pdn 下台n
n行路轨的对应站台编号。在一般模式中应全部使用pnn;高级模式中应全部使用pun上號n(对应上方的站台的编号)和pdn下號n(对应下方的站台的编号)。 字符串 选填
箭头 aln 左箭n
arn 右箭n
n行路轨的对应左(l)边和右(r)边箭头方向。默认左边箭头向左,右边箭头向右,若想让左右的箭头均显示向左则在alnarn参数均填写l,左右的箭头均向右则填写r 字符串 选填
目的地(1) dn dnd1 n n行路轨的主要目的地,若为下客站台(例如荃湾站1号站台)请填term落客月台 字符串 选填
目的地(2) dnd2 及往n n行路轨的次要目的地 字符串 选填
未来目的地 dnf 未来往n n行路轨的未来目的地 字符串 选填
下站(1) nn nnd1 下站n n行路轨运行方向的下一站,若下一站为终点站请填dest終點站 字符串 选填
下站(2) nnd2 另下站n n行路轨运行方向次要目的地的下一站,若下一站为终点站请填dest終點站 字符串 选填
未来下站 nnf 未来下站n n行路轨未来运行方向的下一站 字符串 选填
延伸文字 在目的地/下站
参数名后加x
(如dnd1x
目的地/下站后加插之文字 字符串 选填
文字 tn n n行路轨的自定义文字,可选择不填以上参数自定义显示文字 字符串 选填
组别参数为文字的相关参数
文字 tn n 自定义文字 字符串 组别必填
储存格风格 cstylen 套用于第n行自定义文字储存格的CSS格式 字符串 选填

示例

简单示例

港铁荃湾站

{{ 车站构造
| 层1 = U1 | 标1 = 大厅
| 文1 = {{spml|A-C出口|客务中心|商店|自助服务|“iCentre”免费上网服务}}
| 层2 = G | 标2 = 站台
| 文2 = {{ 站台配置 | 系统 = 港铁
  | 组1 = 台 | 类1 = 侧下 | 门1 = 左
  | 组2 = 轨右 | 线2 = 荃湾 | 往2 = 中环 | 下站2 = 大窝口 | 台2 = 2
  | 组3 = 轨左 | 线3 = 荃湾 | 往3 = 下客站台 | 台3 = 1
  | 组4 = 台 | 类4 = 侧上 | 门4 = 左 | 下边框4 = 2px solid black
  | 组5 = 文| 文5 = {{ 车站构造/站台出口 | D、E出口大厅 | align = center | face = top }}
}}
}}

显示效果为:

U1大厅A-C出口客务中心商店自助服务“iCentre”免费上网服务
G站台
侧式站台 · 开左边车门
荃湾线中环大窝口2
1荃湾线下客站台
侧式站台 · 开左边车门
D、E出口大厅
另一表示方法
{{ 车站构造
| 层1 = U1 | 标1 = 大厅
| 文1 = {{spml|A-C出口|客务中心|商店|自助服务|“iCentre”免费上网服务}}
| 层2 = G | 标2 = 站台
| 文2 = {{ 站台配置 | 系统 = 港铁
  | 组1 = 台 | 类1 = 侧下 | 门1 = 左
  | 组2 = 轨右 | 线2 = 荃湾 | 往2 = 中环 | 下站2 = 大窝口 | 台2 = 2
  | 组3 = 轨 | 线3 = 荃湾 | 往3 = 下客站台 | 台3 = 1 | 右箭3 = 左
  | 组4 = 台 | 类4 = 侧上 | 门4 = 左 | 下边框4 = 2px solid black
  | 组5 = 文| 文5 = {{ 车站构造/站台出口 | D、E出口大厅 | align = center | face = top }}
}}
}}

显示效果为:

U1大厅A-C出口客务中心商店自助服务“iCentre”免费上网服务
G站台
侧式站台 · 开左边车门
荃湾线中环大窝口2
荃湾线下客站台1
侧式站台 · 开左边车门
D、E出口大厅

港铁金钟站

{{ 车站构造
| floor1 = U1 | label1 = 金钟廊
| content1 = {{spml|行人天桥|E出口(因工程暂时停用)}}
| floor2 = G  | label2 = 地面
| content2 = A、B、C、D出口
| floor3 = L1 | label3 = 大厅
| content3 = {{spml|F出口|商店|客务中心|自动售票设施|自动柜员机|数码服务站|旅客服务|iCentre|失物及乘车优惠办事处|警岗|卫生间}}
| floor4 = L2 | label4 = 港岛线、荃湾线<br/>上层站台
| content4 = {{ 站台配置 | system = MTR
  | g1 = tl | l1 = 荃湾 | d1 = 中环 | n1 = dest | p1 = 4
  | g2 = p | p2 = island | d2 = 左
  | g3 = tr | l3 = 港岛 | d3 = 柴湾 | n3 = 湾仔 | p3 = 3
  }}
| floor5 = L3 | label5 = 港岛线、荃湾线<br/>下层站台
| content5 = {{ 站台配置 | system = MTR
  | g1 = tr | l1 = 荃湾 | d1 = 荃湾 | n1 = 尖沙咀 | p1 = 1
  | g2 = p | p2 = island | d2 = 右
  | g3 = tl | l3 = 港岛 | d3 = 坚尼地城 | n3 = 中环 | p3 = 2
  }}
| floor6 = L4 | label6 = 转车大厅
| content6 = 往返新旧站台之通道
| floor7 = L5 | label7 = 未来东铁线站台、<br/>换乘通道
| content7 = {{ 站台配置 | system = MTR
  | g1 = trf | l1 = 东铁 | d1d1 = 罗湖 | d1d2 = 落马洲 | n1 = 会展 | p1 = 7
  | g2 = p | p2 = split-up | d2 = 右 | bb2 = 1px solid lightgray
  | g3 = x | t3 = 南港岛线换乘通道 · 卫生间
  | g4 = p | p4 = split-dn | d4 = 右 | bt4 = 1px solid lightgray
  | g5 = tlf | l5 = 东铁 | t5 = 下客站台 | p5 = 8
  }}
| floor8 = L6 | label8 = 南港岛线站台
| content8 = {{ 站台配置 | system = MTR
  | g1 = tl | l1 = 南港岛 | d1 = 海怡半岛 | n1 = 海洋公园 | p1 = 6
  | g2 = p | p2 = island | d2 = 上右下左<!-- 进站时乘降门开启方向 -->
  | g3 = tl | l3 = 南港岛 | d3 = 海怡半岛 | n3 = 海洋公园 | p3 = 5
  }}
| floor9 = L7 | label9 = 机房层
| content9 = (仅供职员使用,不开放予公众)
}}

显示效果为:

U1金钟廊行人天桥E出口(因工程暂时停用)
G地面A、B、C、D出口
L1大厅F出口商店客务中心自动售票设施自动柜员机数码服务站旅客服务iCentre失物及乘车优惠办事处警岗卫生间
L2港岛线、荃湾线
上层站台
4荃湾线中环(终点站)
岛式站台 · 开左边车门
港岛线柴湾湾仔3
L3港岛线、荃湾线
下层站台
荃湾线荃湾尖沙咀1
岛式站台 · 开右边车门
2港岛线坚尼地城中环
L4转车大厅往返新旧站台之通道
L5未来东铁线站台、
换乘通道
未来东铁线罗湖落马洲会展7
分离式站台 · 开右边车门
南港岛线换乘通道 · 卫生间
分离式站台 · 开右边车门
8未来东铁线下客站台
L6南港岛线站台
6南港岛线海怡半岛海洋公园
岛式站台 ·
↑开右边车门
↓开左边车门
5南港岛线海怡半岛海洋公园
L7机房层(仅供职员使用,不开放予公众)

高级示例

广州地铁公园前站

{{ 车站构造 
| 层1 = 地下一层 | 标1 = 共用站厅<br><small>{{广州地铁路线标志|1|S}} {{广州地铁路线标志|2|S}}</small>
| 文1 = 售票机、客务中心、商店、警务室、母婴室、安检设施
| 层2 = 地下二层 | span2 = 2
| 标2 = 北站厅<br><small>{{广州地铁路线标志|2|S}}</small>
| 文2 = 售票机、客务中心、安检设施
| 标3 = {{广州地铁路线链接|1}}站台
| 文3 = {{ 站台配置 | 系统 = 广州地铁 | 进阶 = 是
  | 组1 = p | 类1 = 侧下 | 文1 = 祇供下車 
  | 组2 = tl | 线2 = 1 | 往2 = 西塱 | 下站2 = 西门口 | 上台2 = 4 | 下台2 = 2
  | 组3 = p | 类3 = 岛 | 文3 = 祇供上車
  | 组4 = tr | 线4 = 1 | 往4 = 广州东站 | 下站4 = 农讲所 | 上台4 = 1 | 下台4 = 3
  | 组5 = p | 类5 = 侧上 | 文5 = 祇供下車 
}}
| 层4 = 地下三層 | 标4 = {{广州地铁路线链接|2}}站台
| 文4 = {{ 站台配置 | 系统 = 广州地铁 | 进阶 = 是
  | 组1 = x | 文1 = 付费区出口往动漫星城
  | 组2 = p | 类2 = 侧下 | 文2 = 祇供下車 | bt2 = 2px dashed lightgray
  | 组3 = tl | 线3 = 2 | 往3 = 嘉禾望岗 | 下站3 = 纪念堂 | 上台3 = 7 | 下台3 = 5
  | 组4 = p | 类4 = 岛 | 文4 = 祇供上車
  | 组5 = tr | 线5 = 2 | 往5 = 广州南站 | 下站5 = 海珠广场 | 上台5 = 6 | 下台5 = 8
  | 组6 = p | 类6 = 侧上 | 文6 = 祇供下車 | bb6 = 2px dashed lightgray
  | 组7 = x | 文7 = 付费区出口往动漫星城
}}
}}

显示效果为:

地下一层共用站厅
1号线 2号线
售票机、客务中心、商店、警务室、母婴室、安检设施
地下二层北站厅
2号线
售票机、客务中心、安检设施
1号线站台
4侧式站台 · 祇供下车
1号线西塱西门口
2
1
岛式站台 · 祇供上车
1号线广州东站农讲所
3侧式站台 · 祇供下车
地下三层2号线站台
付费区出口往动漫星城
7侧式站台 · 祇供下车
2号线嘉禾望岗纪念堂
5
6
岛式站台 · 祇供上车
2号线广州南站海珠广场
8侧式站台 · 祇供下车
付费区出口往动漫星城

港铁罗湖站

{{ 車站構造 
| 層1 = L2 | 標1 = 入境大堂/<br/>票務大堂
| 文1 = {{spml|客務中心|自助售票機|洗手間|香港入境事務處及香港海關檢查(香港居民)|車站商店|自動櫃員機|數碼服務站|旅客諮詢及服務中心|港鐵旅遊}}
| 層2 = L1 | span2 = 2
| 標2 = 行人天橋
| 文2 = 深圳羅湖聯檢大樓而來人流,走至橋盡頭後香港居民乘電梯往上一層,非香港居民往左走,分流入境
| 標3 = 入境大堂
| 文3 = {{spml|香港入境事務處及香港海關檢查(非香港居民)|報案中心(設於夾層)}}
| 層4 = G | span4 = 4
| 標4 = 行人天橋
| 文4 = 往深圳羅湖聯檢大樓
| 標5 = 離境大堂
| 文5 = {{spml|A出口|客務中心|洗手間|香港入境事務處及香港海關檢查|羅湖居民通道|車站商店|鐵路免稅店|自動售賣機|數碼服務站}}
| 標6 = 月台<br/>[[File:BSicon numN090.svg|30px|link=]]
| 文6 = {{ 月台配置 | 系統 = 港鐵 | 進階 = 是
  | 組1 = 軌 | 文1 = [[城際直通車]]路軌 | 左箭1 = L | 右箭1 = R | ap1 = {{small|往深圳 →}}
  | 組2 = 台 | 類2 = 側下 | 門2 = 右 | 文2 = 只供上客 | 上邊框2 = 4px solid black 
  | 組3 = 軌 | 綫3 = 東鐵 | 往3 = 紅磡 | 下站3 = 上水 | 左箭3 = L | 上台3 = 1 | 右箭3 = / | 下台3 = 2
  | ap3 = {{small|往深圳 →}}
  | 組4 = 台 | 類4 = 灣 | 門4 = 上右下左
  | 文4 = 只供落客 | 右邊框4 = 2px dashed lightgray
  | ap4s = font-size:90%;border-top:2px solid black;text-align:center | ap4 = 離境大堂
  | 組5 = 軌 | 綫5 = 東鐵 | 往5 = 紅磡 | 下站5 = 上水 | 左箭5 = L | 下台5 = 4 | 右箭5 = / | 上台5 = 3
  | ap5s = border-left:4px solid black
  | ap6s = border-left:4px solid black
  | 組6 = 台 | 類6 = 側上 | 門6 = 左 | 文6 = 只供上客
  | 右邊框6 = 2px solid black | 下邊框6 = none
}}
| 文7 = A出口行人隧道
}}

显示效果为:

L2入境大厅/
票务大厅
客务中心自助售票机卫生间香港入境事务处及香港海关检查(香港居民)车站商店自动柜员机数码服务站旅客咨询及服务中心港铁旅游
L1行人天桥深圳罗湖联检大楼而来人流,走至桥尽头后香港居民乘电梯往上一层,非香港居民往左走,分流入境
入境大厅香港入境事务处及香港海关检查(非香港居民)报案中心(设于夹层)
G行人天桥往深圳罗湖联检大楼
离境大厅A出口客务中心卫生间香港入境事务处及香港海关检查罗湖居民通道车站商店铁路免税店自动售卖机数码服务站
站台
城际直通车路轨往深圳 →
1侧式站台 · 开右边车门 · 只供上客
东铁线红磡上水往深圳 →
2
3
港湾式站台 ·
↑开右边车门
↓开左边车门
· 只供下客
离境大厅
东铁线红磡上水
4侧式站台 · 开左边车门 · 只供上客
A出口行人隧道

参见

local getArgs = require('Module:Arguments').getArgs;
local yesno = require('Module:Yesno');
local p = {}

local term = '落客-{zh-hans:站台;zh-hant:月台}-'
local dest = '終點站'

local function station(data, stn)
	if stn == '' then return '' end
	if stn == 'dest' or mw.ustring.match(stn, '[終终][点點]站') then return dest end
	if stn == 'term' or mw.ustring.match(stn, '落客[站月]台'  ) then return term end
	if mw.ustring.match(stn, '[内內外][圈環环]') then return stn end
	local dF = data['station format'][stn] or data['station format'][1]
	-- if format ~= nil then
	dF = mw.ustring.gsub(dF, '%%1', stn)
	local str = dF:find '|' and dF or string.format('[[%s|%s]]', dF, stn)
	return str
	-- else return stn
	-- end
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(frame, args)
end

function p._main(frame, args)
	if not (args.g1 or args['組1'] or args['组1']) then
		return ''
	end
	local astyle = args[ 'style' ] or ''
	local out = mw.html.create 'table'
		:addClass( "station-structure-platform" )
	
	local system = args[ 'system' ] or args[ 's' ] or args[ '系統' ] or args[ '系统' ]
	local data = mw.loadData( 'Module:Adjacent stations/' .. system );
	
	local complex = yesno( args[ 'complex' ] or args[ '進階' ] or args[ '进阶' ] )
	
	local prepend, append = false, false
	local haspno = false
	for i = 1, 30, 1 do
		local g = args['g' .. i] or args['組' .. i] or args['组' .. i] or ''
		local group = ""
		if     mw.ustring.match(g, '[p台]')   ~= nil then group = "platform" 
		elseif mw.ustring.match(g, '[t軌轨]') ~= nil then group = "track"
		elseif mw.ustring.match(g, '[x文]')   ~= nil then group = "text" end
			
		if args[ 'pre' .. i ] then prepend = true end
		if args[ 'ap'  .. i ] then append  = true end
		if (group == "track" and args[ 'p' .. i ]) or args[ '台' .. i ]
			or args[ 'pu' .. i ] or args[ '上台' .. i ] or args[ '上号' .. i ]
			or args[ 'pd' .. i ] or args[ '下台' .. i ] or args[ '下号' .. i ] then
				haspno = true
		end
	end
	
	for i = 1, 30, 1 do
		local g = args['g' .. i] or args['組' .. i] or args['组' .. i] or ''
		local group = ""
		if     mw.ustring.match(g, '[p台]')   ~= nil then group = "platform" 
		elseif mw.ustring.match(g, '[t軌轨]') ~= nil then group = "track"
		elseif mw.ustring.match(g, '[x文]')   ~= nil then group = "text" end
		
		if group ~= "" then
			local style = args['style' .. i] or ''
			local future = mw.ustring.match(g, '[f來来]') ~= nil
			
			local tr = out:tag 'tr'
			if future then style = style .. 'opacity:60%;' end
			local border = {
				plt  = 'solid 2px var(--border-color-notic,black)';
				pltx = 'solid 2px var(--border-color-notic,black)';
				trk  = 'solid 1px var(--border-color-muted,lightgray)'
			}
			
			local text = args[ 't' .. i ] or args[ '文' .. i ] or ''
			
			local prep = args[ 'pre' .. i ] or ''
			local pres = args[ 'pre' .. i .. 's' ] or ''
			if prepend then tr:tag 'td':cssText( pres ) :wikitext( prep ) end
			
			if group == "platform" then
				local bg = args[ 'bg' .. i ] or args[ '背' .. i ]
				bg = (bg or '#f9f9f9')
				local p = args[ 'p' .. i ] or args[ '類' .. i ] or args[ '类' .. i ] or ''
				local type
				
				if     string.find(p, 'side')        ~= nil
					or mw.ustring.match(p, '[側侧]') ~= nil then type = "side" 
				elseif string.find(p, 'split')       ~= nil
					or mw.ustring.match(p, '[離离]') ~= nil then type = "split"
				elseif string.find(p, 'narrow')      ~= nil
					or mw.ustring.match(p, '[窄]')   ~= nil then type = "narrow"
				elseif string.find(p, 'island')      ~= nil
					or mw.ustring.match(p, '[島岛]') ~= nil then type = "island"
				elseif string.find(p, 'bay')         ~= nil
					or mw.ustring.match(p, '[灣湾]') ~= nil then type = "bay"
				elseif string.find(p, 'wide')        ~= nil
					or mw.ustring.match(p, '[闊阔]') ~= nil then type = "wide"
				else                                        type = p        end
				
				local bt = args[ 'bt' .. i ] or args[ '上邊框' .. i ] or args[ '上边框' .. i ]
				local bb = args[ 'bb' .. i ] or args[ '下邊框' .. i ] or args[ '下边框' .. i ]
				local bl = args[ 'bl' .. i ] or args[ '左邊框' .. i ] or args[ '左边框' .. i ]
				local br = args[ 'br' .. i ] or args[ '右邊框' .. i ] or args[ '右边框' .. i ]
				
				local maintd
				local maintdwkt = {}
				
				if type == "island" or type == "bay" or type == "wide" then
					bt = (bt or border.plt)
					bb = (bb or border.plt)
					bl = (bl or border.pltx)
					br = (br or border.pltx)
					if complex then
						tr:tag 'td'
							:css( 'border-top'   , bt )
							:css( 'border-left'  , bl )
							:css( 'border-bottom', bb )
							:css( 'background'   , bg )
						
						local line_u = data.lines[ args[ 'l' .. i-1 ]
										or args[ '綫' .. i-1 ] or args[ '線' .. i-1 ] or args[ '线' .. i-1 ]
										or '' ] or ''
						local pu = args[ 'pd' .. i-1 ] or args[ '下台' .. i-1 ] or ''
						local line_color_u = '#' .. (line_u.color or '000000')
						local rgb_u = { tonumber(string.sub(line_color_u, 2, 3), 16), tonumber(string.sub(line_color_u, 4, 5), 16), tonumber(string.sub(line_color_u, 6, 7), 16) }
						local text_color_u = (rgb_u[1]*0.299 + rgb_u[2]*0.587 + rgb_u[3]*0.114) > 186 and "black" or "white"
						-- out = out .. '<!-- ' .. rgb[1] .. ',' .. rgb[2] .. ',' .. rgb[3] .. ' -->'
						local pno_u = frame:expandTemplate{ title = '圆形编号', args = {pu, bg = line_color_u, fg = text_color_u} }
						
						local line_d = data.lines[ args[ 'l' .. i+1 ]
										or args[ '綫' .. i+1 ] or args[ '線' .. i+1 ] or args[ '线' .. i+1 ]
										or '' ] or ''
						local pd = args[ 'pu' .. i+1 ] or args[ '上台' .. i+1 ] or ''
						local line_color_d = '#' .. (line_d.color or '000000')
						local rgb_d = { tonumber(string.sub(line_color_d, 2, 3), 16), tonumber(string.sub(line_color_d, 4, 5), 16), tonumber(string.sub(line_color_d, 6, 7), 16) }
						local text_color_d = (rgb_d[1]*0.299 + rgb_d[2]*0.587 + rgb_d[3]*0.114) > 186 and "black" or "white"
						-- out = out .. '<!-- ' .. rgb[1] .. ',' .. rgb[2] .. ',' .. rgb[3] .. ' -->'
						local pno_d = frame:expandTemplate{ title = '圆形编号', args = {pd, bg = line_color_d, fg = text_color_d} }
						
						tr:tag 'td'
							:css( 'border-top'   , bt )
							:css( 'border-bottom', bb )
							:css( 'background'   , bg )
							:wikitext( pno_u .. '<br/>' .. pno_d )
						maintd = tr:tag 'td'
					else
						maintd = tr:tag 'td':attr( 'colspan', 5 )
					end
					maintd
						:cssText( 'font-size:smaller;text-align:center;' )
						:css    ( 'background'   , bg )
						:css    ( 'border-top'   , bt )
						:css    ( 'border-bottom', bb )
						:css    ( 'border-left'  , complex and 'none' or bl     )
						:css    ( 'border-right' , complex and 'none' or br     )
						:css    ( 'height'       , complex and '3rem' or '2rem' )
					if type ~= "wide" and future then
						table.insert( maintdwkt , "未啟用" )
					end
					if     type == "island" then
						table.insert( maintdwkt ,   '[[島式月台|島式-{zh-cn:站台;zh-tw:月台;zh-hk:月台}-]]'   )
					elseif type == "bay"    then
						table.insert( maintdwkt , '[[港灣式月台|港灣式-{zh-cn:站台;zh-tw:月台;zh-hk:月台}-]]' ) end
				elseif type == "side" or type == "split" or type == "narrow" then
					-- dir = dn
					bl = (bl or border.pltx)
					br = (br or border.pltx)
					if string.find(p, 'dn') ~= nil or string.find(p, '下') then
						bt = (bt or 'none')
						bb = (bb or border.plt)
					-- dir = up
					else
						bt = (bt or border.plt)
						bb = (bb or 'none')
					end
					if complex then
						tr:tag 'td'
							:css( 'border-top'   , bt )
							:css( 'border-left'  , bl )
							:css( 'border-bottom', bb )
							:css( 'background'   , bg )
						
						if string.find(p, 'dn') ~= nil or string.find(p, '下') ~= nil then
							local line_d = data.lines[ args[ 'l' .. i+1 ]
											or args[ '綫' .. i+1 ] or args[ '線' .. i+1 ] or args[ '线' .. i+1 ]
											or '' ] or ''
							local pd = args[ 'pu' .. i+1 ] or args[ '上台' .. i+1 ] or ''
							local line_color_d = '#' .. (line_d.color or '000000')
							local rgb_d = { tonumber(string.sub(line_color_d, 2, 3), 16), tonumber(string.sub(line_color_d, 4, 5), 16), tonumber(string.sub(line_color_d, 6, 7), 16) }
							local text_color_d = (rgb_d[1]*0.299 + rgb_d[2]*0.587 + rgb_d[3]*0.114) > 186 and "black" or "white"
							-- out = out .. '<!-- ' .. rgb[1] .. ',' .. rgb[2] .. ',' .. rgb[3] .. ' -->'
							tr:tag 'td'
								:css( 'border-top'   , bt )
								:css( 'border-bottom', bb )
								:css( 'background'   , bg )
								:wikitext( frame:expandTemplate{ title = '圆形编号', args = {pd, bg = line_color_d, fg = text_color_d} } )
						else
							local line_u = data.lines[ args[ 'l' .. i-1 ]
											or args[ '綫' .. i-1 ] or args[ '線' .. i-1 ] or args[ '线' .. i-1 ]
											or '' ] or ''
							local pu = args[ 'pd' .. i-1 ] or args[ '下台' .. i-1 ] or ''
							local line_color_u = '#' .. (line_u.color or '000000')
							local rgb_u = { tonumber(string.sub(line_color_u, 2, 3), 16), tonumber(string.sub(line_color_u, 4, 5), 16), tonumber(string.sub(line_color_u, 6, 7), 16) }
							local text_color_u = (rgb_u[1]*0.299 + rgb_u[2]*0.587 + rgb_u[3]*0.114) > 186 and "black" or "white"
							-- out = out .. '<!-- ' .. rgb[1] .. ',' .. rgb[2] .. ',' .. rgb[3] .. ' -->'
							tr:tag 'td'
								:css( 'border-top'   , bt )
								:css( 'border-bottom', bb )
								:css( 'background'   , bg )
								:wikitext( frame:expandTemplate{ title = '圆形编号', args = {pu, bg = line_color_u, fg = text_color_u} } )
						end
						maintd = tr:tag 'td'
					else
						maintd = tr:tag 'td':attr( 'colspan', 5 )
					end
					maintd
						:cssText( 'height:1.25rem;font-size:smaller;text-align:center;' )
						:css    ( 'background'   , bg )
						:css    ( 'border-top'   , bt )
						:css    ( 'border-bottom', bb )
						:css    ( 'border-left'  , complex and 'none' or bl )
						:css    ( 'border-right' , complex and 'none' or br )
					if type ~= "narrow" and future then
						table.insert( maintdwkt , "未啟用" )
					end
					if     type == "side"  then 
						table.insert( maintdwkt ,  '[[側式月台|側式-{zh-cn:站台;zh-tw:月台;zh-hk:月台}-]]'   )
					elseif type == "split" then 
						table.insert( maintdwkt ,'[[分離式月台|分離式-{zh-cn:站台;zh-tw:月台;zh-hk:月台}-]]' ) end
				end
				
				local d = args[ 'd' .. i ] or args[ '門' .. i ] or args[ '门' .. i ] or ''
				if     d == "左" then table.insert( maintdwkt , '開左邊车门' )
				elseif d == "右" then table.insert( maintdwkt , '開右邊车门' )
				elseif mw.ustring.match( d, "上[左右]下[左右]" ) then
					local str = mw.ustring.gsub( d, "上([左右])下([左右])",
						'<div style="display:inline-block;vertical-align:middle;line-height:1.2em;">↑開%1邊车门<br/>↓開%2邊车门</div>' 
					)
					table.insert( maintdwkt , str )
				elseif d ~= ''   then table.insert( maintdwkt , d )            end
				
				if text ~= '' then 
					table.insert( maintdwkt , text )
				end
				
				maintd:wikitext( table.concat( maintdwkt, " · ")  )
				
				if complex then 
					tr:tag 'td'
						:attr( 'colspan', '2' )
						:css ( "border-top"   , bt )
						:css ( "border-bottom", bb )
						:css ( "border-right" , br )
						:css ( "background"   , bg )
				end
			elseif group == "track" then
				
				-- unless above is platform pointing down, add bar
				local pg = args['g' .. i-1] or args['組' .. i-1] or args['组' .. i-1] or ''
				local pp = args['p' .. i-1] or args['類' .. i-1] or args['类' .. i-1] or ''
				local ng = args['g' .. i+1] or args['組' .. i+1] or args['组' .. i+1] or ''
				local common = mw.ustring.match( g, "[c共]" ) ~= nil
				local nextcom = mw.ustring.match( ng , "[c共]" ) ~= nil
				if i == 1 or ((mw.ustring.match(pg, '[p台]') ~= nil) and ((
						(string.find(pp, 'dn') ~= nil or string.find(pp, '下') ~= nil)
						and (  string.find(pp, 'side')   ~= nil or mw.ustring.match(pp, '[側侧]') ~= nil
							or string.find(pp, 'split')  ~= nil or mw.ustring.match(pp, '[離离]') ~= nil
							or string.find(pp, 'narrow') ~= nil or mw.ustring.match(pp, '[窄]')   ~= nil)
					) or (
						   string.find(pp, 'island') ~= nil	or mw.ustring.match(pp, '[島岛]') ~= nil
						or string.find(pp, 'bay')    ~= nil	or mw.ustring.match(pp, '[灣湾]') ~= nil
						or string.find(pp, 'wide')   ~= nil	or mw.ustring.match(pp, '[闊阔]') ~= nil
					))
					) or common then -- do nothing
				else style = style .. 'border-top:' .. border.trk end
				
				-- get line info
				local l = args[ 'l' .. i ] or args[ '綫' .. i ] or args[ '線' .. i ] or args[ '线' .. i ] or ''
				local line = data.lines[l] or ''
				
				-- platform number
				local p = args[ 'p' .. i ] or args[ '台' .. i ] or ''
				local line_color = '#' .. (line.color or '000000')
				local rgb = { tonumber(string.sub(line_color, 2, 3), 16), tonumber(string.sub(line_color, 4, 5), 16), tonumber(string.sub(line_color, 6, 7), 16) }
				local text_color = (rgb[1]*0.299 + rgb[2]*0.587 + rgb[3]*0.114) > 186 and "black" or "white"
				-- out = out .. '<!-- ' .. rgb[1] .. ',' .. rgb[2] .. ',' .. rgb[3] .. ' -->'
				local pno = haspno and frame:expandTemplate{ title = '圆形编号', args = {p, bg = line_color, fg = text_color} } or ''
				local pno_blnk = haspno and frame:expandTemplate{ title = '圆形编号', args = {''} } or ''
				
				local pl = args[ 'pl' .. i ] or ''
				local pno_l = haspno and frame:expandTemplate{ title = '圆形编号', args = {pl, bg = line_color, fg = text_color} } or ''
				local pr = args[ 'pr' .. i ] or ''
				local pno_r = haspno and frame:expandTemplate{ title = '圆形编号', args = {pr, bg = line_color, fg = text_color} } or ''
				if pl == '' or pr == '' then pno_l = pno; pno_r = pno end
				local pu = args[ 'pu' .. i ] or args[ '上台' .. i ] or args[ '上号' .. i ] or ''
				local pd = args[ 'pd' .. i ] or args[ '下台' .. i ] or args[ '下号' .. i ] or ''
				
				-- arrow direction
				local al = (args[ 'al' .. i ] or args[ '左箭' .. i ] or ''):upper()
				if     al ~= '' and mw.ustring.match(al,'[l左]') then al = "L"
				elseif al ~= '' and mw.ustring.match(al,'[r右]') then al = "R"
				elseif mw.ustring.match(g, '[l左]') and al == '' then al = "L" end
				local arrow_l = frame:expandTemplate{ title = 'Arrow', args = {al or "L"} }
				local ar = (args[ 'ar' .. i ] or args[ '右箭' .. i ] or ''):upper()
				if     ar ~= '' and mw.ustring.match(ar,'[l左]') then ar = "L"
				elseif ar ~= '' and mw.ustring.match(ar,'[r右]') then ar = "R"
				elseif mw.ustring.match(g, '[r右]') and ar == '' then ar = "R" end
				local arrow_r = frame:expandTemplate{ title = 'Arrow', args = {ar or "R"} }
				
				local merge_down = string.find(g, 'md') -- unused
				local merge_up   = string.find(g, 'mu') -- unused
				
				-- if (args[ 'p' .. i ] or args[ 'pl' .. i ] or args[ 'pr' .. i ])
				-- 	and not (args[ 'pu' .. i ] or args[ 'pd' .. i ]) then
				-- 	local np = args[ 'p' .. i+1 ] or ''
				-- 	if pp == 'side-dn' or pp == 'split-dn' or pp == 'narrow-dn'
				-- 		or pp == 'island' or pp == 'bay' or pp == 'wide' then pu = (al ~= "" and "l" or "r")
				-- 	elseif string.find(np, 'side') or string.find(np, 'split') or string.find(np, 'narrow')
				-- 		or np == 'island' or np == 'bay' or np == 'wide' then pd = (al ~= "" and "l" or "r") end
				-- end
				
				-- track text
				local linetitle = line ~= '' and line.title or l
				if data.lines['_default'] and data.lines['_default'].title and not line.title then
					linetitle = mw.ustring.gsub(data.lines['_default'].title, '%%1', l)
				end
				
				local ttxt = {}
				local pre = (future and '未來' or '') .. (l ~= '' and linetitle or '')
				local d1  = args[ 'd' .. i .. 'd1' ] or args[ 'd' .. i            ] or args[ '往' .. i          ] or ''
				local d1x = args[ 'd' .. i .. 'd1x'] or args[ 'd' .. i .. 'x'     ] or args[ '往' .. i .. 'x'   ] or ''
				local d2  = args[ 'd' .. i .. 'd2' ] or args[ '及往' .. i         ]                               or ''
				local d2x = args[ 'd' .. i .. 'd2x'] or args[ '及往' .. i .. 'x'  ]                               or ''
				local df  = args[ 'd' .. i .. 'f'  ] or args[ '未來往' .. i       ] or args[ '未来往' .. i      ] or ''
				local df2 = args[ 'd' .. i .. 'f2' ] or args[ '未來及往' .. i     ] or args[ '未来及往' .. i    ] or ''
				local n1  = args[ 'n' .. i .. 'd1' ] or args[ 'n' .. i            ] or args[ '下站' .. i        ] or ''
				local n1x = args[ 'n' .. i .. 'd1x'] or args[ 'n' .. i .. 'x'     ] or args[ '下站' .. i .. 'x' ] or ''
				local n2  = args[ 'n' .. i .. 'd2' ] or args[ '另下站' .. i       ]                               or ''
				local n2x = args[ 'n' .. i .. 'd2x'] or args[ '另下站' .. i ..'x' ]                               or ''
				local nf  = args[ 'n' .. i .. 'f'  ] or args[ '未來下站' .. i     ] or args[ '未来下站' .. i    ] or ''
				local nf2 = args[ 'n' .. i .. 'f2' ] or args[ '未來另下站' .. i   ] or args[ '未来另下站' .. i  ] or ''
				local dest1 = station(data, d1); local dest2 = station(data, d2);
				local next1 = station(data, n1); local next2 = station(data, n2);
				local destf = station(data, df); local nextf = station(data, nf);
				local destf2 = station(data, df2); local nextf2 = station(data, nf2)
				
				local bound = '' -- unused
				-- unused
				-- if     bound ~= nil									  then bound = bound
				-- elseif type(line.up) == 'string' and line.up    == d1 then bound = '上行'
				-- elseif type(line.up) == 'table'  and line.up[1] == d1 then bound = '上行' 
				-- elseif type(line.dn) == 'string' and line.dn    == d1 then bound = '下行' 
				-- elseif type(line.dn) == 'table'  and line.dn[1] == d1 then bound = '下行' end
				
				-- if (((type(line.up) == 'string') and line.up or line.up[1]) == dest1)
				-- 	or ((line.future and (type(line.future.up) == 'string') and line.future.up or line.future.up[0]) == dest1) then
				-- 	bound = '上行'
				-- elseif (((type(line.dn) == 'string') and line.dn or line.dn[1]) == dest1)
				-- 	or ((line.future and (type(line.future.dn) == 'string') and line.future.dn or line.future.dn[0]) == dest1) then
				-- 	bound = '下行'
				-- end
				local to = '往'
				if mw.ustring.match( dest1, '[内內外][圈環环]' ) then to = '' end
				if dest1 ~= '' and next1 ~= '' and next2 ~= '' and ((system == 'MTR' or system == "港鐵") and n2 == '馬場') then
					ttxt = { to, dest1, d1x
						   , (dest2 ~= '' and ('及' .. dest2 .. d2x) or '')
						   , '<small>(', next1, n1x, '/', next2, n2x, ')</small>' }
				elseif dest1 ~= '' and next1 ~= '' and dest2 ~= '' and next2 ~= '' then
					ttxt = { to, dest1, d1x, '<small>(', next1, n1x,
							((destf == '' and nextf ~= '')
								and '<span style="opacity:60%"> · ' .. '未來:' .. nextf .. '</span>'
								or ''
							) , ')</small>'
						   , '或', dest2, d2x, '<small>(', next2, n2x,
							((destf2 == '' and nextf2 ~= '')
								and '<span style="opacity:60%"> · ' .. '未來:' .. nextf2 .. '</span>'
								or ''
							), ')</small>' }
				elseif dest1 ~= '' and next1 ~= '' and dest2 ~= '' then
					ttxt = { to, dest1, d1x
						   , '及', dest2, d2x
						   , '<small>(', next1, n1x
						   , ((destf == '' and nextf ~= '')
						   		and '<span style="opacity:60%"> · ' .. '未來:' .. nextf .. '</span>'
						   		or ''
						   	), ')</small>' }
				elseif dest1 == '' and dest2 == '' and text ~= '' then 
					ttxt = { '' }
				elseif dest1 == term then
					ttxt = { dest1 }
				else
					ttxt = { to, (dest1 or '{{{d'..i..'}}}'), d1x
						   , '<small>(', (next1 or '{{{n'..i..'}}}'), n1x
						   , ((destf == '' and nextf ~= '')
						   		and '<span style="opacity:60%"> · ' .. '未來:' .. nextf .. '</span>'
						   		or ''
						   	), ')</small>' }
				end
				
				if destf ~= '' then
					local ftxt = { ' · <span style="opacity:60%">'
								 , '未來' -- , (l ~= '' and (line ~= '' and line.title or l) or '')
								 , '往'  , (destf or '{{{d'..i..'f}}}')
								 , '<small>(', (nextf or '{{{n'..i..'f}}}') .. ')</small></span>' }
					for j = 1, #ftxt, 1 do
						ttxt[ #ttxt+1 ] = ftxt[ j ]
					end
				end
				
				table.insert( ttxt, 1, pre )
				ttxt[ #ttxt+1 ] = text
				
				-- set left cell
				tr:tag 'td':cssText( "text-align:left;width:21px" )
					:css( 'visibility', ( al == '' or al == '/' ) and 'hidden' or nil )
					:css( 'padding', common and "0 3px 3px" or 
									 nextcom and "3px 3px 0" or "3px" )
					:wikitext( arrow_l )
				local td2 = tr:tag 'td':cssText( "text-align:left;width:21px" )
					:css( 'padding', common and "0 3px 3px" or 
									 nextcom and "3px 3px 0" or "3px" )
				if al == '' or (complex and (pu ~= '' or pd ~= '')) then
					td2 :css( 'visibility', 'hidden' )
						:wikitext( pno_blnk )
				else
					td2 :wikitext( pno_l or pno_blnk )
				end
				-- set center cell
				tr:tag 'td':css( 'text-align', 'center')
					:css( 'padding', common and "0 3px 3px" or 
									 nextcom and "3px 3px 0" or "3px" )
					:wikitext( table.concat( ttxt ) )
				-- set right cell
				local td4 = tr:tag 'td':cssText( "text-align:right;width:21px" )
					:css( 'padding', common and "0 3px 3px" or 
									 nextcom and "3px 3px 0" or "3px" )
				if ar == '' or (complex and (pu ~= '' or pd ~= '')) then
					td4 :css( 'visibility', 'hidden')
						:wikitext( pno_blnk )
				else
					td4 :wikitext( pno_r or pno_blnk )
				end
				tr:tag 'td':cssText( "text-align:left;width:21px" )
					:css( 'padding', common and "0 3px 3px" or 
									 nextcom and "3px 3px 0" or "3px" )
					:css( 'visibility', ( ar == '' or ar == '/' ) and 'hidden' or nil )
					:wikitext( arrow_r )
				
			elseif group == "text" then
				local cstyle = args[ 'cstyle' .. i ] or ''
				tr:tag 'td':attr( 'colspan', '5' ):css( 'text-align', 'center' )
					:css( 'padding', string.match( text, "月台出口" ) ~= nil and "0" or "3px" )
					:cssText( cstyle )
					:wikitext( text )
			end
			
			local app = args[ 'ap' .. i ] or ''
			local aps = args[ 'ap' .. i .. 's' ] or ''
			if append then tr:tag 'td':cssText( aps ) :wikitext( app ) end
			
			tr:cssText( style )
		end
	end
	out:wikitext(frame:extensionTag {name = 'templatestyles', args = {src = 'Template:車站構造/style.css'}})
	return out
end
return p