יחידה:תבנית מידע: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מ השוואה לוויקינתונים |
||
| שורה 1: | שורה 1: | ||
local propertyLink = require('Module:PropertyLink') | local propertyLink = require('Module:PropertyLink') | ||
local WikidataCrossValidation = require('Module:WikidataCrossValidation') | |||
local Infobox = {} | local Infobox = {} | ||
function Infobox:new() | function Infobox:new() | ||
| שורה 358: | שורה 359: | ||
end | end | ||
--[[ | |||
This function fills missing parameter using wikidata | |||
]] | |||
function crossValidateWikidata(missingParam, templateParams, templateArg, frame) | |||
local matching = nil | |||
local propertyName | |||
if missingParam==nil then | |||
return nil | |||
end | |||
if templateParams[missingParam..'-ויקינתונים'] then | |||
propertyName = templateParams[missingParam..'-ויקינתונים'] | |||
matching = WikidataCrossValidation.crossValidate(templateArg.data, propertyName) | |||
elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then | |||
local genderAware = templateParams[missingParam..'-ויקינתונים-מגדר'] == 'כן' | |||
propertyName = templateParams[missingParam..'-ויקינתונים-מרובה'] | |||
matching = WikidataCrossValidation.crossValidate(templateArg.data, propertyName) | |||
end | |||
if matching then | |||
return WikidataCrossValidation.maintainceCategory(matching, propertyName) | |||
end | |||
end | |||
function Infobox:parseArgs(frame) | function Infobox:parseArgs(frame) | ||
| שורה 469: | שורה 494: | ||
else | else | ||
templateStructure[k]=nil | templateStructure[k]=nil | ||
end | |||
else | |||
local maintainceCats = crossValidateWikidata(v.label,templateParams, v, frame) | |||
if maintainceCats and #maintainceCats>0 then | |||
table.insert(wikidataCats, maintainceCats) | |||
end | end | ||
end | end | ||