Module:Interviewee list
From Tardis Wiki, the free Doctor Who reference
Documentation for this module may be created at Module:Interviewee list/doc
local linkUtil = require('Module:LinkUtil')
local p = {}
function p.intervieweeList(frame)
local args = frame:getParent().args
local done = false
local wikitext = ""
local count = 1
while not done do
if args[tostring(count) .. "a"] and args[tostring(count) .. "a"] ~= "" then
args[count] = args[tostring(count) .. "a"]
end
if args["ref" .. tostring(count) .. "a"] and args["ref" .. tostring(count) .. "a"] ~= "" then
args["ref" .. tostring(count)] = args["ref" .. tostring(count) .. "a"]
end
if args[count] and args[count] ~= "" then
wikitext = wikitext .. "* [[Interviewee::" .. args[count] .. "|" .. linkUtil.stripDab(args[count]) .. "]]" .. (args["ref" .. tostring(count)] or "")
local acount = 97
local adone = false
while not adone do
acount = acount + 1
if args[tostring(count) .. string.char(acount)] and args[tostring(count) .. string.char(acount)] ~= "" then
if args[tostring(count) .. string.char(acount+1)] and args[tostring(count) .. string.char(acount+1)] then
wikitext = wikitext .. ","
else
wikitext = wikitext .. (" " .. (args["finsep"] or "&"))
end
wikitext = wikitext .. " [[Interviewee::" .. args[tostring(count) .. string.char(acount)] .. "|" .. linkUtil.stripDab(args[tostring(count) .. string.char(acount)]) .. "]]" .. (args["ref" .. tostring(count) .. string.char(acount)] or "")
else
adone = true
end
end
if args["r" .. tostring(count)] or args["role" .. tostring(count)] then
wikitext = wikitext .. ", " .. (args["r" .. tostring(count)] or args["role" .. tostring(count)]) .. "\n"
else
wikitext = wikitext .. "\n"
end
else
done = true
end
count = count + 1
end
return wikitext:sub(1,-2)
end
return p