Content deleted Content added
Check for blank excerpt again after removing Read more... link |
sync from live |
||
Line 6:
local DEFAULT_LIMIT = 25 -- max number of excerpts to be shown in the slideshow
local SOURCE_PAGES_LIMIT = 10 -- max number of pages to check for links / list items
-- begin BHG addition for tracking source pages
local sourcepgagesused = {};
local sourcepgagesusedcounter = 0;
local articlelistcount = -1;
-- end BHG addition for tracking source pages
function cleanupArgs(argsTable)
Line 212 ⟶ 218:
end
end
end
-- begin BHG addition for tracking source pages
if ((method == "listitem") or (method == "linked")) then
table.insert(sourcepgagesused, args[ii])
sourcepgagesusedcounter = sourcepgagesusedcounter + 1
end
-- end BHG addition for tracking source pages
end
ii = ii + 1
end
-- begin BHG addition for tracking
articlelistcount = #pagenames
-- end BHG addition for tracking
return pagenames
end
Line 261 ⟶ 276:
end
local galleryArgs = makeGalleryArgs(titles, options, limit, isDeclined(_args.random))
return slideshowModule._main(galleryArgs, false, 'excerptSlideshow-container') .. checksourcepages()
end
-- begin BHG addition for tracking source pages
function checksourcepages()
-- no tracking unless we are in Portal namespace
if (mw.title.getCurrentTitle().nsText ~= "Portal") then
return ""
end
local pagecounter = 0;
local templatecount = 0;
local retval ="";
local debugging = false;
if debugging then
retval = '<div style="display:block; border:10px solid green; background-color:#efe; padding:1em; margin:1em">\n----\n'
retval = retval .. "sourcepgagesusedcounter: " .. sourcepgagesusedcounter .. "\n----\n"
retval = retval .. "pages used:"
end
local apage
for apage in arrayvalues(sourcepgagesused) do
if debugging then
retval = retval .. "\n# [[:" .. apage .. "]]"
retval = retval .. " — " .. "First 999 = /" .. string.sub(apage, 1, 999) .. "/"
end
if (string.find(apage, "^[tT]emplate ?:") == 1) then
templatecount = templatecount + 1;
end
pagecounter = pagecounter + 1
end
if debugging then
retval = retval .. "\nTotal pages: " .. pagecounter
retval = retval .. "\ntemplatecount: " .. templatecount
retval = retval .. "</div>"
end
-- first do a sanity check that both counting methods have produced the same result
if (sourcepgagesusedcounter == pagecounter) then
-- if all pages are templates, then populate tracking categories
if (pagecounter == templatecount) then
if (templatecount == 1) then
retval = retval .. "[[Category:Automated portals with article list built solely from one template]]"
elseif (templatecount == 2) then
retval = retval .. "[[Category:Automated portals with article list built solely from two templates]]"
elseif (templatecount == 3) then
retval = retval .. "[[Category:Automated portals with article list built solely from three templates]]"
end
end
end
if (articlelistcount < 2) then
retval = retval .. "[[Category:Automated portals with less than 2 articles in article list]]"
elseif (articlelistcount <= 5) then
retval = retval .. "[[Category:Automated portals with 2–5 articles in article list]]"
elseif (articlelistcount <= 10) then
retval = retval .. "[[Category:Automated portals with 6–10 articles in article list]]"
elseif (articlelistcount <= 15) then
retval = retval .. "[[Category:Automated portals with 11–15 articles in article list]]"
elseif (articlelistcount <= 20) then
retval = retval .. "[[Category:Automated portals with 16–20 articles in article list]]"
elseif (articlelistcount <= 25) then
retval = retval .. "[[Category:Automated portals with 21–25 articles in article list]]"
elseif (articlelistcount <= 30) then
retval = retval .. "[[Category:Automated portals with 26–30 articles in article list]]"
elseif (articlelistcount <= 40) then
retval = retval .. "[[Category:Automated portals with 31–40 articles in article list]]"
elseif (articlelistcount <= 50) then
retval = retval .. "[[Category:Automated portals with 41–50 articles in article list]]"
elseif (articlelistcount <= 100) then
retval = retval .. "[[Category:Automated portals with 51–100 articles in article list]]"
elseif (articlelistcount <= 200) then
retval = retval .. "[[Category:Automated portals with 101–200 articles in article list]]"
elseif (articlelistcount <= 500) then
retval = retval .. "[[Category:Automated portals with 201–500 articles in article list]]"
elseif (articlelistcount <= 1000) then
retval = retval .. "[[Category:Automated portals with 501–1000 articles in article list]]"
elseif (articlelistcount > 1000) then
retval = retval .. "[[Category:Automated portals with over 1000 articles in article list]]"
end
return retval
end
function arrayvalues(t)
local i = 0
return function() i = i + 1; return t[i] end
end
-- end BHG addition for tracking source pages
return p
|