Module:Storyline

--[=[

Lua Module for Stroylines Function

--]=]

local p = {}

local util = require("Module:Utility") local colorData = mw.loadData( 'Module:Storyline/data' )

local function oneCell(item) local tOut = {' style="width: 20%; padding: 5px; background: radial-gradient(circle, #', "36d0ff", ' 5%, #', "1ca1fc", ' 100%); border-radius: 15px; box-shadow: 0 0 10px #666666; border: ', "none", ';|', "", "", "", "", "", "", "", "", "", "", ""}

local tIn = mw.text.split(item, "%s*$%s*") local eType = tIn[1]:lower or "" if eType == "" then return "" end local qLink = tIn[2] or "" local qTime = tIn[3] or ""

if eType == "main" then tOut[10] = "" elseif eType == "side" then tOut[10] = "" else tOut[10] = "" end

if qLink ~= "" then tOut[11] = " '		if qLink:match("^.+%#Part %d$") then      			local qName, qAnch = qLink:match("^(.+)%#Part (%d+)$")			tOut[16] = qName .. ", Pt. " .. qAnch 		elseif qLink:match("^.+%#Part %d%d$") then       			local qName, qAnch = qLink:match("^(.+)%#Part (%d+)$")			tOut[16] = qName .. ", Pt. " .. qAnch 		elseif qLink:match("^.+ %(%d%)$") then			tOut[16] = qLink:match("(.+) %(%d%)$")		elseif qLink:match("^.+ %(%d%d%)$") then			tOut[16] = qLink:match("(.+) %(%d%d%)$")		else			tOut[16] = qLink		end		tOut[17] = " " end

if colorData[eType] then local eData = colorData[eType]

if eData[3] then tOut[2] = eData[3] end

if eData[2] then tOut[4] = eData[2] end

if eData[5] then tOut[6] = "3.5px solid #" .. eData[5] end

if eData[1] == true then tOut[8] = "f5f3f5" end

if eData[4] and qLink ~= "" then tOut[14] = eData[4] end end

if qTime ~= "" then tOut[18] = " ("		tOut[19] = qTime		tOut[21] = ")" end

if tIn[4] then for idx = 4, #tIn do			table.insert(tOut, " - ") table.insert(tOut, tIn[idx]) table.insert(tOut, " ") end end return table.concat(tOut) .. " " end

function p.main(frame) local tArgs = util.getArgs(frame)

local tOut = {"|-\n|", "\n|", "\n|", "\n|", "\n|", "\n|", "\n|", "\n|", "\n|"}

for i, item in pairs(tArgs) do		if item == "_" then tOut[i] = tOut[i] .. ' style="width: 1%;"|' elseif item == "I" then tOut[i] = tOut[i] .. ' style="width: 1%;"|' elseif item == "T" then tOut[i] = tOut[i] .. ' style="width: 1%;"|' elseif item ~= "" then tOut[i] = tOut[i] .. oneCell(item) end end return table.concat(tOut) end

return p