模組:月台配置

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

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

注意:本模板使用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 black';
				pltx = 'solid 2px black';
				trk  = 'solid 1px 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