Module:CharTree: Difference between revisions

From Elwiki
No edit summary
No edit summary
Line 10: Line 10:
     local char_banner = mw.html.create('div'):addClass('character-banner-wrap border-color tone-2')
     local char_banner = mw.html.create('div'):addClass('character-banner-wrap border-color tone-2')
     local char_list = get_char_list(frame, args.lang)
     local char_list = get_char_list(frame, args.lang)
    local lang = '';
    if args.lang then lang = '/' .. args.lang end
     local char_order = char_list[1]
     local char_order = char_list[1]
     local not_exist = char_list[3]
     local not_exist = char_list[3]
Line 39: Line 41:
             for path_iter, path_name in ipairs(job_name) do
             for path_iter, path_name in ipairs(job_name) do
                 local file_name = path_name:gsub(':', '');
                 local file_name = path_name:gsub(':', '');
                -- Foreign languages
                local icon_link_char_name = file_name;
                local normal_link_char_name = path_name;
                if string.find(file_name, '%|') then
                    icon_link_char_name = split(icon_link_char_name, '%|')[1]
                    normal_link_char_name = normal_link_char_name .. lang
                end
                 local icon_str = 'Icon - '
                 local icon_str = 'Icon - '
                 local link = '|link=' .. path_name
                 local link = '|link=' .. normal_link_char_name
                 local unreleased = indexOf(path_name, not_exist)
                 local unreleased = indexOf(normal_link_char_name, not_exist)


                 if unreleased then
                 if unreleased then
Line 49: Line 58:
                 end
                 end


                 file_name = '[[File:' .. icon_str .. file_name .. '.png' .. link .. ']]'
                 local icon_with_link = '[[File:' .. icon_str .. icon_link_char_name .. '.png' .. link .. ']]'
                 local img = tree:tag('div'):addClass('char-banner-tree-image'):attr('data-class-name', path_name):wikitext(file_name)
                 local img = tree:tag('div'):addClass('char-banner-tree-image'):attr('data-class-name', path_name):wikitext(icon_with_link)


                 if unreleased then
                 if unreleased then