Module:Shiny button

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search

Implements {{Shiny button}}


-- Implements {{Shiny button}}
-- Stylized clickable button

-- package name and formating
local p = {}
local format = mw.ustring.format
local getArgs = require('Module:Arguments').getArgs

-- main function
p.main = function(frame)
    args = getArgs(frame)
    return p._main(args)
end

-- backup function
function p._main(args)
    style = mw.getCurrentFrame():extensionTag('templatestyles', '', {src='Module:Shiny button/style.css'})
    specific_style = args.style or args[2] or 'background-color: navy'
    if args.link then
        return format('%s <span class="btn" style="%s;">[[%s]]</span>', style, specific_style, args.link)
    elseif args.replacement then
        return format('%s <span class="btn" style="%s;">[[:%s|%s]]</span>', style, specific_style, args.link, args.replacement)
    else
        return  format('%s <span class="btn" style="%s;">%s</span>', style, specific_style, args[1])
end
end
-- return package
return p