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

מאין תקציר עריכה
מאין תקציר עריכה
שורה 165: שורה 165:
function removeEmptyHeaders()
function removeEmptyHeaders()
  local lastHeaderIndex=nil
  local lastHeaderIndex=nil
local removeFirstHeader = (not args.image or #args.image==0) -- remove the first header if there is no image
  local tempTemplateStructure = {}
  local tempTemplateStructure = {}
  for i,v in pairs(templateStructure) do
  for i,v in pairs(templateStructure) do
שורה 172: שורה 174:
  else
  else
  if lastHeaderIndex then
  if lastHeaderIndex then
  table.insert(tempTemplateStructure, templateStructure[lastHeaderIndex])
  if not removeFirstHeader then
table.insert(tempTemplateStructure, templateStructure[lastHeaderIndex])
end
  lastHeaderIndex = nil
  lastHeaderIndex = nil
  end
  end
removeFirstHeader = false
  table.insert(tempTemplateStructure, v)
  table.insert(tempTemplateStructure, v)
  end
  end