Module:Post
Documentation for this module may be created at Module:Post/doc
local u = require"Module:Utils"
local places = require"Module:Places"
local data = mw.loadJsonData"Data:Post"
local post = {
providers_table = function(frame)
local out = '{| class="wikitable sortable"\n|+ Postal Service Providers\n|-\n! Code\n! Name\n! Headquarters\n! Manager(s)\n'
for _, v in ipairs(data.providers) do
out = out .. "|-\n"
out = out .. "| " .. v.shorthand .. "\n"
out = out .. "| " .. v.name .. "\n"
out = out .. "| " .. v.hq .. "\n"
out = out .. "| "
for i, m in ipairs(v.managers) do
if i ~= 1 then out = out .. ", " end
out = out .. m
end
out = out .. "\n"
end
out = out .. "|}\n"
return out
end,
facilities_without_service = function(frame)
local out = '{| class="wikitable sortable"\n|+ Postal Facilities Without Service\n|-\n! Country\n! Name\n! Location\n! Notes\n'
for _, v in ipairs(data.facilities) do
if type(v.delivery) == "table" and #v.delivery == 0 then
out = out .. "|-\n"
out = out .. "| " .. places.get_style(v.place) .. "\n"
out = out .. "| " .. v.name .. "\n"
out = out .. "| " .. u.def(v.address, "")
out = out .. "〈" .. v.coordinates[1] .. ", " .. v.coordinates[2] .. ", " .. v.coordinates[3] .. "〉\n"
out = out .. "| " .. u.def(v.notes, ""):gsub("{([A-Z][A-Z])}", places.get_style) .. "\n"
end
end
out = out .. "|}\n"
return out
end
}
return post