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

מ 20 גרסאות של הדף wikipedia:he:יחידה:תבנית_מידע יובאו
 
(14 גרסאות ביניים של 5 משתמשים אינן מוצגות)
שורה 231: שורה 231:
removeFirstHeader = (not hasImage) and self.args.removeFirstHeader -- remove the first header if there are no images & the first header is generic
removeFirstHeader = (not hasImage) and self.args.removeFirstHeader -- remove the first header if there are no images & the first header is generic
else
else
removeFirstHeader = (hasImage)-- default, do not remove the first header if there are no images
removeFirstHeader = (not hasImage)-- default, remove the first header if there are no images
end
end


שורה 242: שורה 242:
  if lastHeaderIndex then
  if lastHeaderIndex then
  if not removeFirstHeader then
  if not removeFirstHeader then
  table.insert(tempTemplateStructure, self.templateStructure[lastHeaderIndex])
  -- skip headers that are only spaces/nowiki - marking structure seperation
local headerData =mw.text.unstripNoWiki( self.templateStructure[lastHeaderIndex].data )
local headerDataNoSpace = mw.ustring.gsub(headerData, "%s", "")
if #headerDataNoSpace >0 then
table.insert(tempTemplateStructure, self.templateStructure[lastHeaderIndex])
end
  end
  end
  lastHeaderIndex = nil
  lastHeaderIndex = nil
שורה 518: שורה 523:
if templateParams[missingParam..'-ויקינתונים'] then
if templateParams[missingParam..'-ויקינתונים'] then
propertyName = templateParams[missingParam..'-ויקינתונים']
propertyName = templateParams[missingParam..'-ויקינתונים']
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName)
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName, entityId)
elseif templateParams[missingParam..'-ויקינתונים-פשוט'] then
elseif templateParams[missingParam..'-ויקינתונים-פשוט'] then
propertyName = templateParams[missingParam..'-ויקינתונים-פשוט']
propertyName = templateParams[missingParam..'-ויקינתונים-פשוט']
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName)
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName, entityId)
elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then
elseif templateParams[missingParam..'-ויקינתונים-מרובה'] then
local genderAware = templateParams[missingParam..'-ויקינתונים-מגדר'] == 'כן'
local genderAware = templateParams[missingParam..'-ויקינתונים-מגדר'] == 'כן'
propertyName =  templateParams[missingParam..'-ויקינתונים-מרובה']
propertyName =  templateParams[missingParam..'-ויקינתונים-מרובה']
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName)
matching = WikidataCrossValidation.crossValidate(templateArg, propertyName, entityId)
end
end
שורה 604: שורה 609:
args.leftImageDesc = templateParams['כיתוב שמאל']
args.leftImageDesc = templateParams['כיתוב שמאל']
args.imageDesc = templateParams['כיתוב']
args.imageDesc = templateParams['כיתוב']
args.image = getValueOrWikidataImage{
if templateParams['תמונה ללא שאיבה אוטומטית'] ==  'כן' then
valueArg=templateParams['תמונה'],
args.image = getValueOrWikidataImage{
wikidataArg=templateParams['תמונה-ויקינתונים'] or 'P18',
valueArg=templateParams['תמונה'],
width=templateParams['תמונה-גודל'] or '220',
wikidataArg=templateParams['תמונה-ויקינתונים'],
imgDesc=args.imageDesc,
width=templateParams['תמונה-גודל'] or '220',
args=args
imgDesc=args.imageDesc,
}
args=args
}
else
args.image = getValueOrWikidataImage{
valueArg=templateParams['תמונה'],
wikidataArg=templateParams['תמונה-ויקינתונים'] or 'P18',
width=templateParams['תמונה-גודל'] or '220',
imgDesc=args.imageDesc,
args=args
}
end


args.removeFirstHeader = nil -- default
args.removeFirstHeader = false-- default based on vote on 18/7/21
     -- explictly override the default
     -- explictly override the default
     if templateParams['כותרת כללית'] ==  'כן' then  
     if templateParams['כותרת כללית'] ==  'כן' then  
שורה 656: שורה 671:
local dataTemplate = templateParams[dataPrefix..i]
local dataTemplate = templateParams[dataPrefix..i]
if dataTemplate then
if dataTemplate then
-- if parameter contains only category with no value, replace with with nil and add teh value to maintaince category
-- if parameter contains only category with no value, replace with with nil and add the value to maintaince category
local hasData, maintainceCats = splitMaintainceCategory(dataTemplate)
local hasData, maintainceCats = splitMaintainceCategory(dataTemplate)
if maintainceCats and not hasData then
if maintainceCats and not hasData then
שורה 717: שורה 732:
table.insert(entriesToRemove, 1, k)
table.insert(entriesToRemove, 1, k)
else
else
-- otherwise if the template isn't full - try to use wikidata to fill it
-- otherwise if the template isn't full or if there is a Wikidata-beats tag - them try to use wikidata to fill it
local m = mw.ustring.match(v.data, '\{\{\{(.-)\}\}\}')
local m = mw.ustring.match(v.data, '\{\{\{(.-)\}\}\}')
                    if not m and v.label and templateParams[v.label..'-ויקינתונים-גובר']~=nil then
                        m = templateParams[v.label..'-ויקינתונים-גובר']
                    end
if m then
if m then
m = mw.uri.decode( m ) -- some templates may add encoding and are preprocessed before
m = mw.uri.decode( m ) -- some templates may add encoding and are preprocessed before