Module:NavboxMobile: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary |
EnWikiAdmin (talk | contribs) No edit summary |
||
Line 284: | Line 284: | ||
:wikitext(addNewline(args.below)) | :wikitext(addNewline(args.below)) | ||
end | end | ||
Line 306: | Line 305: | ||
:wikitext(processItem(args[groupKey])) | :wikitext(processItem(args[groupKey])) | ||
-- | -- Check if the list is non-empty before rendering content | ||
if args[listKey] and args[listKey] | if args[listKey] and args[listKey] ~= "" then | ||
if args[listKey] == "child" then | |||
-- Check if the child contains valid groups or lists | |||
local childHasContent = false | |||
for j = 1, 10 do | |||
local childGroupKey = "child" .. (path ~= "" and path .. "_" or "") .. i .. "_group" .. j | |||
local childListKey = "child" .. (path ~= "" and path .. "_" or "") .. i .. "_list" .. j | |||
if args[childGroupKey] or args[childListKey] then | |||
childHasContent = true | |||
break | |||
end | |||
end | |||
if childHasContent then | |||
-- Recursively render child lists | |||
local newPath = (path ~= "" and path .. "_" or "") .. i | |||
renderListRow(tbl, tostring(newPath), parentLevel + 1) | |||
end | |||
else | else | ||
-- Render flat lists | -- Render flat lists | ||
listCell:wikitext(processItem(args[listKey], args.nowrapitems)) | local listRow = addTableRow(tbl) | ||
local listCell = listRow:tag('td') | |||
:attr('colspan', 2) | |||
:addClass('navboxMobile-list-content') -- Base content class | |||
:addClass('navboxMobile-list-level' .. parentLevel) -- Correct level | |||
:addClass((i % 2 == 1) and 'navboxMobile-odd' or 'navboxMobile-even') -- Odd/even class | |||
:addClass('hlist') -- Ensure `hlist` is applied for horizontal lists | |||
:wikitext(processItem(args[listKey], args.nowrapitems)) | |||
end | end | ||
end | end | ||
Line 328: | Line 339: | ||
end | end | ||
end | end | ||