<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="nl">
	<id>https://wikitest.nl/index.php?action=history&amp;feed=atom&amp;title=Module%3ACity</id>
	<title>Module:City - Bewerkingsoverzicht</title>
	<link rel="self" type="application/atom+xml" href="https://wikitest.nl/index.php?action=history&amp;feed=atom&amp;title=Module%3ACity"/>
	<link rel="alternate" type="text/html" href="https://wikitest.nl/index.php?title=Module:City&amp;action=history"/>
	<updated>2026-04-17T16:28:57Z</updated>
	<subtitle>Bewerkingsoverzicht voor deze pagina op de wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wikitest.nl/index.php?title=Module:City&amp;diff=74089&amp;oldid=prev</id>
		<title>Colani: 1 versie geïmporteerd</title>
		<link rel="alternate" type="text/html" href="https://wikitest.nl/index.php?title=Module:City&amp;diff=74089&amp;oldid=prev"/>
		<updated>2024-03-22T20:16:59Z</updated>

		<summary type="html">&lt;p&gt;1 versie geïmporteerd&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nieuwe pagina&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.qCode(place)&lt;br /&gt;
	-- recover a q-code based on place name, also if one can link to a page on commons return such link&lt;br /&gt;
	local item, link = nil, nil&lt;br /&gt;
&lt;br /&gt;
    -- === STEP 1: if &amp;quot;place&amp;quot; is empty than return nothing ==============&lt;br /&gt;
	if (not place) or (place == &amp;quot;&amp;quot;) then&lt;br /&gt;
		return item, link&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
  -- === STEP 2: Check if &amp;quot;place&amp;quot;  holds a q-code or matches any of the hardwired names  ==============&lt;br /&gt;
	if string.match(place, &amp;quot;^Q%d+$&amp;quot;) then&lt;br /&gt;
		return place, link -- place string contains a q-code&lt;br /&gt;
	else&lt;br /&gt;
		-- if multiple calls to {{City}} from a single file, than mw.loadData should load [[Module:City/data]] only once&lt;br /&gt;
		local LookupTable = mw.loadData(&amp;quot;Module:City/data&amp;quot;)&lt;br /&gt;
		item = LookupTable[mw.ustring.lower(place)]&lt;br /&gt;
		if item then&lt;br /&gt;
			return item, link&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- === STEP 3: Check if {{{1}}} matches existing template, gallery or category and if so provide the link  ===&lt;br /&gt;
	if #place&amp;gt;=3 and #place&amp;lt;40 then&lt;br /&gt;
		local page = mw.title.new( place, &amp;#039;&amp;#039; )&lt;br /&gt;
		if page and page.exists then&lt;br /&gt;
			item = mw.wikibase.getEntityIdForTitle( place )&lt;br /&gt;
			link = &amp;quot;[[&amp;quot; .. place .. &amp;quot;]]&amp;quot;&lt;br /&gt;
			if item then&lt;br /&gt;
				return item, link&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		page = mw.title.new( place, &amp;#039;category&amp;#039; )&lt;br /&gt;
		if page and page.exists then&lt;br /&gt;
			item = mw.wikibase.getEntityIdForTitle( &amp;#039;Category:&amp;#039; .. place )&lt;br /&gt;
			link = &amp;quot;[[:Category:&amp;quot; .. place .. &amp;quot;|&amp;quot; .. place .. &amp;quot;]]&amp;quot;&lt;br /&gt;
			if item then&lt;br /&gt;
				local entity = mw.wikibase.getEntityObject(item)&lt;br /&gt;
				if entity then &lt;br /&gt;
					local s = entity:getBestStatements( &amp;#039;P31&amp;#039; )&lt;br /&gt;
					if s[1] and s[1].mainsnak.datavalue.value.id==&amp;quot;Q4167836&amp;quot; then &lt;br /&gt;
						-- if &amp;quot;instance of &amp;quot;(P31) = &amp;quot;Wikimedia category&amp;quot; (Q4167836)&lt;br /&gt;
						s = entity:getBestStatements( &amp;#039;P301&amp;#039; ) -- category&amp;#039;s main topic &lt;br /&gt;
						if s[1] then -- if property &amp;quot;category&amp;#039;s main topic&amp;quot; (P301) is set&lt;br /&gt;
							item = s[1].mainsnak.datavalue.value.id &lt;br /&gt;
						else&lt;br /&gt;
							item = nil&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end &lt;br /&gt;
	end&lt;br /&gt;
	return item, link&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._city(place, lang, link)&lt;br /&gt;
	if (not place) or (place == &amp;quot;&amp;quot;) then&lt;br /&gt;
		return &amp;quot;&amp;quot; --if &amp;quot;place&amp;quot; is empty than do nothing&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if string.match(place, &amp;quot;[%{%{|%[%[].+[%}%}|%]%]]&amp;quot;) then&lt;br /&gt;
		return place --  if &amp;quot;place&amp;quot; already has a link and if so than skip the rest of the template&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
    -- Check if we can recover a q-code &lt;br /&gt;
	local item, linkStr = p.qCode(place)&lt;br /&gt;
	if item then&lt;br /&gt;
		local wikidata = require(&amp;quot;Module:Wikidata label&amp;quot;)&lt;br /&gt;
		return wikidata._getLabel(item, lang, link)&lt;br /&gt;
	elseif linkStr then&lt;br /&gt;
		return linkStr -- no q-code but we matched one of the galleries or categories&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- return as is&lt;br /&gt;
	return place&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.city(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	if not (args.lang and mw.language.isSupportedLanguage(args.lang)) then &lt;br /&gt;
		args.lang = frame:callParserFunction( &amp;quot;int&amp;quot;, &amp;quot;lang&amp;quot; ) -- get user&amp;#039;s chosen language &lt;br /&gt;
	end&lt;br /&gt;
	if (not args.link) or (mw.text.trim(args.link) == &amp;quot;&amp;quot;) then&lt;br /&gt;
		args.link = &amp;quot;wikipedia&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	args.place = mw.text.trim(args.place or &amp;#039;&amp;#039;)&lt;br /&gt;
	return p._city(args.place, args.lang, args.link)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Colani</name></author>
	</entry>
</feed>