Die Dokumentation für dieses Modul kann unter Modul:Geburtsort/Doku erstellt werden

function p.render(frame)
	local value = frame.args.value or (frame:getParent() and frame:getParent().args.value)
	value = value and trim(value) or ""
	if value == "" then return "" end

	local linkMode = (frame.args.link or ""):lower()  -- "page" (default) oder "category"

	-- Stadt/Land parsen
	local city, countryRaw = splitCityCountry(value)

	-- Land normalisieren
	local countryNorm = nil
	if countryRaw ~= "" then
		countryNorm = countryNormalize[lc(countryRaw)] or countryRaw
	end

	-- Anzeige-Links erzeugen
	local cityView, countryView

	if linkMode == "category" then
		-- Sichtbare Links direkt auf die Kategorien setzen (mit führendem :)
		cityView = city ~= "" and string.format("[[:Kategorie:Geboren in %s|%s]]", city, city) or ""
		if countryNorm and countryNorm ~= "" then
			local suffix = countryCatSuffix[countryNorm] or countryNorm
			countryView = string.format("[[:Kategorie:Geboren in %s|%s]]", suffix, countryNorm)
		else
			countryView = ""
		end
	else
		-- Standard: auf Artikelseiten verlinken (nur wenn existieren)
		cityView = linkIfExists(city)
		countryView = (countryNorm and linkIfExists(countryNorm)) or ""
	end

	-- Anzeige zusammensetzen
	local out = {}
	out[#out+1] = cityView
	if countryView ~= "" then
		out[#out+1] = ", " .. countryView
	end

	-- Kategorien immer setzen (unsichtbar im Fließtext)
	if city ~= "" then
		out[#out+1] = string.format("\n[[Kategorie:Geboren in %s]]", city)
	end
	if countryNorm and countryNorm ~= "" then
		local suffix = countryCatSuffix[countryNorm] or countryNorm
		out[#out+1] = string.format("\n[[Kategorie:Geboren in %s]]", suffix)
	end

	return table.concat(out)
end