Module:HeroData/nav: Difference between revisions

No edit summary
No edit summary
Line 165: Line 165:
     local in_herolabs = frame.args['in_herolabs'] or 'false'
     local in_herolabs = frame.args['in_herolabs'] or 'false'
     local debug_mode = frame.args['debug_mode'] == 'true'
     local debug_mode = frame.args['debug_mode'] == 'true'
    local no_redlinks = frame.args['no_redlinks'] == 'true'  -- default: false


     local heroes = get_heroes(in_herolabs)
     local heroes = get_heroes(in_herolabs)
Line 171: Line 170:


     for _, hero in ipairs(heroes) do
     for _, hero in ipairs(heroes) do
    local page_title = hero.name .. file_name
     local start_gallery = '<gallery>'
     local start_gallery = '<gallery>'
         local end_gallery = '</gallery>'
         local end_gallery = '</gallery>'


         -- Skip redlinks entirely when enabled
         local item
        if not (no_redlinks and not utilities.page_exists(page_title)) then
            item = 'File:' .. hero.name .. file_name .. '|'.. hero.name .. description ..  
            local item
        table.insert(parts, item)
                item = 'File:' .. hero.name .. file_name .. '|'.. hero.name .. description ..  
            table.insert(parts, item)
        end
     end
     end