Modulo:Scacchiera: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m Annullata la modifica 70153086 di Mess (discussione) |
chaturanga |
||
Riga 2:
local function image_square( pc, row, col, size )
}
local symnames = {
Riga 49:
x8 = 'otto',
x9 = 'nove',
}
local color = mw.ustring.gsub( pc, '^.*(%w)(%w).*$', '%2' ) or ''
local piece = mw.ustring.gsub( pc, '^.*(%w)(%w).*$', '%1' ) or ''
Riga 56:
if colornames[color] and piecenames[piece] then
else
end
local function innerboard(args, size, rev, background)
local root = mw.html.create('div')▼
local bg_filename = ''
root:addClass('chess-board')▼
if background == 'chaturanga' then
:css('position', 'relative')▼
bg_filename = 'Chaturanga489.png'
:wikitext(string.format( '[[File:Chessboard480.svg|%dx%dpx|link=]]', 8 * size, 8 * size ))▼
else
bg_filename = 'Chessboard480.svg'
end
▲
for trow = 1,8 do
local row = rev and trow or ( 9 - trow )
Riga 79 ⟶ 87:
local img = image_square(piece:match('%w%w'), row, col, size )
root:tag('div')
end
end
Riga 93 ⟶ 101:
end
function chessboard(args, size, rev, letters, numbers, header, footer, align, clear, background)
function letters_row( rev, num_lt, num_rt )
local letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}
local root = mw.html.create('')
if num_lt then
end
for k = 1,8 do
end
if num_rt then
end
return tostring(root)
Riga 127 ⟶ 135:
local root = mw.html.create('div')
local div = root:tag('div')
local b = div:tag('table')
if ( letters_tp ) then
b:tag('tr')
end
local tablerow = b:tag('tr'):css('vertical-align','middle')
if ( numbers_lt ) then
end
local td = tablerow:tag('td')
if ( numbers_rt ) then
end
if ( numbers_lt or numbers_rt ) then
Riga 177 ⟶ 185:
local idx = rev and trow or ( 9 - trow )
tablerow = b:tag('tr')
if ( numbers_lt ) then
end
if ( numbers_rt ) then
end
end
Riga 196 ⟶ 204:
if ( letters_bt ) then
b:tag('tr')
end
if (footer and footer ~= '') then
return tostring(root)
Riga 261 ⟶ 269:
local clear = args.clear or pargs.clear or ( align:match('tright') and 'right' ) or 'none'
local fen = args.fen or pargs.fen
local background = args.background or pargs.background or 'checks'
size = mw.ustring.match( size, '[%d]+' ) or '26' -- remove px from size
Riga 268 ⟶ 277:
header = args.header or pargs.header or ''
footer = args.footer or pargs.footer or ''
return chessboard( convertFenToArgs( fen ), size, reverse, letters, numbers, header, footer, align, clear, background)
end
if args[3] then
return chessboard(args, size, reverse, letters, numbers, header, footer, align, clear, background)
else
return chessboard(pargs, size, reverse, letters, numbers, header, footer, align, clear, background)
end
end
|