Module:Post: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
Created page with "local post = {} local places = require"Module:Places" local data = mw.loadJsonData"Data:Post" post.providers_table = function(frame) local out = '{| class="wikitable sortable"\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 ~..."
 
No edit summary
Line 1: Line 1:
local post = {}
local u = require"Module:Utils"
 
local places = require"Module:Places"
local places = require"Module:Places"
local data = mw.loadJsonData"Data:Post"
local data = mw.loadJsonData"Data:Post"
 
local post = {
post.providers_table = function(frame)
providers_table = function(frame)
local out = '{| class="wikitable sortable"\n|-\n! Code\n! Name\n! Headquarters\n! Manager(s)\n'
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
for _, v in ipairs(data.providers) do
out = out .. "|-\n"
out = out .. "|-\n"
Line 17: Line 16:
end
end
out = out .. "\n"
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, "") .. "\n"
end
end
end
out = out .. "|}\n"
out = out .. "|}\n"
return out
return out
end
end
}
return post
return post

Revision as of 20:48, 4 January 2026

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, "") .. "\n"
		end
	end
	out = out .. "|}\n"
	return out
end
}
return post