<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AWikidata2%2Ffunctions2</id>
	<title>وحدة:Wikidata2/functions2 - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AWikidata2%2Ffunctions2"/>
	<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions2&amp;action=history"/>
	<updated>2026-06-05T02:21:02Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.43.7</generator>
	<entry>
		<id>https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions2&amp;diff=2701&amp;oldid=prev</id>
		<title>عبد العزيز في 20:45، 29 أغسطس 2023</title>
		<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions2&amp;diff=2701&amp;oldid=prev"/>
		<updated>2023-08-29T20:45:35Z</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;local help_functions = {}&lt;br /&gt;
&lt;br /&gt;
help_functions.sortingproperties = {&amp;quot;P585&amp;quot;, &amp;quot;P571&amp;quot;, &amp;quot;P580&amp;quot;, &amp;quot;P569&amp;quot;, &amp;quot;P582&amp;quot;, &amp;quot;P570&amp;quot;}&lt;br /&gt;
help_functions.sorting_methods = {&lt;br /&gt;
	[&amp;quot;chronological&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;تصاعدي&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;asc&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;inverted&amp;quot;] = &amp;quot;inverted&amp;quot;,&lt;br /&gt;
	[&amp;quot;تنازلي&amp;quot;] = &amp;quot;inverted&amp;quot;,&lt;br /&gt;
	[&amp;quot;desc&amp;quot;] = &amp;quot;inverted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function help_functions.comparedates(a, b) -- returns true if a is earlier than B or if a has a date but not b&lt;br /&gt;
	if a and b then&lt;br /&gt;
		return a &amp;gt; b&lt;br /&gt;
	elseif a then&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.getqualifierbysortingproperty(claim, sortingproperty)&lt;br /&gt;
	for k, v in pairs(sortingproperty) do&lt;br /&gt;
		if claim.qualifiers and claim.qualifiers[v] and claim.qualifiers[v][1].snaktype == &amp;quot;value&amp;quot; then&lt;br /&gt;
			local vali = claim.qualifiers[v][1].datavalue.value.time or claim.qualifiers[v][1].datavalue.value.amount&lt;br /&gt;
			if vali:sub(1, 1) == &amp;quot;+&amp;quot; then&lt;br /&gt;
				vali = vali:sub(2)&lt;br /&gt;
			end&lt;br /&gt;
			--mw.log(vali)&lt;br /&gt;
			return vali&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.get_sorting_properties(options)&lt;br /&gt;
	if type(options.sortingproperty) == &amp;quot;table&amp;quot; then&lt;br /&gt;
		return options.sortingproperty&lt;br /&gt;
	elseif type(options.sortingproperty) == &amp;quot;string&amp;quot; and options.sortingproperty ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		return mw.text.split(options.sortingproperty, &amp;quot;,&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		return help_functions.sortingproperties&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.sortbyqualifiernumber(claims, sorting_properties, options)&lt;br /&gt;
	if not sorting_properties or #sorting_properties == 0 then&lt;br /&gt;
		sorting_properties = help_functions.get_sorting_properties(options)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local sort_by = help_functions.sorting_methods[options.sortbynumber] or options.sortbynumber&lt;br /&gt;
&lt;br /&gt;
	table.sort(&lt;br /&gt;
		claims,&lt;br /&gt;
		function(a, b)&lt;br /&gt;
			local timeA = help_functions.getqualifierbysortingproperty(a, sorting_properties)&lt;br /&gt;
			local timeB = help_functions.getqualifierbysortingproperty(b, sorting_properties)&lt;br /&gt;
			if sort_by == &amp;quot;inverted&amp;quot; then&lt;br /&gt;
				return help_functions.comparedates(timeB, timeA)&lt;br /&gt;
			else&lt;br /&gt;
				return help_functions.comparedates(timeA, timeB)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	)&lt;br /&gt;
	return claims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return help_functions&lt;/div&gt;</summary>
		<author><name>عبد العزيز</name></author>
	</entry>
</feed>