Modul:Bingkai/kotak pasir
Penampilan
require('strict')
local p = {} --p stands for package
local getArgs = require('Module:Arguments').getArgs
local make_style_string = require('Module:Optional style').make_style_string
local CSS_unit = require('Module:unit CSS')._CSS_unit
function p.border_start(frame)
local args = getArgs(frame)
-- style args
local maxwidth = args['lebar_maksimum'] or args.maxwidth or args[2] or 'none'
local display = args.display or 'block'
local bstyle = args.bstyle or args[3] or 'solid'
local bthickness = args.bthickness or args[4] or '1px'
local color = args.color or args[5] or '#000000'
local bgcolor = args.bgcolor or args[6] or '#FFFFFF'
local align = args.align or args[7] or 'left'
local position = args.position or args[8]
local padding = args.padding or args[9] or '5px'
local style = args.style or ''
local positionStyle
if position == 'left' then
positionStyle = ''
elseif position == 'right' then
positionStyle = 'position:relative;margin-left:auto;'
else
positionStyle = 'margin-left:auto;margin-right:auto;'
end
local styleArgs = {
['lebar_maksimum'] = maxwidth,
['paparan'] = display,
['saiz_kotak'] = 'kotak_bingkai',
['bingkai'] = bstyle .. " " .. bthickness .. " " .. color,
['warna_latar'] = bgcolor,
['jajar_teks'] = align,
['padding'] = padding,
['gaya'] = positionStyle .. " " .. style
}
local styleParam = make_style_string(styleArgs)
local divOpen = '<div ' .. styleParam .. '>'
local trackingCat
if CSS_unit({maxwidth}) == 'px' then
trackingCat = '[[Kategori:Laman menggunakan lebar piksel (bingkai)]]'
else
trackingCat = ''
end
return divOpen .. trackingCat
end
local function border_end()
return '</div>'
end
function p.border(frame)
return p.border_start(frame) .. getArgs(frame)[1] .. border_end()
end
return p