Modul:Authority control: Versiyalar orasidagi farq
Programmer (munozara | hissa) Oʻzbekcha Vikipediyadan import qilindi. |
Programmer (munozara | hissa) k test |
||
| Qator 743: | Qator 743: | ||
function p.getIdsFromWikidata( itemId, property ) | function p.getIdsFromWikidata( itemId, property ) | ||
local ids = {} | local ids = {} | ||
-- ZiyoSfera'da Wikibase Client o'rnatilmagan bo'lishi mumkin. | |||
-- Bunday holatda mw.wikibase nil bo'ladi; xato bermasdan bo'sh natija qaytaramiz. | |||
if not mw.wikibase or type( mw.wikibase.getBestStatements ) ~= 'function' then | |||
return ids | |||
end | |||
local statements = mw.wikibase.getBestStatements( itemId, property ) | local statements = mw.wikibase.getBestStatements( itemId, property ) | ||
if statements then | if statements then | ||
| Qator 755: | Qator 762: | ||
function p.matchesWikidataRequirements( itemId, reqs ) | function p.matchesWikidataRequirements( itemId, reqs ) | ||
-- Wikibase mavjud bo'lmasa Wikidata talablarini tekshirib bo'lmaydi. | |||
if not mw.wikibase or type( mw.wikibase.getBestStatements ) ~= 'function' then | |||
return false | |||
end | |||
for _, group in ipairs( reqs ) do | for _, group in ipairs( reqs ) do | ||
local property = 'P'..group[1] | local property = 'P'..group[1] | ||
| Qator 975: | Qator 987: | ||
end | end | ||
else | else | ||
itemId = mw.wikibase.getEntityIdForCurrentPage() | -- ZiyoSfera Wikibase Client ishlatmasa mw.wikibase mavjud bo'lmaydi. | ||
-- Shunda Wikidata fallback o'chadi, lekin qo'lda berilgan identifikatorlar ishlashda davom etadi. | |||
if mw.wikibase and type( mw.wikibase.getEntityIdForCurrentPage ) == 'function' then | |||
itemId = mw.wikibase.getEntityIdForCurrentPage() | |||
end | |||
end | end | ||