Module:Random slideshow/sandbox: Difference between revisions

Content deleted Content added
sync
allow for non-random output
Line 29:
end
 
function isDeclined(val)
function makeOutput(galleryLines, maxWidth, containerClassName)
if not val then return false end
local declinedWords = " decline declined exclude excluded false none not no n off omit omitted remove removed "
return string.find(declinedWords , ' '..val..' ', 1, true ) and true or false
end
 
function makeOutput(galleryLines, maxWidth, containerClassName, nonRandom)
local randomiseArgs = { ['t'] = galleryLines }
local randomisedLinessortedLines = nonRandom and galleryLines or randomModule.main('array', randomiseArgs)
local galleryContent = table.concat(randomisedLinessortedLines, '\n')
local output = '<div class="' .. containerClassName .. '" style="max-width:' .. normaliseCssMeasurement(maxWidth) .. '; margin:-4em auto;">{{#tag:gallery|' .. galleryContent .. '|mode=slideshow}}</div>'
return output
Line 160 ⟶ 166:
end
local lines = transclude and makeTranscludedGalleryLinesTables(args) or makeGalleryLinesTable(args)
return makeOutput(lines, args.width or '100%', containerClassName or 'randomSlideshow-container', isDeclined(args.random))
end