יחידה:תבנית מידע: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 338: | שורה 338: | ||
end | end | ||
function getPropertyByOptions( propertyName, entityId, options ) | |||
function | if propertyName == nil or #propertyName == 0 then | ||
local res = propertyLink. | 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 = | 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 | ||
wikidataOptions['allowMulti'] = true | |||
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 = | local wikidataParamValue = getPropertyByOptions(templateParams[m..'-ויקינתונים'], args.entityId) or nil | ||
if wikidataParamValue then | if wikidataParamValue then | ||
args.title = wikidataParamValue | args.title = wikidataParamValue | ||