יחידה:תבנית מידע: הבדלים בין גרסאות בדף
ניסוי |
|||
| שורה 300: | שורה 300: | ||
end | end | ||
end | end | ||
if | if wikidataArg then | ||
return propertyLink.getImageLink(wikidataArg, width) | return propertyLink.getImageLink(wikidataArg, width) | ||
end | end | ||
| שורה 319: | שורה 319: | ||
This function fills missing parameter using wikidata | This function fills missing parameter using wikidata | ||
]] | ]] | ||
function fillMissingParamFromWikidata(missingParam, templateParams, templateArg, frame) | function fillMissingParamFromWikidata(missingParam, templateParams, templateArg, frame) | ||
local inWikidata = false | local inWikidata = false | ||
| שורה 330: | שורה 324: | ||
local maintainceCats = nil | local maintainceCats = nil | ||
local propertyName = nil | local propertyName = nil | ||
if | if templateParams[missingParam..'-ויקינתונים'] then | ||
templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים']) or nil | templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים']) or nil | ||
inWikidata = templateArg.data and #(templateArg.data)>0 | inWikidata = templateArg.data and #(templateArg.data)>0 | ||
elseif | elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then | ||
templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים-מרובה'], true, false, nil, templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה'], templateParams[missingParam..'-ויקינתונים-פרטים']) or nil | templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים-מרובה'], true, false, nil, templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה'], templateParams[missingParam..'-ויקינתונים-פרטים']) or nil | ||
inWikidata = templateArg.data and #(templateArg.data)>0 | inWikidata = templateArg.data and #(templateArg.data)>0 | ||
elseif | elseif templateParams[missingParam..'-ויקינתונים-פשוט'] then | ||
-- use data should be taken from wikidata and link must not be added | -- use data should be taken from wikidata and link must not be added | ||
local wikidataParamValue = propertyLink.getLabel(templateParams[missingParam..'-ויקינתונים-פשוט']) | local wikidataParamValue = propertyLink.getLabel(templateParams[missingParam..'-ויקינתונים-פשוט']) | ||
| שורה 351: | שורה 344: | ||
hasData, maintainceCats = splitMaintainceCategory(templateArg.data) | hasData, maintainceCats = splitMaintainceCategory(templateArg.data) | ||
if hasData then | if hasData then | ||
propertyName=templateParams[missingParam..'-ויקינתונים'] or templateParams[missingParam..'-ויקינתונים-מרובה'] | propertyName=templateParams[missingParam..'-ויקינתונים'] or templateParams[missingParam..'-ויקינתונים-מרובה'] | ||
if propertyName then | if propertyName then | ||
templateArg.data = templateArg.data.. ' [[File:Blue pencil RTL.svg|15px|link=https://www.wikidata.org/wiki/'..mw.wikibase.getEntityIdForCurrentPage().. '?uselang=he#'..propertyName..'|עריכת הנתון בוויקינתונים]]' | templateArg.data = templateArg.data.. ' [[File:Blue pencil RTL.svg|15px|link=https://www.wikidata.org/wiki/'..mw.wikibase.getEntityIdForCurrentPage().. '?uselang=he#'..propertyName..'|עריכת הנתון בוויקינתונים]]' | ||
| שורה 486: | שורה 479: | ||
if m then | if m then | ||
local inWikidata = false | local inWikidata = false | ||
if | if templateParams[m..'-ויקינתונים'] then | ||
local wikidataParamValue = propertyLink.getProperty(templateParams[m..'-ויקינתונים']) or nil | local wikidataParamValue = propertyLink.getProperty(templateParams[m..'-ויקינתונים']) or nil | ||
if wikidataParamValue then | if wikidataParamValue then | ||
args.title = wikidataParamValue | args.title = wikidataParamValue | ||
end | end | ||
elseif | elseif templateParams[m..'-ויקינתונים-פשוט'] then | ||
-- use data should be taken from wikidata and link must not be added | -- use data should be taken from wikidata and link must not be added | ||
local wikidataParamValue = propertyLink.getLabel(templateParams[m..'-ויקינתונים-פשוט']) | local wikidataParamValue = propertyLink.getLabel(templateParams[m..'-ויקינתונים-פשוט']) | ||