Module:Portal: Difference between revisions

Content deleted Content added
add sandbox to tracking exclusion
make a single variable that changes from sandbox to main
Line 42:
local p = {}
 
-- IMPORTANT: isSandbox should be different between Module:Portal and Module:Portal/sandbox
local templatestyles = 'Module:Portal/styles.css'
-- That should be the only difference between the main and sandbox version
local isSandbox = false
 
local templatestyles = 'Module:Portal/'..(isSandbox and 'sandbox/' or '')..'styles.css'
 
local getArgs = require('Module:Arguments').getArgs
Line 94 ⟶ 98:
local imagePage
if mw.ustring.find(firstLetter, '^[a-z]') then
imagePage = 'Module:Portal/images/' .. firstLetter .. (isSandbox and '/sandbox' or '')
else
imagePage = 'Module:Portal/images/other' .. (isSandbox and '/sandbox' or '')
end
return mw.loadData(imagePage)[s]
Line 103 ⟶ 107:
local function getAlias(s)
-- Gets an alias from the image alias data page.
local aliasData = mw.loadData('Module:Portal/images/aliases'..(isSandbox and '/sandbox' or ''))
for portal, aliases in pairs(aliasData) do
for _, alias in ipairs(aliases) do
Line 252 ⟶ 256:
local images = {}
for i, subpage in ipairs{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'other'} do
images[i] = mw.loadData('Module:Portal/images/' .. subpage .. (isSandbox and '/sandbox' or ''))
end
return images