Content deleted Content added
exclude wikipedia, also |
auto-detect whether we're being called from a sandbox, per JohnUniq |
||
Line 42:
local p = {}
-- determine whether we're being called from a sandbox
local sandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true) and '/sandbox' or ''
local templatestyles = 'Module:Portal
local getArgs = require('Module:Arguments').getArgs
Line 77 ⟶ 76:
local imagePage
if mw.ustring.find(firstLetter, '^[a-z]') then
imagePage = 'Module:Portal/images/' .. firstLetter ..
else
imagePage = 'Module:Portal/images/other' ..
end
return mw.loadData(imagePage)[s]
Line 86 ⟶ 85:
local function getAlias(s)
-- Gets an alias from the image alias data page.
local aliasData = mw.loadData('Module:Portal/images/aliases'..
for portal, aliases in pairs(aliasData) do
for _, alias in ipairs(aliases) do
Line 235 ⟶ 234:
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 ..
end
return images
|