Module:Random slideshow/sandbox: Difference between revisions

Content deleted Content added
Fix
sync
Line 1:
-- Creates a slideshow gallery where the order is randomised. Intended for use on portal pages.
local p = {}
local excerptModule = require('Module:Excerpt/portals/sandbox')
local randomModule = require('Module:Random')
local redirectModule = require('Module:Redirect')
Line 45:
function makeGalleryLine(file, caption, credit)
local title = mw.title.new(file, "File" )
if not title
then
return "File:Blank.png{{!}}{{Error|File [[:File:" .. file .. "]] does not exist.}}"
end
local creditLine = ( credit and '<p><span style="font-size:88%">' .. credit .. '</span></p>' or '' )
return title.prefixedText .. '{{!}}' .. ( caption or '' ) .. creditLine
Line 87 ⟶ 91:
file = mw.ustring.gsub(file, '|%s*right%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*center%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*centre%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*framed?%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*frameless%s*([|%]])', '%1')
Line 141 ⟶ 146:
content = excerptModule.getSection(content, args['section'..i]) or ''
end
content = excerptModule.cleanupText(content, {keepSubsections=true}) -- true means keep subsections
local galleryFiles = extractGalleryFiles(content)