יחידה:תבנית מידע: הבדלים בין גרסאות בדף

מ תיקון קישור חסר וקישור בעברית
מ אפשרות סינון
שורה 344: שורה 344:
return nil
return nil
end
end
local res = propertyLink.getPropertyByOptions(propertyName, entityId, options)
local res = propertyLink.getPropertyByOptions(propertyName, entityId, options)
if res and #res == 0 then
return nil
end
if res then
if res then
local link = mw.title.makeTitle( 0, entityId, propertyName, 'wikidata' ):fullUrl('uselang=he')
local link = mw.title.makeTitle( 0, entityId, propertyName, 'wikidata' ):fullUrl('uselang=he')
שורה 350: שורה 355:
end
end
return res
return res
end
--[[
Filters statements to statements with existing links only
]]
function filterExists( propertyVals )
local tempVals = {}
    for i, property in ipairs(propertyVals) do
    local propValue = property.mainsnak and property.mainsnak.datavalue
    if propValue and propValue.value then
    local linkTarget = mw.wikibase.sitelink( propValue.value['id'] )
if linkTarget then
table.insert(tempVals, property)
end
end
end
return tempVals
end
end


שורה 359: שורה 381:
local hasData=false
local hasData=false
local maintainceCats = nil
local maintainceCats = nil
local propertyName = nil
local includeWikidataRef = frame and frame:getParent()
local includeWikidataRef = frame and frame:getParent()
if entityId == nil then return inWikidata, maintainceCats end -- early terminate
if entityId == nil then return inWikidata, maintainceCats end -- early terminate
שורה 368: שורה 389:
['source'] = includeWikidataRef
['source'] = includeWikidataRef
}
}
if templateParams[missingParam..'-ויקינתונים-סינון'] == 'קיים' then
wikidataOptions['filter'] = filterExists
end
if templateParams[missingParam..'-ויקינתונים-פרטים']~=nil then
if templateParams[missingParam..'-ויקינתונים-פרטים']~=nil then
wikidataOptions['qualifiers'] = { templateParams[missingParam..'-ויקינתונים-פרטים'] }
wikidataOptions['qualifiers'] = { templateParams[missingParam..'-ויקינתונים-פרטים'] }