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

תוכן שנמחק תוכן שנוסף
מאין תקציר עריכה
ניסוי
שורה 300:
end
end
if not empty(wikidataArg) then
return propertyLink.getImageLink(wikidataArg, width)
end
שורה 319:
This function fills missing parameter using wikidata
]]
 
function empty(p)
mw.log('calling empty. p=', p)
return not p or mw.text.trim(p) == ''
end
 
function fillMissingParamFromWikidata(missingParam, templateParams, templateArg, frame)
local inWikidata = false
שורה 324 ⟵ 330:
local maintainceCats = nil
local propertyName = nil
if not empty(templateParams[missingParam..'-ויקינתונים']) then
templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים']) or nil
inWikidata = templateArg.data and #(templateArg.data)>0
elseif not empty(templateParams[missingParam..'-ויקינתונים-מרובה']) then
mw.log('wikidata-many: ', missingParam, templateParams[missingParam..'-ויקינתונים-מרובה'])
templateArg.data = propertyLink.getProperty(templateParams[missingParam..'-ויקינתונים-מרובה'], true, false, nil, templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה'], templateParams[missingParam..'-ויקינתונים-פרטים']) or nil
inWikidata = templateArg.data and #(templateArg.data)>0
elseif not empty(templateParams[missingParam..'-ויקינתונים-פשוט']) then
-- use data should be taken from wikidata and link must not be added
local wikidataParamValue = propertyLink.getLabel(templateParams[missingParam..'-ויקינתונים-פשוט'])
שורה 344 ⟵ 351:
hasData, maintainceCats = splitMaintainceCategory(templateArg.data)
if hasData then
propertyName=templateParams[missingParam..'-ויקינתונים'] or templateParams[missingParam..'-ויקינתונים-מרובה']-- very suspicious!emptystring evaluates to true in lua!!!
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..'|עריכת הנתון בוויקינתונים]]'
שורה 479 ⟵ 486:
if m then
local inWikidata = false
if not empty(templateParams[m..'-ויקינתונים']) then
local wikidataParamValue = propertyLink.getProperty(templateParams[m..'-ויקינתונים']) or nil
if wikidataParamValue then
args.title = wikidataParamValue
end
elseif not empty(templateParams[m..'-ויקינתונים-פשוט']) then
-- use data should be taken from wikidata and link must not be added
local wikidataParamValue = propertyLink.getLabel(templateParams[m..'-ויקינתונים-פשוט'])