Anonymous

Module:SkillTable: Difference between revisions

From Elwiki
no edit summary
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 17: Line 17:
     -- Predefine the subpage for mod skills.
     -- Predefine the subpage for mod skills.
     local l_mod_subpage = '/ModA'
     local l_mod_subpage = '/ModA'
    local lang = args.lang and ('/' .. args.lang) or ''


     -- Split into two tables for easier maintenance of the code.
     -- Split into two tables for easier maintenance of the code.
Line 31: Line 33:
         if (index % 2 == 0) then
         if (index % 2 == 0) then
             -- Skill names
             -- Skill names
             table.insert(skill_name_table, v);
             table.insert(skill_name_table, v ~= '' and v or 'Unreleased');
         else
         else
             -- Image names
             -- Image names
Line 153: Line 155:


             -- Spawn a name cell.
             -- Spawn a name cell.
            local link = full_name .. mod_subpage .. lang
             local name_cell = row:tag('div'):attr('data-type', 'table-cell');
             local name_cell = row:tag('div'):attr('data-type', 'table-cell');
             local skill_wrap = name_cell:tag('div'):addClass('skill-wrap');
             local skill_wrap = name_cell:tag('div'):addClass('skill-wrap');
             skill_wrap:wikitext('[[' .. full_name .. mod_subpage .. '|.]]');
             skill_wrap:wikitext('[[' .. link .. '|.]]');


            -- Remove (Elsword), (Elesis), etc. in display name
             local display_name = full_name:gsub("%s%([%w%s%/]+%)", "");
             local display_name = full_name:gsub("%s%([%w%s%/]+%)", "");
             if not (mod_subpage == '') then
             if not (mod_subpage == '') then
Line 163: Line 167:


             -- Remove the name of the Master Skill
             -- Remove the name of the Master Skill
             if (string.find(display_name, '/Stage')) then
             if (args.no_mc_names == 'true') then
                 display_name = display_name:gsub('(.*%/)Stage([0-9])', 'Stage $2');
                 display_name = display_name:gsub('.*%/Stage%s([0-9])', 'Stage %1');
             end
             end
              
              
             skill_wrap:tag('div'):addClass('skill-wrap-text'):wikitext('[[' .. full_name .. mod_subpage .. '|' .. prefix .. display_name .. ']] ' .. suffix .. lock .. cube );
             skill_wrap:tag('div'):addClass('skill-wrap-text'):wikitext('[[' .. link .. '|' .. prefix .. display_name .. ']] ' .. suffix .. lock .. cube );
              
              
             -- If a header is detected, it will not interrupt chunking.
             -- If a header is detected, it will not interrupt chunking.
Line 181: Line 185:
                 }
                 }
             end
             end
            row = skill_table:tag('div'):attr('data-type', 'table-row'):attr('style', 'background-color: ' .. color):addClass('textfloat table-head');
             if (color == '#') then
             if (color == '#') then
                 color = frame:expandTemplate{
                 row:addClass('related-title')
                    title = 'ColorSel',
                    args = {'Misc'}
                }
             end
             end
            row = skill_table:tag('div'):attr('data-type', 'table-row'):attr('style', 'background-color: ' .. color):attr('class', 'textfloat table-head');
             row:tag('div'):attr('data-type', 'table-head'):wikitext(name);
             row:tag('div'):attr('data-type', 'table-head'):wikitext(name);
         end
         end