Module:CTScanViewer
Appearance
Documentation for this module may be created at Module:CTScanViewer/doc
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.viewer(frame)
local args = getArgs(frame)
local titleText = args.title or ''
local imagesWikitext = ''
if titleText ~= '' then
imagesWikitext = imagesWikitext .. '<div style="text-align: center; font-weight: bold;">' .. titleText .. '</div>\n'
end
local containerStart = '<div class="ct-scan-viewer" style="overflow-y: scroll; height: 500px;">\n'
local containerEnd = '</div>'
local imagesContent = ''
-- Process each image file argument
local index = 1
while args['image' .. index] do
local fileName = args['image' .. index]
-- Construct wikitext for embedding the image
imagesContent = imagesContent .. string.format('[[File:%s|700px|none|link=]]\n', fileName)
index = index + 1
end
local finalWikitext = imagesWikitext .. containerStart .. imagesContent .. containerEnd
return frame:preprocess(finalWikitext)
end
return p