Content deleted Content added
Sophivorus (talk | contribs) No edit summary |
sync with live version of the module |
||
Line 128:
local sortedTitles = nonRandom and titlesSequence or randomModule.main('array', {t=titlesSequence, limit=limit})
for _i, title in ipairs(sortedTitles) do
if (#galleryArgs / 2) < limit then
local success, excerpt =
if not success then
mw.log("require('Module:Excerpt').get failed: " .. excerpt) -- probably got a redlink
excerpt = nil
end
if excerpt and excerpt ~= '' and #excerpt > 10 then
-- temporarily take off the '''[[Page title|Read more...]]''' link if present
Line 175 ⟶ 179:
local makeOptions = function(args)
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 args.nostubs and isDeclined(args.nostubs) then
options.nostubs = false
Line 201 ⟶ 205:
local text = pageContent
if pageSection then -- check relevant section only
if not success then
mw.log("require('Module:Excerpt').getSection failed on the content of " .. args[ii] .. ": " .. result)
result = nil
end
text = result or pageContent
end
-- begin BHG addition for tracking source pages
Line 274 ⟶ 283:
args.more = "Read more..." -- default text for blank more=
end
local options = makeOptions(args)
local limit = args.limit and tonumber(args.limit) or DEFAULT_LIMIT
Line 297 ⟶ 305:
local outlinecount = 0;
local retval ="";
local usesEponymousArticle = false;
local debugging = false;
local thisPageBareName = mw.title.getCurrentTitle().text;
if debugging then
retval = '<div style="display:block; border:10px solid green; background-color:#efe; padding:1em; margin:1em">\n----\n'
Line 314 ⟶ 324:
if (string.find(apage, "^[oO]utline +of ") == 1) then
outlinecount = outlinecount + 1;
end
if (apage == thisPageBareName) then
usesEponymousArticle = true;
end
pagecounter = pagecounter + 1
Line 327 ⟶ 340:
if (pagecounter == templatecount) then
if (templatecount == 1) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built solely from one template]]"
elseif (templatecount == 2) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built solely from two templates]]"
elseif (templatecount == 3) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built solely from three templates]]"
elseif (templatecount > 3) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built solely from four or more templates]]"
end
elseif (templatecount > 0) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built using one or more templates, and other sources]]"
end
end
if (outlinecount >= 1) then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built using one or more outline pages]]"
end
if (articlelistcount < 2) then
retval = retval .. "[[Category:Automated article-slideshow portals with less than 2 articles in article list]]"
elseif (articlelistcount <= 5) then
retval = retval .. "[[Category:Automated article-slideshow portals with 2–5 articles in article list]]"
elseif (articlelistcount <= 10) then
retval = retval .. "[[Category:Automated article-slideshow portals with 6–10 articles in article list]]"
elseif (articlelistcount <= 15) then
retval = retval .. "[[Category:Automated article-slideshow portals with 11–15 articles in article list]]"
elseif (articlelistcount <= 20) then
retval = retval .. "[[Category:Automated article-slideshow portals with 16–20 articles in article list]]"
elseif (articlelistcount <= 25) then
retval = retval .. "[[Category:Automated article-slideshow portals with 21–25 articles in article list]]"
elseif (articlelistcount <= 30) then
retval = retval .. "[[Category:Automated article-slideshow portals with 26–30 articles in article list]]"
elseif (articlelistcount <= 40) then
retval = retval .. "[[Category:Automated article-slideshow portals with 31–40 articles in article list]]"
elseif (articlelistcount <= 50) then
retval = retval .. "[[Category:Automated article-slideshow portals with 41–50 articles in article list]]"
elseif (articlelistcount <= 100) then
retval = retval .. "[[Category:Automated article-slideshow portals with 51–100 articles in article list]]"
elseif (articlelistcount <= 200) then
retval = retval .. "[[Category:Automated article-slideshow portals with 101–200 articles in article list]]"
elseif (articlelistcount <= 500) then
retval = retval .. "[[Category:Automated article-slideshow portals with 201–500 articles in article list]]"
elseif (articlelistcount <= 1000) then
retval = retval .. "[[Category:Automated article-slideshow portals with 501–1000 articles in article list]]"
elseif (articlelistcount > 1000) then
retval = retval .. "[[Category:Automated article-slideshow portals with over 1000 articles in article list]]"
end
if usesEmbeddedList then
retval = retval .. "[[Category:Automated article-slideshow portals with embedded list]]"
end
if usesEponymousArticle then
retval = retval .. "[[Category:Automated article-slideshow portals with article list built using eponymous article]]"
end
return retval
|