ماڈیول:Uses Wikidata/datatype

آزاد دائرۃ المعارف، ویکیپیڈیا سے
Documentation icon دستاویز [تخلیق]
local p = {}

local datatype =  {
	['url'] = {856, 1348, 1421, 1991, 2035},
	['globe-coordinate'] ={625},
	['string'] ={215, 225, 229, 230, 233, 238, 239, 274, 281, 348, 373, 393, 395, 426, 465, 473, 474, 487, 490, 555, 558, 564, 591, 593, 627, 798, 835, 935, 940, 1036, 1149, 1195, 1329, 1402, 1545, 1554, 1618, 1630, 1993, 2317},
	['time'] ={569, 570, 571, 575, 576, 577, 580, 582, 585, 606, 619, 620, 621, 729, 730, 746, 1191, 1619},
	['math']={2534},
	['external-id']={214, 231, 232, 234, 235, 243, 267, 278, 297, 300, 345, 428, 458, 486, 492, 493, 494, 498, 557, 563, 586, 592, 594, 604, 639, 646, 652, 657, 661, 662, 665, 668, 672, 673, 679, 683, 685, 687, 695, 704, 715, 757, 815, 830, 838, 842, 846, 850, 938, 957, 959, 960, 961, 962, 1070, 1237, 1323, 1391, 1409, 1447, 1469, 1562, 1566, 1579, 1690, 1691, 1693, 1712, 1727, 1746, 1747, 1761, 1772, 1832, 1895, 1940, 1992, 2002, 2003, 2013, 2019, 2026, 2036, 2040, 2090, 2327, 2397, 2426, 2434, 2566, 2574, 2847, 2963, 2969, 3040, 3047, 3083, 3135, 3136, 3265, 3267, 3836},
	['commonsMedia']={15, 18, 41, 51, 94, 109, 154, 181, 242, 367, 2425, 3383},
	['quantity'] ={1081, 1082, 1083, 1090, 1092, 1096, 1101, 1102, 1104, 1110, 1113, 1117, 1120, 1128, 1132, 1139, 1174, 1193, 1198, 1215, 1301, 1314, 1339, 1350, 1351, 1418, 1446, 1457, 1538, 1539, 1540, 1561, 1590, 1697, 1833, 1867, 1868, 1971, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2052, 2053, 2054, 2060, 2067, 2073, 2076, 2097, 2101, 2102, 2112, 2120, 2121, 2130, 2131, 2132, 2134, 2142, 2144, 2146, 2147, 2151, 2196, 2213, 2214, 2216, 2218, 2224, 2227, 2233, 2234, 2243, 2244, 2248, 2250, 2284, 2299, 2325, 2370, 2386, 2422, 2437, 2442, 2527, 2528, 2532, 2547, 2583, 2630, 2656, 2660, 2787, 2808, 2854, 2873, 3063, 3157, 3439, 3618},
	['wikibase-property']={1647, 1659},
	['wikibase-item']={6, 17, 19, 20, 21, 22, 25, 26, 27, 30, 31, 35, 36, 37, 38, 39, 40, 50, 53, 54, 57, 58, 59, 61, 65, 66, 69, 78, 84, 85, 86, 98, 101, 102, 103, 105, 106, 108, 111, 112, 115, 118, 119, 121, 122, 123, 127, 131, 135, 136, 137, 138, 140, 141, 144, 149, 155, 156, 157, 159, 161, 162, 163, 166, 169, 170, 171, 172, 175, 176, 177, 178, 179, 184, 185, 186, 190, 193, 194, 196, 208, 209, 237, 241, 263, 264, 272, 275, 276, 277, 279, 286, 287, 289, 291, 301, 306, 344, 355, 361, 364, 366, 375, 376, 397, 398, 400, 403, 404, 406, 407, 408, 410, 412, 413, 414, 418, 421, 437, 449, 450, 452, 461, 462, 463, 469, 479, 488, 495, 509, 511, 512, 516, 520, 522, 527, 533, 541, 542, 545, 551, 552, 559, 562, 566, 598, 607, 610, 624, 631, 634, 641, 664, 669, 676, 706, 710, 726, 737, 739, 741, 744, 748, 749, 750, 769, 793, 800, 802, 812, 814, 825, 828, 852, 885, 908, 914, 915, 921, 931, 943, 945, 974, 991, 1001, 1027, 1029, 1033, 1035, 1040, 1046, 1050, 1056, 1057, 1064, 1066, 1080, 1142, 1145, 1158, 1303, 1304, 1308, 1313, 1346, 1365, 1366, 1376, 1399, 1403, 1412, 1416, 1419, 1427, 1431, 1444, 1478, 1532, 1542, 1546, 1582, 1589, 1622, 1629, 1652, 1811, 1840, 1855, 1881, 1891, 1906, 1995, 2058, 2175, 2176, 2238, 2384, 2388, 2438, 2439, 2505, 2522, 2614, 2632, 2670, 2852, 2875, 2882, 3096, 3158, 3195, 3216, 3373},
	['monolingualtext']={1448, 1451, 1476, 1477, 1559, 1705}
 }

function p.gettype(id)
	local ttt = {}
	for k, i in pairs(datatype) do
		for num, ii in pairs(i) do
			ttt["P"..tostring(ii)] = k
			--mw.log(ii .. k )
		end
	end
	local va = ttt[id] or ""
	return va
end

function p.t(frame)
	--local parent = frame.getParent(frame)
	--local ii = parent.args["1"]
	local ii = frame.args[1]
	local result = p.gettype(ii)
	return result
end

return p