Изменения

Модуль:Кнопка

1359 байтов добавлено, 13:05, 6 августа 2016
Новая страница: «local p = {} p.keys = function( f ) local args = f if f == mw.getCurrentFrame() then args = f:getParent().args end local keys = {} for _, key in ipairs(…»
local p = {}
p.keys = function( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
local keys = {}

for _, key in ipairs( args ) do
key = mw.text.trim( key )
if key ~= '+' and key:find( '%+' ) then
local comboKeys = {}
for comboKey in mw.text.gsplit( key, '%s*%+%s*' ) do
table.insert( comboKeys, p.key( comboKey ) )
end
table.insert( keys, table.concat( comboKeys, '+' ) )
else
table.insert( keys, p.key( key ) )
end
end

return table.concat( keys )
end
p.key = function( key )
if not key then
return ''
end

local symbols = mw.loadData( 'Модуль:Кнопка/Символы' )
return '<kbd class="keyboard-key nowrap" style="' .. table.concat( {
'border: 0.1em solid #AAA',
'border-radius: 0.2em',
'box-shadow: 0.1em 0.2em 0.2em(#DDD)',
'background-color: #F9F9F9',
'background-image: -moz-linear-gradient(#EEE, #F9F9F9, #EEE)',
'background-image: -ms-linear-gradient(#EEE, #F9F9F9, #EEE)',
'background-image: -o-linear-gradient(#EEE, #F9F9F9, #EEE)',
'background-image: -webkit-linear-gradient(#EEE, #F9F9F9, #EEE)',
'background-image: linear-gradient(#EEE, #F9F9F9, #EEE)',
'padding: 0.1em 0.3em',
'font-family: inherit',
'font-size: 0.85em'
}, ';' ) .. '">' .. ( symbols[key:lower()] or key ) .. '</kbd>'
end
return p