Module:Shapes

local sh={}

--Shape Module-- requires local s = require("Module:stdfunc")

Defaults local textface = { ["color"]="#fff", ["display"]="flex", ["box-sizing"]="border-box", ["padding-left"]="1px", ["text-shadow"]="-1px -1px #444, 1px 1px #222", ["color"]="white" } local fundir = { ["ruler"]=function (x) return rule(x) end, ["circle"]=function (x) return circ(x) end, }

Main Div function div(parameter,bracketing) local b,m,e,c,t = "", " " for a,v in pairs(s.m(parameter,textface)) do m=m..a..":"..v..";" end t,m = b..m..e, "" for a,v in pairs(bracketing) do m=m..v end return t..m..c end

---TextCustom--- function HMark(color,interval) interval = s.tnl(interval,2) return ("linear-gradient(to bottom, transparent 0px, transparent 5px, $1 5px), repeating-linear-gradient(to right, $1 0px, $1 calc(($2 - 2)px), grey $2px)"):gsub("$1",color):gsub("$2",interval) end

--DrawingFuncs-- function rule(args) local color, mark = args["color"] or "white", args["mark"] local setting = { ["width"] = s.td(args["length"],100), ["height"] = s.td(args["width"],10), ["background"] = mark and HMark(color,mark) or color }   return div(setting,s.tt(args["text"])) end

function circ(args) return "circ" end

function sh.main(frame) f=frame:getParent return type(fundir[f.args[1]]) == "function" and fundir[f.args[1]](f.args) or "Shape not found `w'" end

return sh