「モジュール:Navbox/former/sandbox」の版 間 の差分
m |
Navbox with collapsible groupsを |
||
1
local p = {}
--[[
61
Define Arguments
]]
local args = {}
local border
local child, none = false, false
local collapsible = ''
local colspan, rowspan = 0, 0
local basestyle = ''
local bdcolor, trborder = '', ''
local odd, even = 'odd', 'even'
local list, liststyle = {}, {}
local group, groupstyle = {}, {}
local colheader, colheadercolspan, colheaderstyle = {}, {}, {}
local col, colstyle, colwidth = {}, {}, {}
local colfooter, colfootercolspan, colfooterstyle = {}, {}, {}
local abbr, state = {}, {}
local sect, section = {}, {}
local secttitlestyle = {}
local content, contentstyle = {}
local image, imageleft = {}, {}
local result = '' --
local function defArgs(frame)
args = require('Module:Arguments').getArgs(frame, {parentOnly = true})
border = args.border or args[1]
69 ⟶ 90
colspan = 2 + (args.imageleft and 1 or 0) + (args.image and 1 or 0)
if args.basestyle then basestyle = args.basestyle .. ';' end
bdcolor = args.style and string.match(args.style, 'background.-:(.-);') or '#fff' --ボーダー
trborder = '<tr style="border-width:2px;border-style:solid none;border-color:' .. bdcolor .. '">' --ボーダーつきtr
--common
list = function(num, v) list[num] = '\n' .. v end,
liststyle = function(num, v) liststyle[num] = v end,
group = function(num, v) group[num] = v end,
groupstyle = function(num, v) groupstyle[num] = v end,
--for with_columns
colheader = function(num,v) colheader[num] = v end,
colheadercolspan = function(num,v) colheadercolspan[num] = v end,
colheaderstyle = function(num,v) colheaderstyle[num] = v end,
col = function(num,v) col[num] = v end,
colstyle = function(num,v) colstyle[num] = v end,
colwidth = function(num,v) colwidth[num] = v end,
colfooter = function(num,v) colfooter[num] = v end,
colfootercolspan = function(num,v) colfootercolspan[num] = v end,
colfooterstyle = function(num,v) colfooterstyle[num] = v end,
--for with_collapsible_groups
abbr = function(num, v) abbr[num] = v end,
state = function(num, v) state[num] = v end,
sect = function(num, v) group[num] = v end,
section = function(num, v) group[num] = v end,
secttitlestyle = function(num, v) groupstyle[num] = v end,
content = function(num, v) list[num] = '\n' .. v end,
contentstyle = function(num, v) liststyle[num] = v end,
image = function(num, v) image[num] = v end,
imageleft = function(num, v) imageleft[num] = v end,
}
for k, v in pairs(args) do
str1, num, str2 = str1 or '', tonumber(num), str2 or ''
if switch[str1 .. str2] and num then switch[str1 .. str2](num, v) end
end
rowspan = (#list - 1) * 2 - 1
end
263 ⟶ 291
function p.with_columns(frame)
defArgs(frame)
top()
if args.title then title() end
336 ⟶ 346
function p.with_collapsible_groups(frame)
defArgs(frame)
top()
if args.title then title() end
if args.above then above() end
local i = 1
local function funcList()
local collapsible = (args.selected == abbr[i] or args.selected == group[i]) and '' or 'collapsible '
args.name = nil
args.state = collapsible .. (state[i] or 'collapsed')
379 ⟶ 364
result = result .. '<td style="' .. (args.groupwidth and '' or 'width:100%;') .. 'padding:0;' .. (args.liststyle or '') .. ';' .. (odd == 'odd' and (args.oddstyle or '') or (args.evenstyle or '')) .. ';' .. (liststyle[i] or '') .. '" class="navbox-list navbox-' .. (args.evenodd == 'swap' and even or args.evenodd or odd) .. ' ' .. (args.listclass or '') .. '"><div>'
if args.title then
none = true
top()
392 ⟶ 376
--i = 1
result = result .. trborder
if args.imageleft then
406 ⟶ 389
result = result .. trborder
i = j
list[1], list[i] = list[i], nil
funcList()
end
|