Module:Geography: Difference between revisions

From stencil.wiki
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
function p.countryCategory(frame)
-- Generate country categories (and optional regional category) based on
-- the passed class and country. Can provide a single country name or a
-- list (in which case if they are identical, their shared value is used,
-- otherwise "International _____"). If a blank string is sent no
-- categories are rendered.
local args = frame.args or frame:getParent().args
local result = ""
return result
end
function p.stateProvinceCategory(frame) end
function p.cityCategory(frame) end


function p.sharedPlace(frame)
function p.sharedPlace(frame)

Revision as of 02:58, 4 January 2025

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

local p = {}

function p.countryCategory(frame)
	-- Generate country categories (and optional regional category) based on
	-- the passed class and country. Can provide a single country name or a
	-- list (in which case if they are identical, their shared value is used,
	-- otherwise "International _____"). If a blank string is sent no 
	-- categories are rendered.
	local args = frame.args or frame:getParent().args
	local result = ""
	
	
	
	return result
end

function p.stateProvinceCategory(frame) end
function p.cityCategory(frame) end

function p.sharedPlace(frame)
    local args = frame.args or frame:getParent().args
    local a = ""
    local b = true
    for name in string.gmatch(args[1], "[^,]+") do
    	name = name:gsub("^%s*(.-)%s*$", "%1")
		if a == "" then
			a = name
		elseif a ~= name then
			b = false
		end
	end
	if b then return a else return "" end
end

function p.getRegion(country)
    -- Switch on the provided country and return the region string.
end

return p