יחידה:WikidataQuantity
קפיצה לניווט
קפיצה לחיפוש
ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:WikidataQuantity/תיעוד
local p = {}
local Convert = require('Module:Convert')
local yesno = require('Module:Yesno')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
--[[
This function fills missing parameter using wikidata
]]
function crossValidateWikidata(propertyName, override)
local matching = nil
if override==nil then
return nil
end
matching = WikidataCrossValidation.crossValidate(override, propertyName)
if matching then
return WikidataCrossValidation.maintainceCategory(matching, propertyName)
end
end
function p.wikidata(frame)
local property = frame.args['ויקינתונים']
local override = frame.args['דריסה']
local unit = frame.args['יחידה']
local onevalueonly = yesno(frame.args['סינון']) or "off"
local display = frame.args['תצוגה'] or "out"
local entityId = frame:getParent().args['qid'] or mw.wikibase.getEntityIdForCurrentPage()
if override ~= nil and override~='' then
override = override .. ' ' .. unit
if entityId ~= nil then
local crossVal = crossValidateWikidata(property, override)
if crossVal then
override = override .. crossVal
end
end
return override
end
local wikidataRes = Convert.convert(frame:newChild{ args = {
['input'] = property,
[2] = unit,
['disp'] = display,
['qid'] = entityId,
['onevalueonly'] = onevalueonly,
['abbr']='off'
} }:newChild{})
return wikidataRes
end
return p