-- This module implements .
---------------------------------------------------------------------------------- WritingCredits class-- The main class.--------------------------------------------------------------------------------
local WritingCredits =
function WritingCredits.splitTable(tab) -- Split comma-separated values by letter/number local t = for v in string.gmatch(tab, "[%w%d]+") do t[#t+1] = v end return tend
function WritingCredits.hasValue(tab, val) -- Check for value within table for k, v in ipairs(tab) do if v
function WritingCredits.new(frame, args) args = args or local categories = "" -- Default order: writer, story, teleplay, storyboard, extras local defaultOrder = "w,s,t,sb,ex1,ex2,ex3" if args.tfirst then -- Teleplay before story (legacy support, will deprecate) defaultOrder = "t,w,s,sb,ex1,ex2,ex3" end local defaultOrder_split = WritingCredits.splitTable(defaultOrder) local givenOrder = args.order or "" local givenOrder_split = WritingCredits.splitTable(givenOrder) -- Order of parameters: any provided by template call in their order, then any undeclared in their default order for k, v in ipairs(defaultOrder_split) do if WritingCredits.hasValue(givenOrder_split, v)
labels[t] (and) labels[sb] ~= extraDefault if l_para ~= para and labels[l_para]
0 and redundantLabel then categories = categories .. "" end return writingCredits .. categoriesend
---------------------------------------------------------------------------------- Exports--------------------------------------------------------------------------------
local p =
function p.main(frame) local args = require('Module:Arguments').getArgs(frame,) return WritingCredits.new(frame, args)end
return p