Module:Sandbox/Akar1

------------------------------------------------------------------
-------Extract From http://lua-users.org/wiki/SplitJoin-----------
------------------------------------------------------------------

-- 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

------------------------------------------------------------------
---------------Extract End----------------------------------------
------------------------------------------------------------------


function splitIn2(streen)
    flag = true
    for i in string.gmatch(streen, "[^:]+") do
        if flag then
            var1 = i
            flag = false
        else
            var2 = i
        end
    end
    return var1, var2
end

function splitIn4(streen)
    flag1 = true
    flag2 = true
    flag3 = true
    for i in string.gmatch(streen, "[^:]+") do
        if flag1 then
            var1 = i
            flag1 = false
        elseif flag2 then
            var2 = i
            flag2 = false
        elseif flag3 then
            var3 = i
            flag3 = false
        else
            var4 = i
        end
    end
    return var1, var2, var3, var4
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("([^,]+):([^,]+)")
    	-- Doesnt work Code local val1, val2 = (frame.args[i]):match("([^,]+),([^,]+)")
    	tot = ""
    	-- local myTable = (frame.args[i]):split(", ")
    	--[[myTable = split(frame.args[i],'[\\/]+')
    	local val1 = myTable[2]
    	local val2 = myTable[1]]--
    	-- local color, sectionHeader = splitIn2(frame.args[i])
    	-- local headerBgColor='ffffff'
		local color, sectionHeader, headerBgColor, descr = splitIn4(frame.args[i])
    	-- 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..tostring(val1)..tostring(val2)
    	styling = ''
    	-- if headerBgColor ~=  nil then
    	-- 	styling = styling..'background-color: '..headerBgColor..';'
    	-- else
    	-- 	styling = styling..'background-color: white;'
    	-- end
    	if tostring(mw.title.getCurrentTitle().id) == tostring(sectionHeader) then
    		styling = styling..'background-color: gray;'
    		-- returner = returner..'gray'
    	else
    		styling = styling..'background-color: white;'
    		-- returner = returner..'white'
    	end
    	if i ~= 'color' then
	    	returner = returner..'<span style="color: '..color..'; float: left; border-top: 6px solid '
	    	..color..'; font-weight: bold; outline: none; cursor: pointer; padding: 14px 16px; transition: 0.3s; '..styling..'">'
	    	returner = returner..sectionHeader
	    	returner = returner..'</span>'
	    end
	    -- headerBgColor = nil
    end
    -- for i, j in pairs(mw.title.getCurrentTitle()) do
    -- 	returner = returner..tostring(i)..tostring(j)..'Herehere'
    -- end
    -- mw.title.getCurrentTitle().subpageText..
    returner = returner..'</span>'
    return returner
end






return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.