Content deleted Content added
Module:Excerpt/sandbox → Module:Excerpt |
excerpts function |
||
Line 1:
-- Creates a slideshow gallery where the order is randomised. Intended for use on portal pages.
local p = {}
local excerptModule = require('Module:Excerpt/sandbox')
local randomModule = require('Module:Random')
local redirectModule = require('Module:Redirect')
Line 139:
return frame:preprocess(output)
end
p.excerpts = function(frame)
local parent = frame.getParent(frame)
local parentArgs = parent.args
local args = cleanupArgs(parentArgs)
local galleryArgs = {}
local options = args -- pick up miscellaneous options: more, errors, fileargs
options.paraflags = excerptModule.numberflags(args["paragraphs"] or "") -- parse paragraphs, e.g. "1,3-5" → {"1","3-5"}
options.fileflags = excerptModule.numberflags(args["files"] or "") -- parse file numbers
if options.more and options.more == "" then options.more = "Read more..." end -- more= is short for this default text
local i = 1
while args[i] do
local excerpt = excerptModule.main(args[i], options)
local text = '<div style{{=}}text-align:left;>' .. mw.ustring.gsub(excerpt, '%c', '<br>') .. '</div>'
table.insert(galleryArgs, 'File:Blank.png')
table.insert(galleryArgs, excerpt)
end
local output = p._main(galleryArgs, false)
return frame:preprocess(output)
end
return p
|