Module:Sandbox/Akar1
Appearance
-- Compatibility: Lua-5.1
function split(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
return t
end
local p = {}
function p.headerRender(frame)
-- Attempting to remove the key from the table frame args, Unsuccessful attempt
lookie_here = frame.args['color']
if lookie_here == nil then
lookie_here = 'f1f1f1'
end
-- place_holder = type(frame.args)
-- frame.args['color'] = nil
-- place_holder = frame.args['color']
returner = --lookie_here..place_holder..
'<span style="overflow: hidden; border: 1px solid #ccc; width:100%; background-color:#'..lookie_here..';">'
for i in pairs(frame.args) do
-- val = string.gmatch(frame.args[i], "%S+")
-- dic = {}
-- local val1, val2 = string:match("([^,]+):([^,]+)")
local val1, val2 = (frame.args[i]):match("([^,]+),([^,]+)")
tot = ""
-- local myTable = (frame.args[i]):split(", ")
myTable = split(frame.args[i],'[\\/]+')
local val1 = myTable[1]
local val2 = myTable[2]
-- flag = 1
-- -- tot = tot..next(val).."$$1"
-- for every in val do
-- -- local val1, val2 = string:match("([^,]+),([^,]+)")
-- -- dic[#dic] = every
-- if flag == 1 then
-- val1 = every
-- tot = tot..'TTT'
-- flag = 2
-- else
-- tot = tot..'FFF'
-- val2 = every
-- flag = 1
-- end
-- tot = tot..every
-- end
tot = tot..frame.args[i] --val1..val2
if i ~= 'color' then
returner = returner..'<span style="color: '..i..'; float: left; border-top: 6px solid '..i..'; font-weight: bold; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s;">'
returner = returner..tot
returner = returner..'</span>'
end
end
returner = returner..'</span>'
return returner
end
return p