Bu modulun sənədləşdirmə səhifəsi Modul:Cdx-button/doc səhifəsində yaradıla bilər
local p = {}
local function parse_action(action)
local tab = {
['progressive'] = 'progressive',
['proqressiv'] = 'progressive',
['göy'] = 'progressive',
['mavi'] = 'progressive',
['blue'] = 'progressive',
['destructive'] = 'destructive',
['destruktiv'] = 'destructive',
['qırmızı'] = 'destructive',
['red'] = 'destructive'
}
return tab[action] or 'default'
end
local function parse_weight(weight)
local tab = {
['primary'] = 'primary',
['əsas'] = 'primary',
['quiet'] = 'quiet',
['sakit'] = 'quiet',
['səssiz'] = 'quiet',
}
return tab[weight] or 'normal'
end
local function parse_size(size)
local tab = {
['small'] = 'small',
['kiçik'] = 'small',
['balaca'] = 'small',
['large'] = 'large',
['böyük'] = 'large',
['yekə'] = 'large'
}
return tab[weight] or 'medium'
end
local function parse_enabled(enabled)
return require('Modul:Yesno')(enabled or true) and 'enabled' or 'disabled'
end
function p._main(args)
local content = args[1] or args['məzmun']
local action = 'cdx-button--action-' .. parse_action(args[2] or args['action'] or args['feil'] or args['hərəkət'] or args['rəng'] or args['color'])
local weight = 'cdx-button--weight-' .. parse_weight(args[3] or args['weight'] or args['çəki'])
local size = 'cdx-button--size-' .. parse_size(args[4] or args['size'] or args['ölçü'])
local enabled = 'cdx-button--fake-button--' .. parse_enabled(args[5] or args['enabled'] or args['aktiv'])
local button = mw.html.create('span')
:addClass('cdx-button')
:addClass(action)
:addClass(weight)
:addClass(size)
:addClass(enabled)
:wikitext(content)
return tostring(button)
end
function p.main(frame)
return p._main(frame:getParent().args)
end
return p