Module:InterviewArchive
Jump to navigation
Jump to search
Documentation for this module may be created at Module:InterviewArchive/doc
local p = {}
local function generateInterview(interview, frame)
local output = {}
table.insert(output, '<div class="mnbox" id="' .. interview.title .. '">')
table.insert(output, '<div class="ivimage" style="display:table-cell; vertical-align:top;">')
if interview.cover ~= '' then
table.insert(output, '[[File:' .. interview.cover .. '||90px]]')
else
table.insert(output, '[[File:NoPicAv.png|90px]]')
end
table.insert(output, '</div>')
table.insert(output, '<div style="display:table-cell; width:100%;">')
table.insert(output, '<div class="column">')
table.insert(output, '<div class="diamond" style="background:' .. frame:preprocess('{{Color|' .. interview.part .. '}}') .. '; text-align:center; padding:0.5%;">')
table.insert(output, '<span class="fadeinimg" style="float: left; margin-left:5px;">')
table.insert(output, '[[File:JJLSymbol.png|20px|link=#' .. interview.title .. '|Link to this section]]</span>')
if interview.display then
table.insert(output, frame:preprocess("{{Shadow|{{White2|Interview:" .. interview.title .. "|'''" .. interview.display .. "}}}}"))
else
table.insert(output, frame:preprocess("{{Shadow|{{White2|Interview:" .. interview.title .. "|'''" .. interview.title .. "}}}}"))
end
table.insert(output, '</div>')
table.insert(output, '<div style="padding-left:1%; font-size:90%;">')
if interview.translation then
table.insert(output, frame:preprocess('{{Tag|' .. interview.translation .. '}}'))
end
if interview.transcript then
table.insert(output, frame:preprocess('{{Tag|' .. interview.transcript .. '}}'))
end
table.insert(output, frame:preprocess('{{Tag|' .. interview.media .. '}}'))
table.insert(output, frame:preprocess('{{Tag|' .. interview.type .. '}}'))
table.insert(output, frame:preprocess('{{Align|{{Tag|Date=' .. interview.date .. '}}|right}}'))
table.insert(output, '<div class="interviewee" style="display:table-row;">👤 ')
for i, person in ipairs(interview.interviewee) do
if i > 1 then
table.insert(output, ", ")
end
table.insert(output, frame:preprocess(person))
end
table.insert(output, '</div>')
table.insert(output, '<div style="display:table-row;">📜 ')
for _, tag in ipairs(interview.tags) do
table.insert(output, frame:preprocess('{{Tag|' .. tag .. '}}'))
end
table.insert(output, '</div></div></div></div></div>')
return table.concat(output)
end
-- Export the generateInterview function so it can be used from outside the module
function p.generateInterview(interview, frame)
mw.log(interview)
return generateInterview(interview, frame)
end
function p.generateArchive(frame)
local content = mw.loadJsonData('JoJo Wiki:Interviews').interviews
local html = {'<div id="interview-container">'} -- Start the div with the ID 'interview-container'
for _, interview in ipairs(content) do
table.insert(html, generateInterview(interview, frame))
end
table.insert(html, '</div>') -- End the div with the ID 'interview-container'
return table.concat(html)
end
return p