Content deleted Content added
sync with live version of the module |
shuffle around |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1:
local p = {}
local excerptModule =
local slideshowModule = require('Module:Random slideshow/sandbox')
local randomModule = require('Module:Random')
Line 88:
end
)
end▼
end
Line 114 ⟶ 110:
return frame:preprocess(t)
end
-- else
return
▲end
local cleanUpExcerpt = function(excerpt)
return excerpt
end
Line 134 ⟶ 143:
excerpt = nil
end
if excerpt and excerpt ~= '' and #excerpt > 10 then -- check again in case we had a few characters plus (Full article...)
excerpt = excerpt .. " ('''[[" .. title .. "|" .. options.more .. "]]''')"
▲ -- strip galleries
▲ excerpt = mw.ustring.gsub(excerpt, "<%s*[Gg]allery.->.-<%s*/%s*[Gg]allery%s*>", "")
▲ -- strip tables and block templates; strip newlines and replace pipes within inline templates
▲ excerpt = mw.ustring.gsub(excerpt..'\n', '\n?%b{}\n?', processBraces)
▲ excerpt = mw.ustring.gsub(excerpt, '|', '|')
▲ -- replace wikitext bulleted lists with html bulleted lists
▲ excerpt = gsubWikitextLists(excerpt, '*', 'ul', 'li')
▲ -- replace wikitext numbered lists with html numbered lists
▲ excerpt = gsubWikitextLists(excerpt, '#', 'ol', 'li')
▲ excerpt = mw.text.trim(excerpt)
▲ if readmore_text then
end
local text = '<div style
table.insert(galleryArgs, 'File:Blank.png')
table.insert(galleryArgs, text)
Line 181 ⟶ 170:
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
options.ignoreOnlyincludes = options.ignoreOnlyincludes == nil and true or options.ignoreOnlyincludes -- default to true
if args.nostubs and isDeclined(args.nostubs) then
options.nostubs = false
Line 214 ⟶ 204:
-- begin BHG addition for tracking source pages
local thisPage = mw.title.getCurrentTitle().nsText .. ":" .. mw.title.getCurrentTitle().text
thisPage = thisPage:gsub('_', ' ') -- fix the nsText part, until [[phab:T369784]] is resolved
local thisBareParam = mw.ustring.gsub(args[ii], "^([^#]+).*$", "%1", 1) -- strip any section anchor from the parameter's page name
thisBareParam = thisBareParam:gsub('_', ' ') -- support underscores in parameter's page name
if (thisPage == thisBareParam) then
usesEmbeddedList = true;
Line 257 ⟶ 249:
local parent = frame.getParent(frame)
local output = p._excerpt(parent.args, 'random')
return frame:extensionTag{ name='templatestyles', args = { src='Module:Random slideshow/sandbox/styles.css'} }
end
Line 264 ⟶ 257:
local parent = frame.getParent(frame)
local output = p._excerpt(parent.args, 'linked')
return frame:extensionTag{ name='templatestyles', args = { src='Module:Random slideshow/sandbox/styles.css'} }
end
Line 271 ⟶ 265:
local parent = frame.getParent(frame)
local output = p._excerpt(parent.args, 'listitem')
return frame:extensionTag{ name='templatestyles', args = { src='Module:Random slideshow/sandbox/styles.css'} }
end
Line 279 ⟶ 274:
p._excerpt = function(_args, method)
local args = cleanupArgs(_args)
args.more = excerptModule.getMoreLinkText(_args.more)
local options = makeOptions(args)
local limit = args.limit and tonumber(args.limit) or DEFAULT_LIMIT
Line 294 ⟶ 286:
return slideshowModule._main(galleryArgs, false, 'excerptSlideshow-container') .. checksourcepages()
end
p._cleanUpExcerpt = cleanUpExcerpt
-- begin BHG addition for tracking source pages
|