Module:Random slideshow/sandbox: Difference between revisions

Content deleted Content added
check gallery files for non-free content
allow filenames to be specified in {{Transclude files as random slideshow}}
Line 95:
 
function makeTranscludedGalleryLinesTables(args)
local namespaceNumber = function(pagetitle)
local titleObject = mw.title.new(pagetitle)
return titleObject and titleObject.namespace
end
local lines = {}
local i = 1
while args[i] do
if namespaceNumber(args[i]) == 6 then -- file namespace
-- Get page content
local line = makeGalleryLine(args[i], args['caption'..i], args['credit'..i])
local content, pagename = excerptModule.getContent(args[i])
table.insert(lines, fline)
if not pagename then
else
return error('Cannot read a valid page for "' .. args[i] .. '"', 0)
local content, pagename = excerptModule.getContent(args[i])
elseif not content then
if not pagename then
return error('No content found on page "' .. args[i] .. '"', 0)
return error('Cannot read a valid page for "' .. args[i] .. '"', 0)
end
if elseif args['section'..i]not content then
content = return excerptModule.getsectionerror('No content, args['sectionfound on page "' .. args[i]) or.. '"', 0)
end
if args['section'..i] then
content = excerptModule.cleanupText(content)
content = excerptModule.getsection(content, args['section'..i]) or ''
 
end
local galleryFiles = extractGalleryFiles(content)
content = excerptModule.cleanupText(content)
if galleryFiles then
for _, f in pairs(galleryFiles) do
local filenamegalleryFiles = string.gsubextractGalleryFiles(f, '{{!}}.*', ''content)
if galleryFiles then
local isOkay = excerptModule.checkimage(filename)
for _, f in pairs(galleryFiles) do
if isOkay then
local filename = string.gsub(f, '{{!}}.*', '')
table.insert(lines, f)
local isOkay = excerptModule.checkimage(filename)
if isOkay then
table.insert(lines, f)
end
end
end
end
local otherFiles = excerptModule.parse(content, {fileflags="1-100"}, true)
 
if otherFiles then
local otherFiles = excerptModule.parse(content, {fileflags="1-100"}, true)
if for _, f in pairs(extractRegularFiles(otherFiles)) thendo
if f and f ~= '' and mw.ustring.sub(f, 1, 5) == 'File:' then
for _, f in pairs(extractRegularFiles(otherFiles)) do
table.insert(lines, f)
if f and f ~= '' and mw.ustring.sub(f, 1, 5) == 'File:' then
end
table.insert(lines, f)
end
end
end
 
i = i + 1
end