Module:CharTree: Difference between revisions

no edit summary
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 28: Line 28:
     local base_arg = args[1] or 'Elsword'
     local base_arg = args[1] or 'Elsword'
     local base_name = str_localized(base_arg) and split_lang(base_arg)[1] or base_arg
     local base_name = str_localized(base_arg) and split_lang(base_arg)[1] or base_arg
     local char_tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', base_name):attr('data-display-base', split_lang(base_arg)[2])
     local char_tree = mw.html.create('div'):addClass('char-banner-tree')
     local out = ''
     local out = ''
     local char, file_name, link, nopath, nopathnojob, entry, image_arg, icon_str;
     local char, file_name, link, nopath, nopathnojob, entry, image_arg, icon_str;
Line 34: Line 34:
         local base, jobs = char_order[char_iter], {{}, {}, {}}
         local base, jobs = char_order[char_iter], {{}, {}, {}}
         local base_name = split_lang(base)[1] or base
         local base_name = split_lang(base)[1] or base
         local tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', base_name:gsub('/', '')):attr('data-display-base', split_lang(base)[2])
         local tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', base_name:gsub('/', '')):attr('data-display-base', split_lang(base)[2] or base)


         for path_iter=1, 4, 1 do
         for path_iter=1, 4, 1 do
Line 53: Line 53:
         for job_iter, job_name in ipairs(jobs) do
         for job_iter, job_name in ipairs(jobs) do
             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(':', '');
                 -- Foreign languages
                 -- Foreign languages
                 local icon_link_char_name = file_name;
                 local icon_link_char_name = path_name;
                 local normal_link_char_name = path_name;
                 local normal_link_char_name = path_name;
                 if str_localized(file_name) then
                 if str_localized(path_name) then
                     local name_split = split_lang(icon_link_char_name)
                     local name_split = split_lang(path_name)
                     icon_link_char_name = name_split[1]
                     icon_link_char_name = name_split[1]:gsub(':', '')
                     path_name = name_split[2]
                     path_name = name_split[2]
                     normal_link_char_name = name_split[1] .. lang
                     normal_link_char_name = name_split[1] .. lang
                 end
                 end
                icon_link_char_name = icon_link_char_name:gsub(':', '')
                 local icon_str = 'Icon - '
                 local icon_str = 'Icon - '
                 local link = '|link=' .. normal_link_char_name
                 local link = '|link=' .. normal_link_char_name
Line 91: Line 91:
         args = {
         args = {
             'Elsword',
             'Elsword',
             'Elsword',
             'Elsword' .. lang,
             'tone-8'
             'tone-8',
            force_title = split_lang(char_order[1])[2]
         }
         }
     }
     }
Line 102: Line 103:
         if str_localized(v) then actual_name = split_lang(v)[1]; display_name = split_lang(v)[2] end
         if str_localized(v) then actual_name = split_lang(v)[1]; display_name = split_lang(v)[2] end
         if actual_name == 'Lu/Ciel' then actual_name = 'LuCiel (Lu)' end
         if actual_name == 'Lu/Ciel' then actual_name = 'LuCiel (Lu)' end
         local base_icon = mw.html.create('div'):attr('data-base', actual_name):attr('data-display-base', display_name):wikitext('[[File: Icon - ' .. actual_name .. '.png]]')
         local base_icon = mw.html.create('div'):attr('data-base', actual_name):attr('data-display-base', display_name or actual_name):wikitext('[[File: Icon - ' .. actual_name .. '.png]]')
         select_banner:node(base_icon)
         select_banner:node(base_icon)
     end
     end