<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fa">
	<id>https://www.iran-pedia.org/w/index.php?action=history&amp;feed=atom&amp;title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86%3AWikidataIB</id>
	<title>پودمان:WikidataIB - تاریخچهٔ نسخه‌ها</title>
	<link rel="self" type="application/atom+xml" href="https://www.iran-pedia.org/w/index.php?action=history&amp;feed=atom&amp;title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86%3AWikidataIB"/>
	<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;action=history"/>
	<updated>2026-04-16T18:16:51Z</updated>
	<subtitle>تاریخچهٔ نسخه‌ها برای این صفحه در ویکی</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36210&amp;oldid=prev</id>
		<title>Mahan در ‏۲۰ مارس ۲۰۱۹، ساعت ۱۷:۵۶</title>
		<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36210&amp;oldid=prev"/>
		<updated>2019-03-20T17:56:40Z</updated>

		<summary type="html">&lt;p&gt;&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;fa&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;نسخهٔ ‏۲۰ مارس ۲۰۱۹، ساعت ۱۹:۵۶&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l169&quot;&gt;خط ۱۶۹:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;خط ۱۶۹:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- See what&amp;#039;s on Wikidata:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- See what&amp;#039;s on Wikidata:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	local entity = mw.wikibase.getEntityObject(qid)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;--&lt;/ins&gt;local entity = mw.wikibase.getEntityObject(qid)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	if entity and entity.claims then&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;--&lt;/ins&gt;if entity and entity.claims then&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;		&lt;/del&gt;local props = entity.claims[property_id]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	--	&lt;/ins&gt;local props = entity.claims[property_id]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;		&lt;/del&gt;if props and props[1] then  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	--	&lt;/ins&gt;if props and props[1] then  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;			&lt;/del&gt;return true, entity, props&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	--		&lt;/ins&gt;return true, entity, props&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;		&lt;/del&gt;end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;	--	&lt;/ins&gt;end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	end&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;--&lt;/ins&gt;end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- no property on Wikidata&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	-- no property on Wikidata&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	return false, input_parm, nil&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	return false, input_parm, nil&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mahan</name></author>
	</entry>
	<entry>
		<id>https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36209&amp;oldid=prev</id>
		<title>Mahan: ۱ نسخه واردشده</title>
		<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36209&amp;oldid=prev"/>
		<updated>2019-03-20T10:22:47Z</updated>

		<summary type="html">&lt;p&gt;۱ نسخه واردشده&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fa&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ نسخهٔ قدیمی‌تر&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;نسخهٔ ‏۲۰ مارس ۲۰۱۹، ساعت ۱۲:۲۲&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;fa&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(بدون تفاوت)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mahan</name></author>
	</entry>
	<entry>
		<id>https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36197&amp;oldid=prev</id>
		<title>Mahan: ۱ نسخه واردشده</title>
		<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36197&amp;oldid=prev"/>
		<updated>2019-03-20T10:22:00Z</updated>

		<summary type="html">&lt;p&gt;۱ نسخه واردشده&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fa&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ نسخهٔ قدیمی‌تر&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;نسخهٔ ‏۲۰ مارس ۲۰۱۹، ساعت ۱۲:۲۲&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;fa&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(بدون تفاوت)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mahan</name></author>
	</entry>
	<entry>
		<id>https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36208&amp;oldid=prev</id>
		<title>Mahan در ‏۱۶ اوت ۲۰۱۷، ساعت ۱۳:۴۵</title>
		<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36208&amp;oldid=prev"/>
		<updated>2017-08-16T13:45:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fa&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ نسخهٔ قدیمی‌تر&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;نسخهٔ ‏۱۶ اوت ۲۰۱۷، ساعت ۱۵:۴۵&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;fa&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(بدون تفاوت)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mahan</name></author>
	</entry>
	<entry>
		<id>https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36196&amp;oldid=prev</id>
		<title>Mahan در ‏۱۶ اوت ۲۰۱۷، ساعت ۱۳:۴۵</title>
		<link rel="alternate" type="text/html" href="https://www.iran-pedia.org/w/index.php?title=%D9%BE%D9%88%D8%AF%D9%85%D8%A7%D9%86:WikidataIB&amp;diff=36196&amp;oldid=prev"/>
		<updated>2017-08-16T13:45:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحهٔ تازه&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module to try out use of a blacklist and whitelist for infobox fields&lt;br /&gt;
