Modulo:Navbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
sistema per evitare problemi quando attorno ai {{,}} vengono inseriti degli spazi o andate a capo
Riga 80:
table.sort(ret)
return ret
end
 
-- Toglie eventuali spazi/a capo dannosi attorno ai {{,}}
local function trimSep(list)
local sep = mw.getCurrentFrame():expandTemplate{title=","}
local sepEsc = mw.ustring.gsub(sep, '-', '%-')
return mw.ustring.gsub(list, '%s*' .. sepEsc .. '%s*', sep)
end
 
Line 239 ⟶ 246:
-- listN
if self.args['list' .. id] then
local list = trimSep(self.args['list' .. id])
if (id % 2) == 0 then
altStyle = self.args.evenstyle
Line 255 ⟶ 263:
:cssText(altStyle)
:cssText(self.args['list' .. id .. 'style'])
:wikitext(self.args['list' .. id])
end
if id == 1 and self.args.image then
Line 315 ⟶ 323:
for _, id in ipairs(listIds) do
local trNode = self.tableNode:tag('tr')
local list = trimSep(self.args['list' .. id])
-- i groupN sono visibili solo se c'è la corrispettiva listN
if self.args['group' .. id] then
Line 332 ⟶ 341:
:cssText(self.args.liststyle)
:cssText(altStyle)
:wikitext(self.args['list' .. id])
end
end