Module:Listing: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
(add Listbox class to be inherited by Navbox and Galbox)
(split sections into top-level items and groups with second-level items)
Line 51: Line 51:
     content = "",
     content = "",
     summary = "",
     summary = "",
     sections = {}
     sections = {},
    topLevelLeaves = {}, -- i.e. L2 sections with no children
    groups = {} -- i.e. L2 sections that have children
   }
   }
   local currentSection = root
   local currentSection = root
Line 84: Line 86:
       contentBackfillSection = contentBackfillSection.parent
       contentBackfillSection = contentBackfillSection.parent
     until not contentBackfillSection
     until not contentBackfillSection
  end
  -- split sections into top-level items and groups with second-level items
  for _, section in root.sections do
    if #section.sections then
      root.groups[#root.groups + 1] = section
    else
      root.topLevelLeaves[#topLevelLeaves + 1] = section
    end
   end
   end