Modulo:Navbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
aggiornato all'uso degli apici singoli, virgolette e singolo underscore |
gestione sezioni, v. Discussioni_template:Navbox#Sezioni |
||
Riga 58:
table.sort(ret)
return ret
end
-- Ritorna l'array degli N dei groupN e/o listN presenti, ordinato e senza doppioni
local function getIds(args)
local ret = {}
for k, _ in pairs(args) do
local id = k:match('^list(%d+)$') or k:match('^group(%d+)$')
local found = false
id = tonumber(id)
for _, v in ipairs(ret) do
if v == id then
found = true
break
end
end
if not found then table.insert(ret, id) end
end
end
table.sort(ret)
return ret
end
Line 196 ⟶ 217:
function Navbox:_addLists()
local
local thStyle = {
background = '#ddf',
Line 203 ⟶ 224:
['font-size'] = '90%'
}
-- crea una
for _, id in ipairs(
local trNode = self.tableNode:tag('tr')
-- groupN
if self.args['group' .. id] then
trNode:tag('th')
:css(thStyle)
:cssText(self.args.groupstyle)
Line 215 ⟶ 237:
:wikitext(self.args['group' .. id])
end
-- listN
▲ if (id % 2) == 0 then
if (id % 2) == 0 then
altBackground = '#f7f7f7'▼
else▼
▲ altBackground = '#f7f7f7'
▲ altStyle = self.args.oddstyle
▲ else
altBackground = nil▼
altStyle = self.args.oddstyle
▲ altBackground = nil
end
trNode:tag('td')▼
:css('width', '100%')▼
:css('font-size', '90%')▼
:css('text-align', self.args['group' .. id] and 'left' or 'center')
:css('background', altBackground)▼
:cssText(self.args.liststyle)▼
:cssText(altStyle)▼
:cssText(self.args['list' .. id .. 'style'])▼
:wikitext(self.args['list' .. id])▼
end
▲ trNode:tag('td')
▲ :attr('colspan', self.args['group' .. id] and '1' or '2')
▲ :css('width', '100%')
▲ :css('font-size', '90%')
▲ :css('text-align', self.args['group' .. id] and 'left' or 'center')
▲ :css('background', altBackground)
▲ :cssText(self.args.liststyle)
▲ :cssText(altStyle)
▲ :cssText(self.args['list' .. id .. 'style'])
▲ :wikitext(self.args['list' .. id])
if id == 1 and self.args.image then
self:_addImage(trNode, #
end
end
|