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

編集の要約なし
template>Waiesu
編集の要約なし
template>Waiesu
編集の要約なし
9行目: 9行目:
local args = require('Module:Arguments').getArgs(frame, {parentOnly = true})
local args = require('Module:Arguments').getArgs(frame, {parentOnly = true})
local child = (args.child == 'yes')
local child = (args.child == 'yes')
local h = {subheader = {{}}, image = {{}}}
local h = {subheader = {}, image = {{}}}
local body = {}
local body = {}
local link = args.tnavbar or args.name
local link = args.tnavbar or args.name
15行目: 15行目:
local function args2tbl(str, k, v)
local function args2tbl(str, k, v)
if string.match(k, str .. '$') then
local num = string.match(k, '%d*$')
h[str][1] = {v}
num = (num == '') and 1 or tonumber(num)
h[str][num] = h[str][num] or {}
if k == str then
h[str][1][1] = v
elseif string.match(k, str .. '%d+') then
elseif string.match(k, str .. '%d+') then
local num = tonumber(string.match(k, '%d*$'))
h[str][num][1] = v
h[str][num] = {v}
elseif string.find(k, 'style') then
elseif string.find(k, 'style') then
if string.match(k, 'style$') then
if string.match(k, 'style$') then
h[str]['style'] = v
h[str]['style'] = v
else
else
local num = tonumber(string.match(k, '%d*$'))
h[str][num]['style'] = v
h[str][num]['style'] = v
end
end
31行目: 32行目:
h[str]['rowclass'] = v
h[str]['rowclass'] = v
else
else
local num =tonumber(string.match(k, '%d*$'))
h[str][num]['rowclass'] = v
h[str][num]['rowclass'] = v
end
end
104行目: 104行目:
end
end
for k, v in ipairs(body) do
for k, v in pairs(body) 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
匿名利用者