« Module:SkillList » : différence entre les versions

De Eco - Wiki Français
Aller à :navigation, rechercher
[version non vérifiée][version non vérifiée]
Page créée avec « -- Credit: Original SkillList was created by Fyre (FishAus) then edited by Scotty (ZeelNightwolf) and used as a base for TalentList. local p = {} -- Grabs args from the parent frame -- Trims and parses the args into a table, then returns the table function norm() local origArgs = mw.getCurrentFrame():getParent().args local args = {} for k, v in pairs( origArgs ) do v = mw.text.trim( tostring( v ) ) if v ~= '' then ar... »
 
StalEF (discussion | contributions)
Aucun résumé des modifications
 
(Une version intermédiaire par le même utilisateur non affichée)
Ligne 1 : Ligne 1 :
-- Credit: Original SkillList was created by Fyre (FishAus) then edited by Scotty (ZeelNightwolf) and used as a base for TalentList.
local p = {}
local p = {}


-- Grabs args from the parent frame
local Utils = require('Module:Utils')
-- Trims and parses the args into a table, then returns the table
local IconUtils = require('Module:IconUtils')
function norm()
local L = require('Module:Localization')
    local origArgs = mw.getCurrentFrame():getParent().args
    local args = {}
   
    for k, v in pairs( origArgs ) do
        v = mw.text.trim( tostring( v ) )
        if v ~= '' then
            args[k] = v
        end
    end
   
    return args
end


-- Main entry point for the Module
-- Main entry point for the Module
function p.main()
function p.main()
    -- get args from the Template
 
    local args = norm()
   
if args.list == nil or args.list == '' then
        return '\'list\' must be specified.'
    end
    -- assign variables for list
    local list = args.list
     -- load lists
     -- load lists
     local skillData = require( "Module:Skills" )
     local skillData = require( "Module:SkillData" )
local skillList = ''
     local skillList = skillData.skills
 
local text = '<div class="col-lg-12"><Center><h2 class="title">Compétences</h2></Center></div>';
--Check Passes
if list ~= 'profession' and list ~= 'specialty' and list ~= 'skill' then
        return skillList .. ' Incorrect use of pass. '
     end
local a = {}
--Profession List
if list == 'profession' then
skillList = skillList .. '=== Profession List ===\n'     
for k,v in pairs(skillData.skills) do       
            if skillData.skills[k].root == true then
              table.insert(a,k)
            end
        end
        table.sort(a)
        for i,n in ipairs(a) do
            skillList = skillList .. '* [[' .. n .. ']]\n'               
        end
end
--Specialty List
if list == 'specialty' then
skillList = skillList .. '=== Specialty List ===\n'
skillList = skillList .. '<div style=\"column-count:2;-moz-column-count:2;-webkit-column-count:2\">\n'
for k,v in pairs(skillData.skills) do       
if skillData.skills[k].specialty == true and skillData.skills[k].root == false then
              table.insert(a,k)
            end
        end
        table.sort(a)
        for i,n in ipairs(a) do
            skillList = skillList .. '* [[' .. n .. ']]\n'               
        end
skillList = skillList .. '</div>'
end
for Pname,Pdata in pairs(skillList) do


-- --Skill List (exclude Profession and Specialty)
if Pdata.Root == 'True' then  
-- if list == 'skill' then
text = text .. '<div class="col-lg-3"><div class="card">';
-- skillList = skillList .. '=== Skill List ===\n'
text = text .. '[[File:Banner4k.jpg|class=card-img-top|link=]]';
-- skillList = skillList .. '<div style=\"column-count:3;-moz-column-count:3;-webkit-column-count:3\">\n'
text = text .. '<div class="card-body"><h5 class="card-title">';
 
text = text .. IconUtils.main{ name = Pname, id = Pdata.SkillID , size = 48, style = 2, link = Pname} .. '  '
-- for k,v in pairs(skillData.skills) do       
text = text .. 'de métier</h5><h6 class="card-subtitle mb-2 text-muted">' .. Pdata.Description .. '</h6><p class="card-text">';
-- if skillData.skills[k].specialty == false and skillData.skills[k].root == false then
text = text .. '<div class="card"> <div class="card-body">';
              -- table.insert(a,k)
            -- end
        -- end
        -- table.sort(a)
        -- for i,n in ipairs(a) do
            -- skillList = skillList .. '* [[' .. n .. ']]\n'              
        -- end
-- skillList = skillList .. '</div>'
-- end


for Sname,Sdata in pairs(skillList) do
if Sdata.Root == 'False' and Sdata.RootSkill == Pname then
text = text .. IconUtils.main{ name = Sname, id = Sdata.SkillID , size = 32, style = 1, link = Sname} .. '  ';
end
end
text = text .. '</div></div></p></div></div></div>'; end
end


return text
return skillList
end
end


return p
return p

Dernière version du 14 décembre 2024 à 21:13

La documentation pour ce module peut être créée à Module:SkillList/doc

local p = {}

local Utils = require('Module:Utils')
local IconUtils = require('Module:IconUtils')
local L = require('Module:Localization')

-- Main entry point for the Module
function p.main()
   	
    -- load lists
    local skillData = require( "Module:SkillData" )
    local skillList = skillData.skills
	local text = '<div class="col-lg-12"><Center><h2 class="title">Compétences</h2></Center></div>';
	
	for Pname,Pdata in pairs(skillList) do

		if Pdata.Root == 'True' then 
		text = text .. '<div class="col-lg-3"><div class="card">';
		text = text .. '[[File:Banner4k.jpg|class=card-img-top|link=]]';
		text = text .. '<div class="card-body"><h5 class="card-title">';
		text = text .. IconUtils.main{ name = Pname, id = Pdata.SkillID , size = 48, style = 2, link = Pname} .. '  '
		text = text .. 'de métier</h5><h6 class="card-subtitle mb-2 text-muted">' .. Pdata.Description .. '</h6><p class="card-text">';
		text = text .. '<div class="card"> <div class="card-body">';

		for Sname,Sdata in pairs(skillList) do
			if Sdata.Root == 'False' and Sdata.RootSkill == Pname then 
				text = text .. IconUtils.main{ name = Sname, id = Sdata.SkillID , size = 32, style = 1, link = Sname} .. '  ';
			end
		end
		text = text .. '</div></div></p></div></div></div>'; end
	end

	return text
end

return p