Module:Places

From Nguhcraft Wiki
Revision as of 23:19, 18 November 2025 by Annwan (talk | contribs) (Created page with "local _m = {} local data = mw.loadJsonData(Data:Places) _m.countries = function(frame) local out = [==[ <table class="wikitable sortable"> <th> <td>Common name</td> <td>Full name</td> <td>Ruler</td> <td>Ruler title</td> <td>Date founded</td> <td>Capital</td> <td>Code-2</td> <td>Code-3</td> <td>UŊ Member</td> </th> ]==] for _, c in ipairs(data.places) do if not c.not_ngation and not c.condominium and not c.reason_dissolved and not c.reserved then ou...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Places/doc

local _m = {}

local data = mw.loadJsonData([[Data:Places]])

_m.countries = function(frame)
	local out = [==[
<table class="wikitable sortable">
<th>
	<td>Common name</td>
	<td>Full name</td>
	<td>Ruler</td>
	<td>Ruler title</td>
	<td>Date founded</td>
	<td>Capital</td>
	<td>Code-2</td>
	<td>Code-3</td>
	<td>UŊ Member</td>
</th>
]==]
	for _, c in ipairs(data.places) do
		if not c.not_ngation and not c.condominium and not c.reason_dissolved and not c.reserved then
			out = out .. "<tr>"
			out = out .. "<td>" .. frame:expandTemplate{title = "Banner", args = {c.code2}}
			          .. " " .. (c.common_name and ("[[" .. c.common_name .. "]]") or "") .. "</td>"
			out = out .. "<td>" .. (c.name or "") .. "</td>"
			if not c.ruler then out = out .. "<td></td>"
			elseif type(c.ruler) == "table" then
				out = out .. "<td>"
				for i, r in ipairs(c.ruler) do out = out .. (i ~= 1 and ", " or "") .. r end
				out = out .. "</td>"
			elseif c.ruler_link then
				out = out .. "<td>[[" .. c.ruler_link .. "|" .. c.ruler .. "]]</td>"
			else out = out .. "<td>[[" .. c.ruler .. "]]</td>"
			end
			out = out .. "<td>" .. (c.ruler_title or "") .. "</td>"
			if not c.date_founded then out = out .. "<td></td>" else
				out = out .. "<td>" .. c.date_founded[1] .. "-" .. c.date_founded[2] .. "-" .. c.date_founded[3] .. "</td>"
			end
			out = out .. "<td>" .. (c.capital or "") .. "</td>"
			out = out .. "<td>" .. c.code2 .. "</td>"
			out = out .. "<td>" .. c.code3 .. "</td>"
			out = out .. "<td>" .. (c.ung == "member" and "yes" or "no") .. "</td>"
			out = out .. "</tr>"
		end
	end
	out = out .. [[</table>]]
	return out
end
return _m