模組:Sandbox/H78c67c/jp-station
模組解[開]
你可能想去為呢個Scribunto module開一個解版。 編者可以響呢個模組嘅沙盤 (開 | 鏡)同埋試例 (開)版度試驗佢。 請加個類到個/doc嘅細版度。 呢個模組嘅細版。 |
local p = {}
local base = "Module:Sandbox/H78c67c/jp-station"
local text = mw.loadData(base .. "/text")
local data = mw.loadData(base .. "/data")
function makeinfobox(frame)
local title = frame.args[1]
local qid = data.qid[frame.args[1]]
local names = data.names[title]
local name = {names[1] .. "站", names[2] .. "駅", names[3] .. "えき", names[4] .. " eki"}
local infobox = frame:expandTemplate{ title = "日本車站明細", args = {
["公司色"] = "green",
["站名"] = name[1],
["日文原名"] = names[2],
["平假名"] = names[3],
["羅馬拼音"] = names[4],
["所屬公司"] = "[[" .. text.companies["e"] .. "旅客鐵道]](JR" .. text.companies["e"] .. ")"
} }
return infobox
end
function makeintro(frame)
local title = frame.args[1]
local qid = data.qid[frame.args[1]]
local names = data.names[title]
local name = {names[1] .. "站", names[2] .. "駅", names[3] .. "えき", names[4] .. " eki"}
local jpn = frame:expandTemplate{ title = 'jpn', args = { j = name[2], hg = name[3], rm = name[4], f = "y" } }
local company = text.companies["e"]
local line = "上越線"
local prefecture = "群馬縣"
local town = "利根郡]][[水上町"
return mw.ustring.format(text.intro, name[1], jpn, company, company, line, prefecture, town)
end
function p.main(frame)
local infobox = makeinfobox(frame)
local intro = makeintro(frame)
return infobox .. intro
end
return p