「モジュール:Infobox/former」の版間の差分

本体列をソート
template>Waiesu
編集の要約なし
template>Waiesu
(本体列をソート)
10行目: 10行目:
local child = (args.child == 'yes')
local child = (args.child == 'yes')
local h = {subheader = {}, image = {{}}}
local h = {subheader = {}, image = {{}}}
local body = {}
local body, sbody = {}, {}
local link = args.tnavbar or args.name
local link = args.tnavbar or args.name
local result = ''
local result = ''
58行目: 58行目:
local str, num = string.match(k, '^(%D+)(%d+)$')
local str, num = string.match(k, '^(%D+)(%d+)$')
num = tonumber(num)
num = tonumber(num)
body[num] = body[num] or {}
body[num] = body[num] or {num}
body[num][str] = v
body[num][str] = v
end
end
104行目: 104行目:
end
end
--ソート
for k, v in pairs(body) do
for k, v in pairs(body) do
sbody[#sbody + 1] = v
end
table.sort(sbody,
function (a, b) return a[1] < b[1] end
)
for k, v in ipairs(sbody) do
result = result .. row(v.header, args.headerstyle, v.label, args.labelstyle, v.data, args.datastyle, v.class, v.rowclass, v.id, v.itemprop, v.rowitemprop, v.itemtype, v.rowitemtype, v.itemref, v.rowitemref)
result = result .. row(v.header, args.headerstyle, v.label, args.labelstyle, v.data, args.datastyle, v.class, v.rowclass, v.id, v.itemprop, v.rowitemprop, v.itemtype, v.rowitemtype, v.itemref, v.rowitemref)
end
end
匿名利用者