-- can take a named parameter |qid which is the Wikidata ID for the article. This will not normally be used&lt;br /&gt;
-- Fields in blacklist are never to be displayed, i.e. module must return nil in all circumstances&lt;br /&gt;
-- Fields in whitelist return local value if it exists or the Wikidata value otherwise&lt;br /&gt;
-- The name of the field that this function is called from is passed in named parameter |name&lt;br /&gt;
-- The name is compulsory when blacklist or whitelist is used, so the module returns nil if it is not supplied&lt;br /&gt;
-- blacklist is passed in named parameter |suppressfields&lt;br /&gt;
-- whitelist is passed in named parameter |fetchwikidata&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local i18n =&lt;br /&gt;
{&lt;br /&gt;
    [&amp;quot;errors&amp;quot;] =&lt;br /&gt;
    {&lt;br /&gt;
        [&amp;quot;property-not-found&amp;quot;] = &amp;quot;Property not found.&amp;quot;,&lt;br /&gt;
        [&amp;quot;entity-not-found&amp;quot;] = &amp;quot;Wikidata entity not found.&amp;quot;,&lt;br /&gt;
        [&amp;quot;unknown-claim-type&amp;quot;] = &amp;quot;Unknown claim type.&amp;quot;,&lt;br /&gt;
        [&amp;quot;unknown-entity-type&amp;quot;] = &amp;quot;Unknown entity type.&amp;quot;,&lt;br /&gt;
        [&amp;quot;qualifier-not-found&amp;quot;] = &amp;quot;Qualifier not found.&amp;quot;,&lt;br /&gt;
        [&amp;quot;site-not-found&amp;quot;] = &amp;quot;Wikimedia project not found.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-datetime-format&amp;quot;] = &amp;quot;Unknown datetime format.&amp;quot;,&lt;br /&gt;
		[&amp;quot;local-article-not-found&amp;quot;] = &amp;quot;Article is available on Wikidata, but not on Iranpedia&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    [&amp;quot;months&amp;quot;] =&lt;br /&gt;
    {&lt;br /&gt;
    	&amp;quot;January&amp;quot;, &amp;quot;February&amp;quot;, &amp;quot;March&amp;quot;, &amp;quot;April&amp;quot;, &amp;quot;May&amp;quot;, &amp;quot;June&amp;quot;, &amp;quot;July&amp;quot;, &amp;quot;August&amp;quot;, &amp;quot;September&amp;quot;, &amp;quot;October&amp;quot;, &amp;quot;November&amp;quot;, &amp;quot;December&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Private functions&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- formatDate takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues&lt;br /&gt;
-- like &amp;quot;1 August 30 BCE&amp;quot; as parameter 1 and formats it according to the df (date format) and bc parameters&lt;br /&gt;
-- df = [&amp;quot;dmy&amp;quot; / &amp;quot;mdy&amp;quot; / &amp;quot;y&amp;quot;] default will be &amp;quot;dmy&amp;quot;&lt;br /&gt;
-- bc = [&amp;quot;BC&amp;quot; / &amp;quot;BCE&amp;quot;] default will be &amp;quot;BCE&amp;quot;&lt;br /&gt;
-- first the local version&lt;br /&gt;
local format_Date = function(datetime, dateformat, bc)&lt;br /&gt;
	local datetime = datetime or &amp;quot;1 August 30 BCE&amp;quot; -- in case of nil value&lt;br /&gt;
	-- chop off multiple vales and/or any hours, mins, etc.&lt;br /&gt;
	-- keep anything before punctuation - we just want a single date:&lt;br /&gt;
	local dateval = string.match( datetime, &amp;quot;[%w ]+&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	local dateformat = string.lower(dateformat or &amp;quot;dmy&amp;quot;) -- default to dmy&lt;br /&gt;
	&lt;br /&gt;
	local bc = string.upper(bc or &amp;quot;&amp;quot;) -- can&amp;#039;t use nil for bc&lt;br /&gt;
	-- we only want to accept two possibilities: BC or default to BCE&lt;br /&gt;
	if bc==&amp;quot;BC&amp;quot; then&lt;br /&gt;
		bc = &amp;quot;&amp;amp;nbsp;BC&amp;quot; -- prepend the space. **internationalise later**&lt;br /&gt;
	else&lt;br /&gt;
		bc = &amp;quot;&amp;amp;nbsp;BCE&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local postchrist = true -- start by assuming no BCE&lt;br /&gt;
	local dateparts = {}&lt;br /&gt;
	for word in string.gmatch(dateval, &amp;quot;%w+&amp;quot;) do&lt;br /&gt;
		if word == &amp;quot;BCE&amp;quot; or word == &amp;quot;BC&amp;quot; then -- **internationalise later**&lt;br /&gt;
			postchrist = false&lt;br /&gt;
		else&lt;br /&gt;
			-- we&amp;#039;ll keep the parts that are not &amp;#039;BCE&amp;#039; in a table&lt;br /&gt;
			dateparts[#dateparts + 1] =  word&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if postchrist then bc = &amp;quot;&amp;quot; end -- set AD dates to no suffix **internationalise later**&lt;br /&gt;
	&lt;br /&gt;
	local sep = &amp;quot;&amp;amp;nbsp;&amp;quot; -- separator is nbsp&lt;br /&gt;
	local fdate = table.concat(dateparts, &amp;quot;&amp;amp;nbsp;&amp;quot;) -- formatted date defaults to same order as input&lt;br /&gt;
	&lt;br /&gt;
	-- if we have day month year, check dateformat&lt;br /&gt;
	if #dateparts == 3 then&lt;br /&gt;
		if dateformat == &amp;quot;y&amp;quot; then&lt;br /&gt;
			fdate = dateparts[3]&lt;br /&gt;
		elseif dateformat == &amp;quot;mdy&amp;quot; then&lt;br /&gt;
			fdate = dateparts[2] .. sep .. dateparts[1] .. &amp;quot;,&amp;quot; .. sep .. dateparts[3]&lt;br /&gt;
		end&lt;br /&gt;
	elseif #dateparts == 2 and dateformat == &amp;quot;y&amp;quot; then&lt;br /&gt;
		fdate = dateparts[2]&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return fdate .. bc&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- parseParam takes a (string) parameter, e.g. from the list of frame arguments,&lt;br /&gt;
-- and makes &amp;quot;false&amp;quot;, &amp;quot;no&amp;quot;, and &amp;quot;0&amp;quot; into the (boolean) false&lt;br /&gt;
-- it makes the empty string and nil into the (boolean) value passed as default&lt;br /&gt;
-- allowing the parameter to be true or false by default.&lt;br /&gt;
local parseParam = function(param, default)&lt;br /&gt;
	if param and (#param &amp;gt; 0) then&lt;br /&gt;
		param = param:lower()&lt;br /&gt;
		if (param == &amp;quot;false&amp;quot;) or (param == &amp;quot;no&amp;quot;) or (param == &amp;quot;0&amp;quot;) then&lt;br /&gt;
			return false&lt;br /&gt;
		else&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return default&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- The label in a Wikidata item is subject to vulnerabilities &lt;br /&gt;
-- that an attacker might try to exploit.&lt;br /&gt;
-- It needs to be &amp;#039;sanitised&amp;#039; by removing any wikitext before use.&lt;br /&gt;
-- If it doesn&amp;#039;t exist, just return the id for the item&lt;br /&gt;
local labelOrId = function (id)&lt;br /&gt;
	local label = mw.wikibase.label(id)&lt;br /&gt;
	if label then&lt;br /&gt;
		return mw.text.nowiki(label)&lt;br /&gt;
	else&lt;br /&gt;
		return id&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- sourced takes a table representing a statement that may or may not have references&lt;br /&gt;
-- it counts how many references are sourced to something not contianing the word &amp;quot;iranpedia&amp;quot;&lt;br /&gt;
-- the reference string &amp;quot;ref&amp;quot; is available for debugging&lt;br /&gt;
-- it returns a boolean = true if there are any sourced references.&lt;br /&gt;
local sourced = function(claim)&lt;br /&gt;
	local refs = 0&lt;br /&gt;
	if claim.references then&lt;br /&gt;
		for kr, vr in pairs(claim.references) do&lt;br /&gt;
			local ref = mw.wikibase.renderSnaks(vr.snaks)&lt;br /&gt;
			if not ref:find(&amp;quot;Iranpedia&amp;quot;) then refs = refs + 1 end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return refs &amp;gt; 0&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- parseInput processes the Q-id , the blacklist and the whitelist&lt;br /&gt;
-- if an input parameter is supplied, it returns that and ends the call.&lt;br /&gt;
-- it returns a boolean indicating whether or not the call should continue&lt;br /&gt;
-- and an object containing all of the Wikidata for the Qid supplied or the current page&lt;br /&gt;
local parseInput = function(frame, input_parm, property_id)&lt;br /&gt;
	-- can take a named parameter |qid which is the Wikidata ID for the article.&lt;br /&gt;
	-- This will not normally be used because it&amp;#039;s an expensive call.&lt;br /&gt;
	local qid = frame.args.qid&lt;br /&gt;
	if qid and (#qid == 0) then qid = nil end&lt;br /&gt;
	&lt;br /&gt;
	-- The blacklist is passed in named parameter |suppressfields&lt;br /&gt;
	local blacklist = frame.args.suppressfields&lt;br /&gt;
	&lt;br /&gt;
	-- The whitelist is passed in named parameter |fetchwikidata&lt;br /&gt;
	local whitelist = frame.args.fetchwikidata&lt;br /&gt;
	&lt;br /&gt;
	-- The name of the field that this function is called from is passed in named parameter |name&lt;br /&gt;
	local fieldname = frame.args.name&lt;br /&gt;
	if blacklist then&lt;br /&gt;
		-- The name is compulsory when blacklist is used, so return nil if it is not supplied&lt;br /&gt;
		if not fieldname or (#fieldname == 0) then return false, nil, nil end&lt;br /&gt;
		-- If this field is on the blacklist, then return nil&lt;br /&gt;
		if blacklist:find(fieldname) then return false, nil, nil end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- If we got this far then we&amp;#039;re not on the blacklist&lt;br /&gt;
	-- The blacklist overrides any locally supplied parameter as well&lt;br /&gt;
	-- If a non-blank input parameter was supplied return it&lt;br /&gt;
	if input_parm then return false, input_parm, nil end&lt;br /&gt;
	&lt;br /&gt;
	-- Otherwise see if this field is on the whitelist:&lt;br /&gt;
	if not (whitelist and (whitelist == &amp;#039;ALL&amp;#039; or whitelist:find(fieldname))) then&lt;br /&gt;
		-- not on the whitelist so just return what should be a nil input parameter&lt;br /&gt;
		return false, input_parm, nil&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- See what&amp;#039;s on Wikidata:&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(qid)&lt;br /&gt;
	if entity and entity.claims then&lt;br /&gt;
		local props = entity.claims[property_id]&lt;br /&gt;
		if props and props[1] then &lt;br /&gt;
			return true, entity, props&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- no property on Wikidata&lt;br /&gt;
	return false, input_parm, nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function _getvalue(frame, entity, props, filter, propertyID) &lt;br /&gt;
	-- onlysourced is a boolean passed to return only values sourced to other than Iranpedia&lt;br /&gt;
	-- if nothing or an empty string is passed set it true&lt;br /&gt;
	-- if &amp;quot;false&amp;quot; or &amp;quot;no&amp;quot; or &amp;quot;0&amp;quot; is passed set it false&lt;br /&gt;
	local onlysrc = parseParam(frame.args.onlysourced, true)&lt;br /&gt;
	&lt;br /&gt;
	-- noicon is a boolean passed to suppress the trailing &amp;quot;edit at Wikidata&amp;quot; icon&lt;br /&gt;
	-- for use when the value is processed further by the infobox&lt;br /&gt;
	-- if nothing or an empty string is passed set it false&lt;br /&gt;
	-- if &amp;quot;false&amp;quot; or &amp;quot;no&amp;quot; or &amp;quot;0&amp;quot; is passed set it false&lt;br /&gt;
	local noic = parseParam(frame.args.noicon, false)&lt;br /&gt;
	&lt;br /&gt;
	-- wdlinks is a boolean passed to enable links to Wikidata when no article exists&lt;br /&gt;
	-- if nothing or an empty string is passed set it false&lt;br /&gt;
	-- if &amp;quot;false&amp;quot; or &amp;quot;no&amp;quot; or &amp;quot;0&amp;quot; is passed set it false&lt;br /&gt;
	local wdl = parseParam(frame.args.wdlinks, false)&lt;br /&gt;
	&lt;br /&gt;
	-- sorted is a boolean passed to enable sorting of the values returned&lt;br /&gt;
	-- if nothing or an empty string is passed set it false&lt;br /&gt;
	-- if &amp;quot;false&amp;quot; or &amp;quot;no&amp;quot; or &amp;quot;0&amp;quot; is passed set it false&lt;br /&gt;
	local sorted = parseParam(frame.args.sorted, false)&lt;br /&gt;
	&lt;br /&gt;
	-- separator is a string that is used to separate multiple returned values&lt;br /&gt;
	-- if nothing or an empty string is passed set it to the default&lt;br /&gt;
	-- any double-quotes &amp;quot; are stripped out, so that spaces may be passed&lt;br /&gt;
	-- e.g. |sep=&amp;quot; - &amp;quot;&lt;br /&gt;
	local sepdefault = &amp;quot;, &amp;quot; -- **internationalise later**&lt;br /&gt;
	local separator = frame.args.sep or &amp;quot;&amp;quot;&lt;br /&gt;
	separator = string.gsub(separator, &amp;#039;&amp;quot;&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	if #separator == 0 then&lt;br /&gt;
		separator = sepdefault&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- list is a string that may be &amp;quot;&amp;quot;, &amp;quot;hlist&amp;quot; or &amp;quot;ubl&amp;quot;&lt;br /&gt;
	-- this controls whether multiple values are output as comma-separated&lt;br /&gt;
	-- as a horizontal list (hlist) or unbulleted list (ubl)&lt;br /&gt;
	local list = frame.args.list or &amp;quot;&amp;quot;&lt;br /&gt;
	if list~=&amp;quot;hlist&amp;quot; and list~=&amp;quot;ubl&amp;quot; then list = &amp;quot;&amp;quot; end&lt;br /&gt;
	&lt;br /&gt;
	-- So now we have something to return: deal with (1) a Wikibase-entity; (3) a date; (3) anything else&lt;br /&gt;
	local lang = mw.language.getContentLanguage().code&lt;br /&gt;
	local thisQid = entity.id&lt;br /&gt;
	-- table &amp;#039;out&amp;#039; is going to to store the return value(s):&lt;br /&gt;
	local out = {}&lt;br /&gt;
	local icon = &amp;quot; [[File:Blue pencil.svg |frameless |text-top |10px |alt=Edit this on Wikidata |link=https://www.wikidata.org/wiki/&amp;quot; .. thisQid .. &amp;quot;?uselang=&amp;quot; .. lang .. &amp;quot;#&amp;quot; .. propertyID .. &amp;quot;|Edit this on Wikidata]]&amp;quot;&lt;br /&gt;
	if props[1].mainsnak.datatype == &amp;quot;wikibase-item&amp;quot; then&lt;br /&gt;
		-- it&amp;#039;s wiki-linked value, so output as link if possible&lt;br /&gt;
		for k, v in pairs(props) do&lt;br /&gt;
			if filter(v) and ((onlysrc == false) or sourced(v)) then -- has valid refs or all values required&lt;br /&gt;
				if v.mainsnak.snaktype == &amp;quot;somevalue&amp;quot; then -- check for value is unknown&lt;br /&gt;
					out[#out + 1] = &amp;quot;Unknown&amp;quot;&lt;br /&gt;
				elseif v.mainsnak.snaktype == &amp;quot;novalue&amp;quot; then -- check for value is none&lt;br /&gt;
					-- out[#out + 1] = &amp;quot;No value&amp;quot; -- don&amp;#039;t return a value for this&lt;br /&gt;
				else&lt;br /&gt;
					local qnumber = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
					local sitelink = mw.wikibase.sitelink(qnumber)&lt;br /&gt;
					local label = labelOrId(qnumber)&lt;br /&gt;
					if sitelink then&lt;br /&gt;
						out[#out + 1] = &amp;quot;[[&amp;quot; .. sitelink .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
					else&lt;br /&gt;
						-- no sitelink, so check first for a redirect with that label&lt;br /&gt;
						local artitle = mw.title.new(label, 0)&lt;br /&gt;
						if artitle.id &amp;gt; 0 then&lt;br /&gt;
							if artitle.isRedirect then&lt;br /&gt;
								-- no sitelink, but there&amp;#039;s a redirect with the same title as the label&lt;br /&gt;
								-- let&amp;#039;s link to that&lt;br /&gt;
								out[#out + 1] = &amp;quot;[[&amp;quot; .. label .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
							else&lt;br /&gt;
								-- no sitelink and not a redirect but an article exists with the same title as the label&lt;br /&gt;
								-- that&amp;#039;s probably a dab page, so output the plain label&lt;br /&gt;
								out[#out + 1] = label&lt;br /&gt;
							end&lt;br /&gt;
						else&lt;br /&gt;
							-- no article or redirect with the same title as the label&lt;br /&gt;
							if wdl then&lt;br /&gt;
								-- show that there&amp;#039;s a Wikidata entry available&lt;br /&gt;
								out[#out + 1] = &amp;quot;[[:d:Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;amp;nbsp;&amp;lt;span title=&amp;#039;&amp;quot; .. i18n[&amp;quot;errors&amp;quot;][&amp;quot;local-article-not-found&amp;quot;] .. &amp;quot;&amp;#039;&amp;gt;[[File:Wikidata-logo.svg|16px|alt=|link=]]&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
							else&lt;br /&gt;
								-- no wikidata links required, so just give the plain label&lt;br /&gt;
								out[#out + 1] = label&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;
	elseif props[1].mainsnak.datatype == &amp;quot;time&amp;quot; then&lt;br /&gt;
		-- it&amp;#039;s a date value, so output according to formatting preferences&lt;br /&gt;
		for k, v in pairs(props) do&lt;br /&gt;
			-- check for references, and count valid references&lt;br /&gt;
			if filter(v) and ((onlysrc == false) or sourced(v)) then&lt;br /&gt;
				if v.mainsnak.snaktype == &amp;quot;somevalue&amp;quot; then -- check for value is unknown&lt;br /&gt;
					out[#out + 1] = &amp;quot;Unknown&amp;quot;&lt;br /&gt;
				elseif v.mainsnak.snaktype == &amp;quot;novalue&amp;quot; then -- check for value is none&lt;br /&gt;
					-- out[#out + 1] = &amp;quot;No value&amp;quot; -- don&amp;#039;t return a value for this&lt;br /&gt;
				else&lt;br /&gt;
					local timestamp = v.mainsnak.datavalue.value.time&lt;br /&gt;
					-- A year can be stored like this: &amp;quot;+1872-00-00T00:00:00Z&amp;quot;,&lt;br /&gt;
					-- which is processed here as if it were the day before &amp;quot;+1872-01-01T00:00:00Z&amp;quot;,&lt;br /&gt;
					-- and that&amp;#039;s the last day of 1871, so the year is wrong.&lt;br /&gt;
					-- So fix the month 0, day 0 timestamp to become 1 January instead:&lt;br /&gt;
					timestamp = timestamp:gsub(&amp;quot;%-00%-00T&amp;quot;, &amp;quot;-01-01T&amp;quot;)&lt;br /&gt;
					local dateprecision = v.mainsnak.datavalue.value.precision&lt;br /&gt;
					local dateformat = &amp;quot;y&amp;quot;&lt;br /&gt;
					local fpvdate = tonumber(timestamp:sub(2, 5))&lt;br /&gt;
					if timestamp:sub(1, 1) == &amp;quot;-&amp;quot; then&lt;br /&gt;
						fpvdate = fpvdate .. &amp;quot; BCE&amp;quot;&lt;br /&gt;
					end&lt;br /&gt;
					if dateprecision &amp;gt; 9 then -- add month&lt;br /&gt;
						fpvdate = i18n.months[tonumber(timestamp:sub(7, 8))] .. &amp;quot; &amp;quot; .. fpvdate&lt;br /&gt;
						dateformat = frame.args.df&lt;br /&gt;
					end&lt;br /&gt;
					if dateprecision &amp;gt; 10 then -- add day&lt;br /&gt;
							fpvdate = tonumber(timestamp:sub(10, 11)) .. &amp;quot; &amp;quot; .. fpvdate&lt;br /&gt;
					end&lt;br /&gt;
					out[#out+1] = format_Date(fpvdate, dateformat, frame.args.bc)&lt;br /&gt;
				end -- check for unknown value&lt;br /&gt;
			end -- check for sourced&lt;br /&gt;
		end -- loop through k-v pairs&lt;br /&gt;
	else&lt;br /&gt;
		-- not a linkable article title or a date&lt;br /&gt;
		-- this needs to be expanded to cater for multiple values&lt;br /&gt;
		local reflist = &amp;quot;&amp;quot;&lt;br /&gt;
		local refs = 0&lt;br /&gt;
		for k, v in pairs(props) do&lt;br /&gt;
			-- check for references,&lt;br /&gt;
			-- construct a reference list for debugging&lt;br /&gt;
			-- and count valid references&lt;br /&gt;
			if v.references then&lt;br /&gt;
				for kr, vr in pairs(v.references) do&lt;br /&gt;
					local ref = mw.wikibase.renderSnaks(vr.snaks)&lt;br /&gt;
					reflist = reflist .. &amp;quot; &amp;lt;span style=&amp;#039;color:#0DD;&amp;#039;&amp;gt;&amp;quot; .. ref .. &amp;quot;&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
					if not ref:find(&amp;quot;Iranpedia&amp;quot;) then refs = refs + 1 end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		local propertyValue = entity:formatPropertyValues(propertyID).value&lt;br /&gt;
		if (refs &amp;gt; 0) or (onlysrc == false) then -- has valid refs or all values required&lt;br /&gt;
			out[#out+1] = propertyValue&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- if there&amp;#039;s anything to return, then return a list&lt;br /&gt;
	-- comma-separated by default, but may be specified by the sep parameter&lt;br /&gt;
	-- optionally specify a hlist or &lt;br /&gt;
	if #out &amp;gt; 0 then&lt;br /&gt;
		if sorted then table.sort(out) end&lt;br /&gt;
		if list == &amp;quot;hlist&amp;quot; then&lt;br /&gt;
			return frame:expandTemplate{title = &amp;#039;Hlist&amp;#039;, args = out}&lt;br /&gt;
		elseif list == &amp;quot;ubl&amp;quot; then&lt;br /&gt;
			return frame:expandTemplate{title = &amp;#039;Unbulleted list&amp;#039;, args = out}&lt;br /&gt;
		else&lt;br /&gt;
			if noic then&lt;br /&gt;
				return table.concat(out, separator)&lt;br /&gt;
			else&lt;br /&gt;
				return table.concat(out, separator) .. icon&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return nil -- no items had valid reference&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- Public functions&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getValue is used to get a value, or a comma separated list of them if multiple values exist&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
p.getValue = function(frame)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	-- There may be a local parameter supplied, if it&amp;#039;s blank, set it to nil&lt;br /&gt;
	local input_parm =  mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if input_parm and (#input_parm == 0) then input_parm = nil end&lt;br /&gt;
	local success, errorOrEntity, props = parseInput(frame, input_parm, propertyID)&lt;br /&gt;
	if not success then&lt;br /&gt;
		return errorOrEntity&lt;br /&gt;
	else&lt;br /&gt;
		entity = errorOrEntity&lt;br /&gt;
	end&lt;br /&gt;
	local function filter(claim)&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
	return _getvalue(frame, entity, props, filter, propertyID)&lt;br /&gt;
end&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getPreferredValue is used to get a value, or a comma separated list of them if multiple values exist&lt;br /&gt;
-- If preferred ranks are set, it will return those values, otherwise values with normal ranks&lt;br /&gt;
--&lt;br /&gt;
p.getPreferredValue = function(frame)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	-- There may be a local parameter supplied, if it&amp;#039;s blank, set it to nil&lt;br /&gt;
	local input_parm =  mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if input_parm and (#input_parm == 0) then input_parm = nil end&lt;br /&gt;
	local success, errorOrEntity, props = parseInput(frame, input_parm, propertyID)&lt;br /&gt;
	if not success then&lt;br /&gt;
		return errorOrEntity&lt;br /&gt;
	else&lt;br /&gt;
		entity = errorOrEntity&lt;br /&gt;
	end&lt;br /&gt;
	local prefflag = false&lt;br /&gt;
	for k, v in pairs(props) do&lt;br /&gt;
		if v.rank == &amp;quot;preferred&amp;quot; then &lt;br /&gt;
			prefflag = true &lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local function filter(claim)&lt;br /&gt;
		return claim.rank == &amp;quot;preferred&amp;quot; or prefflag == false&lt;br /&gt;
	end&lt;br /&gt;
	return _getvalue(frame, entity, props, filter, propertyID)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getSourcedValue is used to get a value, or a comma separated list of them if multiple values exist&lt;br /&gt;
-- but only values that are sourced are returned&lt;br /&gt;
-- redundant to getValue with onlysourced=true but kept for backwards compatibility&lt;br /&gt;
-- now defined via getValue&lt;br /&gt;
--&lt;br /&gt;
p.getSourcedValue = function(frame)&lt;br /&gt;
	frame.args.onlysourced = &amp;quot;yes&amp;quot;&lt;br /&gt;
	return p.getValue(frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getCoords is used to get coordinates for display in an infobox&lt;br /&gt;
-- whitelist and blacklist are implemented&lt;br /&gt;
-- optional &amp;#039;display&amp;#039; parameter is allowed, defaults to &amp;quot;inline, title&amp;quot;&lt;br /&gt;
--&lt;br /&gt;
p.getCoords = function(frame)&lt;br /&gt;
	local propertyID = &amp;quot;P625&amp;quot;&lt;br /&gt;
	local input_parm =  mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if input_parm and (#input_parm == 0) then input_parm = nil end&lt;br /&gt;
	&lt;br /&gt;
	-- if there is a &amp;#039;display&amp;#039; parameter supplied, use it&lt;br /&gt;
	-- otherwise default to &amp;quot;inline, title&amp;quot;&lt;br /&gt;
	local disp = frame.args.display&lt;br /&gt;
	if (not disp) or (#disp == 0) then&lt;br /&gt;
		disp = &amp;quot;inline, title&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local success, errorOrEntity = parseInput(frame, input_parm, property_id)&lt;br /&gt;
	if not success then&lt;br /&gt;
		return errorOrEntity&lt;br /&gt;
	else&lt;br /&gt;
		local entity = errorOrEntity&lt;br /&gt;
		local lat_long = {}&lt;br /&gt;
		local coords = entity:formatPropertyValues(propertyID).value&lt;br /&gt;
		-- the latitude and longitude are returned like this: nn°nn&amp;amp;#39;nn.n&amp;amp;#34;&lt;br /&gt;
		-- using html entities with hex values really screws up parsing the numbers - thanks devs&lt;br /&gt;
		local lat = mw.ustring.match(coords, &amp;quot;^[^,]*&amp;quot;)  -- everything from the start to before the comma&lt;br /&gt;
		local long = mw.ustring.match(coords, &amp;quot;[^ ]*$&amp;quot;) -- everything from after the space to the end&lt;br /&gt;
		lat = lat:gsub(&amp;quot;&amp;amp;#%d%d;&amp;quot;, &amp;quot;:&amp;quot;)                  -- clean out the html entities&lt;br /&gt;
		long = long:gsub(&amp;quot;&amp;amp;#%d%d;&amp;quot;, &amp;quot;:&amp;quot;)                -- clean out the html entities&lt;br /&gt;
		-- read the latitude numbers into a table&lt;br /&gt;
		for num in mw.ustring.gmatch(lat, &amp;quot;%d+%.?%d*&amp;quot;) do&lt;br /&gt;
  			lat_long[#lat_long + 1] = num&lt;br /&gt;
		end&lt;br /&gt;
		-- add the N/S&lt;br /&gt;
		lat_long[#lat_long + 1] = lat:sub(-1)&lt;br /&gt;
		-- read the longitude numbers into a table&lt;br /&gt;
		for num in mw.ustring.gmatch(long, &amp;quot;%d+%.?%d*&amp;quot;) do&lt;br /&gt;
			lat_long[#lat_long + 1] = num&lt;br /&gt;
		end&lt;br /&gt;
		-- add E/W for long&lt;br /&gt;
		lat_long[#lat_long + 1] = long:sub(-1)&lt;br /&gt;
		-- add named parameter for display&lt;br /&gt;
		lat_long[&amp;quot;display&amp;quot;] = disp&lt;br /&gt;
		-- invoke template Coord with the values stored in the table&lt;br /&gt;
		return frame:expandTemplate{title = &amp;#039;coord&amp;#039;, args = lat_long}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getQualifierValue is used to get a formatted value of a qualifier&lt;br /&gt;
-- &lt;br /&gt;
-- The call needs:	a property (the unnamed parameter or 1=)&lt;br /&gt;
-- 					a target value for that property (pval=)&lt;br /&gt;
--					a qualifier for that target value (qual=)&lt;br /&gt;
-- The usual whitelisting and blacklisting of the property is implemented&lt;br /&gt;
-- The boolean onlysourced= parameter can be set to return nothing&lt;br /&gt;
-- when the property is unsourced (or only sourced to Iranpedia)&lt;br /&gt;
-- &lt;br /&gt;
p.getQualifierValue = function(frame)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- The PropertyID of the target value of the property&lt;br /&gt;
	-- whose qualifier is to be returned is passed in named parameter |pval=&lt;br /&gt;
	local propvalue = frame.args.pval&lt;br /&gt;
	&lt;br /&gt;
	-- The PropertyID of the qualifier&lt;br /&gt;
	-- whose value is to be returned is passed in named parameter |qual=&lt;br /&gt;
	local qualifierID = frame.args.qual&lt;br /&gt;
&lt;br /&gt;
	-- onlysourced is a boolean passed to return qualifiers&lt;br /&gt;
	-- only when property values are sourced to something other than Iranpedia&lt;br /&gt;
	-- if nothing or an empty string is passed set it false&lt;br /&gt;
	-- if &amp;quot;false&amp;quot; or &amp;quot;no&amp;quot; or 0 is passed set it false&lt;br /&gt;
	local onlysrc = parseParam(frame.args.onlysourced,false)&lt;br /&gt;
	&lt;br /&gt;
	local success, errorOrEntity, props = parseInput(frame,nil, propertyID)&lt;br /&gt;
	if not success then&lt;br /&gt;
		return errorOrEntity&lt;br /&gt;
	else&lt;br /&gt;
		local entity = errorOrEntity&lt;br /&gt;
		-- Scan through the values of the property&lt;br /&gt;
		-- we want something like property is P793, significant event (in propertyID)&lt;br /&gt;
		-- whose value is something like Q385378, construction (in propvalue)&lt;br /&gt;
		-- then we can return the value(s) of a qualifier such as P580, start time (in qualifierID)&lt;br /&gt;
		for k1, v1 in pairs(props) do&lt;br /&gt;
			if v1.mainsnak.snaktype == &amp;quot;value&amp;quot; and v1.mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot; then&lt;br /&gt;
				-- It&amp;#039;s a wiki-linked value, so check if it&amp;#039;s the target (in propvalue)&lt;br /&gt;
				-- and if it has qualifiers&lt;br /&gt;
				if v1.mainsnak.datavalue.value.id == propvalue and v1.qualifiers then&lt;br /&gt;
					if (onlysrc == true) and not sourced(v1) then&lt;br /&gt;
						return&lt;br /&gt;
					end&lt;br /&gt;
					-- if we&amp;#039;ve got this far, we have a (sourced) claim with qualifiers&lt;br /&gt;
					-- which matches the target, so find the value(s) of the qualifier we want&lt;br /&gt;
					local quals = v1.qualifiers[qualifierID]&lt;br /&gt;
					local out = {}&lt;br /&gt;
					if quals then&lt;br /&gt;
						if quals[1].datatype == &amp;quot;wikibase-item&amp;quot; then&lt;br /&gt;
							for k2, v2 in pairs(quals) do&lt;br /&gt;
								local valueID = v2.datavalue.value.id&lt;br /&gt;
								local sitelink = mw.wikibase.sitelink(valueID)&lt;br /&gt;
								local label = labelOrId(valueID)&lt;br /&gt;
								if sitelink then&lt;br /&gt;
									out[#out + 1] = &amp;quot;[[&amp;quot; .. sitelink .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
								else&lt;br /&gt;
									out[#out + 1] = &amp;quot;[[:d:&amp;quot; .. valueID .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;amp;nbsp;&amp;lt;span title=&amp;#039;&amp;quot; .. i18n[&amp;quot;errors&amp;quot;][&amp;quot;local-article-not-found&amp;quot;] .. &amp;quot;&amp;#039;&amp;gt;[[File:Wikidata-logo.svg|16px|alt=|link=]]&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
							return table.concat(out, &amp;quot;, &amp;quot;)&lt;br /&gt;
						else&lt;br /&gt;
							return mw.wikibase.renderSnaks(quals)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end -- of loop through values of propertyID&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getLink returns the label for a Qid wiki-linked to the local article (if the article exists)&lt;br /&gt;
-- if label doesn&amp;#039;t exist, it returns the Qid wiki-linked to the local article (if the article exists)&lt;br /&gt;
--&lt;br /&gt;
p.getLink = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if itemID == &amp;quot;&amp;quot; then return end&lt;br /&gt;
	local sitelink = mw.wikibase.sitelink(itemID)&lt;br /&gt;
	local label = labelOrId(itemID)&lt;br /&gt;
	if sitelink then&lt;br /&gt;
		return &amp;quot;[[&amp;quot; .. sitelink .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return label&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getLabel returns the label for a Qid&lt;br /&gt;
-- if label doesn&amp;#039;t exist, it returns the Qid&lt;br /&gt;
--&lt;br /&gt;
p.getLabel = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if itemID == &amp;quot;&amp;quot; then return end&lt;br /&gt;
	return labelOrId(itemID)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- getAT returns the article title for a Qid&lt;br /&gt;
-- or nothing if it doesn&amp;#039;t exist&lt;br /&gt;
--&lt;br /&gt;
p.getAT = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if itemID == &amp;quot;&amp;quot; then return end&lt;br /&gt;
	return mw.wikibase.sitelink(itemID)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- formatDate is a wrapper to export the private function format_Date&lt;br /&gt;
--&lt;br /&gt;
p.formatDate = function(frame)&lt;br /&gt;
	return format_Date(frame.args[1], frame.args.df, frame.args.bc)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------------------------&lt;br /&gt;
-- checkBlacklist allows a test to check whether a named field is suppressed&lt;br /&gt;
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}&lt;br /&gt;
-- displays &amp;quot;blacklisted&amp;quot;&lt;br /&gt;
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Jim |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}&lt;br /&gt;
-- displays &amp;quot;not blacklisted&amp;quot;&lt;br /&gt;
--&lt;br /&gt;
p.checkBlacklist = function(frame)&lt;br /&gt;
	local blacklist = frame.args.suppressfields&lt;br /&gt;
	local fieldname = frame.args.name&lt;br /&gt;
	if blacklist and fieldname then&lt;br /&gt;
		if blacklist:find(fieldname) then return nil end&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Mahan</name></author>
	</entry>
</feed>