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

מאין תקציר עריכה
מאין תקציר עריכה
שורה 338: שורה 338:
end
end


 
function getPropertyByOptions( propertyName, entityId, options )
function getProperty( propertyName, allowMulti, allowNA, entityId, multiSeperator, optionalQualifier, genderAware )
if propertyName == nil or #propertyName == 0 then
local res = propertyLink.getProperty(propertyName, allowMulti, allowNA, entityId, multiSeperator, optionalQualifier, genderAware)
return nil
end
local res = propertyLink.getPropertyByOptions(propertyName, entityId, options)
if res then
if res then
local missingTranslation =  mw.ustring.find(res, '%[%[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית%]%]')
local missingTranslation =  mw.ustring.find(res, '%[%[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית%]%]')
שורה 361: שורה 363:
local maintainceCats = nil
local maintainceCats = nil
local propertyName = nil
local propertyName = nil
local includeWikidataRef = frame and frame:getParent()
includeWikidataRef = includeWikidataRef and includeWikidataRef.args and includeWikidataRef.args['ויקינתונים-מקורות'] == 'כן'
local wikidataOptions = {
['entity-gender-aware'] =  templateParams[missingParam..'-ויקינתונים-מגדר'] == 'כן',
['qualifier'] = templateParams[missingParam..'-ויקינתונים-פרטים'],
['source'] = includeWikidataRef
}
if templateParams[missingParam..'-ויקינתונים'] then
if templateParams[missingParam..'-ויקינתונים'] then
templateArg.data = getProperty(templateParams[missingParam..'-ויקינתונים'], false, false, entityId, nil, templateParams[missingParam..'-ויקינתונים-פרטים']) or nil
templateArg.data = getPropertyByOptions(templateParams[missingParam..'-ויקינתונים'], entityId, wikidataOptions) or nil
inWikidata = templateArg.data and #(templateArg.data)>0
inWikidata = templateArg.data and #(templateArg.data)>0
elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then
elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then
local genderAware = templateParams[missingParam..'-ויקינתונים-מגדר'] == 'כן'
wikidataOptions['allowMulti'] = true
templateArg.data = getProperty(templateParams[missingParam..'-ויקינתונים-מרובה'], true, false, entityId, templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה'], templateParams[missingParam..'-ויקינתונים-פרטים'], genderAware) or nil
wikidataOptions['seperator'] = templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה']
templateArg.data = getPropertyByOptions(templateParams[missingParam..'-ויקינתונים-מרובה'], entityId,  wikidataOptions) or nil
inWikidata = templateArg.data and #(templateArg.data)>0
inWikidata = templateArg.data and #(templateArg.data)>0
elseif templateParams[missingParam..'-ויקינתונים-פשוט'] then
elseif templateParams[missingParam..'-ויקינתונים-פשוט'] then
שורה 615: שורה 626:
local inWikidata = false
local inWikidata = false
if templateParams[m..'-ויקינתונים'] then
if templateParams[m..'-ויקינתונים'] then
local wikidataParamValue = getProperty(templateParams[m..'-ויקינתונים']) or nil
local wikidataParamValue = getPropertyByOptions(templateParams[m..'-ויקינתונים'], args.entityId) or nil
if wikidataParamValue then
if wikidataParamValue then
args.title = wikidataParamValue
args.title = wikidataParamValue