Modulo:Discendenza/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 21:
local resto = 0
local nx,px
while (dati[n]) do n = n+1 end
n = n-1
for m=4,n,4 do
nx = tonumber(dati[m-3])
Line 193 ⟶ 191:
local function mostraX(pid,allinea,largo,dida)
local xy = massimoXY(pid, {0, 0})▼
local posx = {}
local n1
Line 199 ⟶ 196:
local riga = {}
local xx, xp
local stileDiv = { ['width'] = largo..'px', ['padding'] = '3px', ['background'] = '#FFF', ['border'] = '1px solid #C8CCD1' }
▲ local xy = massimoXY(pid, {0, 0})
local lg = math.floor(100/(xy[1]+2))
if (lg == 0) then lg = 1 end▼
local bDiv = mw.html.create('div')
if (allinea == 'destra') then
bDiv:css(stileDiv)
stileTabella['margin'] = '10px auto'
▲ agg('<table cellpadding="1" cellspacing="0" border=0 style="border-collapse:separate;text-align:center;font-size:95%;line-height:105%;margin:0px auto">')
end
local
▲ if (lg == 0) then lg = 1 end
for n=1,xy[2] do
local riga1 = mw.html.create('tr')
local riga2 = mw.html.create('tr')
local riga3 = mw.html.create('tr')
posx[1] = 0; posx[2] = 0; posx[3] = 0
n1 = 0
for _, v in pairs(tabella[n]) do
xx = pers[v].x
xp = pers[v].padre
if (n==1) then
for m=1,(xy[1]+2) do
local bCol1 = mw.html.create('td'):css('width',lg..'%')
riga1:node(bCol1)
end▼
else
local bCol1 = mw.html.create('td')
:cssIf(n1 == xp,'border-top','1px solid #000')
:attrIf(xx-posx[1]>0
▲ )
:wikitext(' ')
n1 = xp
posx[1] = xx + 1
end
if (xx-posx[2]>0) then
local bCol2 = mw.html.create('td')
:attrIf(xx-posx[2]>1
:wikitext(' ')
riga2:node(bCol2)
end
local bCol2 = mw.html.create('td')
:attr('colspan','2')
riga2:node(bCol2)
▲ end
posx[2] = xx + 2
if (n<xy[2]) then
if (#pers[v].figli > 0) then
local bCol3 = mw.html.create('td')
:css('border-right','1px solid #000')
:attrIf(xx-posx[3]>0
:wikitext(' ')
posx[3] = xx + 1
riga3:node(bCol3)
end
end
end
bTabella:node(riga1)
bTabella:node(riga2)
bTabella:node(riga3)
▲ if (n<xy[2]) then table.insert(riga[3],'</tr>') end
end
bDiv:node(bTabella)
if (allinea == 'destra' and not dida=='') then
local bDida = mw.html.create('p')
:wikitext(dida)
bDiv:node(bDida)
end
return tostring(bDiv)
end
|