跳转到内容

模組:沙盒/QFQ/test

维基百科,自由的百科全书
-- QFQ是个短用户名
local ns = {}

function ns.hello()
    return "Hello, world!"
end

function div(style, content)
	content = content or ""
	return "<div style=\"" .. style .. "\">" .. content .. "</div>"
end

function _hexagon(bgcolor)
	return div("width: 265px; height: 265px; position: relative;",
		div("position: absolute; background: #f7834a; width: 265px; height: 153px; transform: rotate(60deg);")
		..
		div("position: absolute; background: #f7834a; width: 265px; height: 153px; transform: rotate(-60deg);")
		..
		div("position: absolute; background: #f7834a; width: 265px; height: 153px;"))
end

function ns.hexagon(frame)
    -- Allow for invocation via #invoke or directly from another module
    local args
    if frame == mw.getCurrentFrame() then
        args = frame.args
    else
        args = frame
    end
    
    local bgcolor = args.bgcolor
    return _hexagon(bgcolor)
end

return ns