Module:Storyline

--[=[

Lua Module for Stroylines Function

--]=]

local p = {}

local util = require("Module:Utility")

---[==[ local storylineData = mw.loadData( 'Module:Storyline/data' ) --[===[]==] local storylineData = { ["Colors"] = { ["main"] = {nil, "ffc823", "ffff6b", "cc6600"}, ["side"] = {nil, "18e8ca", "36ffbe", "005555"}, ["ttc"] = {true, "450a6c", "930eb9", "dc86ee", "31ac2a"}, },   ["Arrows"] = { ["R"] = "right", ["r"] = "right-", } } --]===]

local function oneCell(tIn, eType, qLink, qTime, qText) local tOut = {}

if storylineData["Arrows"][eType] then tOut = {'\n! style="width: 1%;"|'} if qLink ~= "" and storylineData["Arrows"][qLink] then table.insert(tOut, ' [[File:m-arrow-')			table.insert(tOut, storylineData["Arrows"][qLink])			table.insert(tOut, '.png|x35px]]') end return table.concat(tOut) else tOut = {'\n! style="width: 20%; padding: 5px; background: radial-gradient(circle, #', "36d0ff", ' 5%, #', "1ca1fc", ' 100%); border-radius: 15px; font-weight: normal; box-shadow: 0 0 10px #666666; border: ', "none", ';|', "", "", "", "", "", "", "", "", "", "", ""}	end

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

if qLink ~= "" then tOut[11] = " '		if qLink:match("^.+ %(%d%)$") then			qLink = qLink:match("(.+) %(%d%)$")		elseif qLink:match("^.+ %(%d%d%)$") then			qLink = qLink:match("(.+) %(%d%d%)$")		end		tOut[16] = qLink		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 		end		tOut[17] = " " end

if storylineData["Colors"][eType] then local eData = storylineData["Colors"][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 qText ~= "" then table.insert(tOut, ' ') for idx = 4, #tIn do			table.insert(tOut, " - ") table.insert(tOut, tIn[idx]) table.insert(tOut, " ") end table.insert(tOut, ' ') 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		local tIn = mw.text.split(item, "%s*$%s*") tOut[i] = oneCell(tIn, tIn[1], (tIn[2] or ""), (tIn[3] or ""), (tIn[4] or "")) end return "|-" .. table.concat(tOut) end

return p