Module:ListGeneration: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 73: Line 73:
     end
     end


     -- If there's only one item and no custom bullet, return it directly without list formatting
     -- If there's only one item and no special formatting is needed, return it directly without list formatting
     if #items == 1 and (mode ~= 'bullet_custom' or not bulletChar or bulletChar == '') then
     if #items == 1 then
         local singleItem = items[1]
         local singleItem = items[1]
         if type(singleItem) == 'table' then
         local hasCustomBullet = (mode == 'bullet_custom' and bulletChar and bulletChar ~= '')
            return singleItem.content or ''
        local hasSpecialClass = (type(singleItem) == 'table' and singleItem.class and singleItem.class ~= '')
        else
       
            return singleItem
        -- Only bypass list formatting if there's no custom bullet AND no special class
        if not hasCustomBullet and not hasSpecialClass then
            if type(singleItem) == 'table' then
                return singleItem.content or ''
            else
                return singleItem
            end
         end
         end
        -- If we have custom bullets or special classes, continue to list formatting below
     end
     end