మాడ్యూల్:Wikipedia ads/data
Jump to navigation
Jump to search
-- This module transforms [[Module:Wikipedia ads/list]] into a format to be
-- used by mw.loadData.
local LIST_MODULE = 'Module:Wikipedia ads/list'
local skippedEntries = {
{
id = 174,
image = "Qxz-ad174.svg",
link = "Template:Wikipedia ads",
author = "[[User:Koavf|Koavf (after Dromioofephesus)]]"
},
{
id = 175,
image = "Qxz-ad175.gif",
link = "Template:Wikipedia ads",
author = "[[User:Mmxx|MMXX]]"
},
}
local list = require(LIST_MODULE)
local ids = {}
local id = 0
for i, t in ipairs(list) do
assert(t.id, string.format(
"no 'id' field in table %d in [[%s]]",
i, LIST_MODULE
))
if id + 1 < t.id then
for id = id + 1, t.id - 1, 1 do -- Insert skipped entries for missing IDs
skippedEntries[id % 2 + 1].id = id
ids[id] = skippedEntries[id % 2 + 1]
table.insert(list, id, skippedEntries[id % 2 + 1])
end
end
id = t.id
ids[t.id] = t
end
return { list = list, ids = ids, noAds = #list }