<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3ACity</id>
	<title>モジュール:City - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3ACity"/>
	<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&amp;action=history"/>
	<updated>2026-05-02T20:34:33Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&amp;diff=43581&amp;oldid=prev</id>
		<title>Nijcadmin: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&amp;diff=43581&amp;oldid=prev"/>
		<updated>2020-01-29T04:27:36Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2020年1月29日 (水) 13:27時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wiki-mw_:diff:1.41:old-43580:rev-43581 --&gt;
&lt;/table&gt;</summary>
		<author><name>Nijcadmin</name></author>
	</entry>
	<entry>
		<id>https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&amp;diff=43580&amp;oldid=prev</id>
		<title>bsd&gt;4nn1l2: Changed protection level for &quot;Module:City&quot;: downgraded protection level per consensus ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (indefin…</title>
		<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&amp;diff=43580&amp;oldid=prev"/>
		<updated>2019-07-16T11:17:14Z</updated>

		<summary type="html">&lt;p&gt;Changed protection level for &amp;quot;&lt;a href=&quot;/wiki/%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:City&quot; title=&quot;モジュール:City&quot;&gt;Module:City&lt;/a&gt;&amp;quot;: downgraded protection level per &lt;a href=&quot;/wiki/%E7%89%B9%E5%88%A5:%E5%9B%BA%E5%AE%9A%E3%83%AA%E3%83%B3%E3%82%AF/357548402&quot; title=&quot;特別:固定リンク/357548402&quot;&gt;consensus&lt;/a&gt; ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (indefin…&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&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>bsd&gt;4nn1l2</name></author>
	</entry>
</feed>