<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wonkpedia.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AResolveEntityId</id>
	<title>Module:ResolveEntityId - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wonkpedia.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AResolveEntityId"/>
	<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:ResolveEntityId&amp;action=history"/>
	<updated>2026-04-15T06:00:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wonkpedia.org/mediawiki/index.php?title=Module:ResolveEntityId&amp;diff=2090&amp;oldid=prev</id>
		<title>Bmueller: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:ResolveEntityId&amp;diff=2090&amp;oldid=prev"/>
		<updated>2022-05-31T18:29:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&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;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:29, 31 May 2022&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key lets_get_wonky-mediawiki-:diff:wikidiff2:1.12:old-2089:rev-2090:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bmueller</name></author>
	</entry>
	<entry>
		<id>https://wonkpedia.org/mediawiki/index.php?title=Module:ResolveEntityId&amp;diff=2089&amp;oldid=prev</id>
		<title>Wikipedia&gt;Ahecht: Sync from sandbox. Follow Wikipedia redirects, remove _entityid() function. Feel free to revert if any more issues crop up.</title>
		<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:ResolveEntityId&amp;diff=2089&amp;oldid=prev"/>
		<updated>2022-03-03T02:11:37Z</updated>

		<summary type="html">&lt;p&gt;Sync from sandbox. Follow Wikipedia redirects, remove _entityid() function. Feel free to revert if any more issues crop up.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p._id(idOrTitle, alt)&lt;br /&gt;
	local function checkId(id)&lt;br /&gt;
		if id and mw.wikibase.entityExists(id) then&lt;br /&gt;
			local sitelink = mw.wikibase.getSitelink(id)&lt;br /&gt;
			if sitelink then&lt;br /&gt;
				return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(id).id&lt;br /&gt;
			end&lt;br /&gt;
			return mw.wikibase.getEntity(id).id&lt;br /&gt;
		else&lt;br /&gt;
			return alt&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if type(idOrTitle) == 'string' then&lt;br /&gt;
		idOrTitle = mw.ustring.upper(mw.ustring.sub(idOrTitle, 1, 1)) .. mw.ustring.sub(idOrTitle, 2)&lt;br /&gt;
		if mw.wikibase.isValidEntityId(idOrTitle) then&lt;br /&gt;
			-- idOrTitle is in the proper format for a Wikidata entity ID&lt;br /&gt;
			return checkId(idOrTitle)&lt;br /&gt;
		else&lt;br /&gt;
			local eid = mw.wikibase.getEntityIdForTitle(idOrTitle)&lt;br /&gt;
			if eid then&lt;br /&gt;
				-- idOrTitle is a title that matches a Wikidata entity&lt;br /&gt;
				local instanceOf = mw.wikibase.getBestStatements(eid, 'P31')[1] --instance of&lt;br /&gt;
				if not instanceOf or instanceOf.mainsnak.datavalue.value.id ~= 'Q4167410' then&lt;br /&gt;
					-- instance-of value is missing or is not &amp;quot;disambiguation&amp;quot;&lt;br /&gt;
					return checkId(eid)&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				-- idOrTitle is a title, but no wikidata item exists for that title&lt;br /&gt;
				local rtarget = mw.title.new(idOrTitle).redirectTarget&lt;br /&gt;
				if rtarget then&lt;br /&gt;
					-- title is a Wikipedia redirect&lt;br /&gt;
					return p._id(rtarget.fullText, alt)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return alt&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.entityid(frame)&lt;br /&gt;
	return p._id(frame.args[1], frame.args[2])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Ahecht</name></author>
	</entry>
</feed>