Content deleted Content added
Dreamy Jazz (talk | contribs) merge from sandbox; adding feature to remove redlinked portals from output unless overridden using redlinks=yes. Adds to categories if redlinked portals are provided |
Dreamy Jazz (talk | contribs) merge from sandbox; fix bug with portals not being checked for whether they are redlinked if the portal before is redlinked |
||
Line 101:
-- scan for nonexistent portals, if they exist remove them from the portals table. If redlinks=yes, then don't remove
local portallen = #portals
-- traverse the list backwards to ensure that no portals are missed (table.remove also moves down the portals in the list, so that the next portal isn't checked if going fowards.
-- going backwards allows us to circumvent this issue
for i=portallen,1,-1 do
-- the use of pcall here catches any errors that may occour when attempting to locate pages when the page name is invalid
-- if pcall returns true, then rerun the function to find if the page exists
if not pcall(checkPortalExists,
-- Getting here means a redlinked portal has been found
if (args.redlinks == 'yes') or (args.redlinks == 'y') or (args.redlinks == 'true') or (args.redlinks == 'include') then
Line 112 ⟶ 114:
end
-- remove the portal (this does not happen if redlinks=yes)
table.remove(portals,
end
end
|