Jump to content

Module:Random slideshow and Module:Random slideshow/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
imported>Deadfire
m updating
 
imported>Deadfire
Created page with "-- Creates a slideshow gallery where the order is randomised. Intended for use on portal pages. local p = {} local excerptModule = require('Module:Excerpt/portals/sandbox') l..."
 
Line 1: Line 1:
-- Creates a slideshow gallery where the order is randomised. Intended for use on portal pages.
-- Creates a slideshow gallery where the order is randomised. Intended for use on portal pages.
local p = {}
local p = {}
local excerptModule =  require('Module:Excerpt/portals')
local excerptModule =  require('Module:Excerpt/portals/sandbox')
local randomModule = require('Module:Random')
local randomModule = require('Module:Random')


Line 36: Line 36:
function makeOutput(galleryLines, maxWidth, containerClassName, nonRandom)
function makeOutput(galleryLines, maxWidth, containerClassName, nonRandom)
local randomiseArgs = { ['t'] = galleryLines }
local randomiseArgs = { ['t'] = galleryLines }
if #galleryLines > 50 then randomiseArgs.limit = 50 end
local sortedLines = nonRandom and galleryLines or randomModule.main('array', randomiseArgs)
local sortedLines = nonRandom and galleryLines or randomModule.main('array', randomiseArgs)
for i = 1, #sortedLines do
for i = 1, #sortedLines do
Line 171: Line 172:
content = excerptModule.getSection(content, args['section'..i]) or ''
content = excerptModule.getSection(content, args['section'..i]) or ''
end
end
content = excerptModule.cleanupText(content, {keepSubsections=true, ignoreOnlyincludes=true}) -- true means keep subsections
content = excerptModule.cleanupText(content, {keepSubsections=true}) -- true means keep subsections
local galleryFiles = extractGalleryFiles(content)
local galleryFiles = extractGalleryFiles(content)