Module:CW

De Marxists-fr
Aller Ă  la navigation Aller Ă  la recherche

La documentation pour ce module peut ĂȘtre créée Ă  Module:CW/doc

local p = {};   --All lua modules on Wikipedia must begin by defining a variable 
                --that will hold their externally accessible functions.
                --Such variables can have whatever name you want and may 
                --also contain various data as well as functions.

function p.list(frame) -- To access arguments passed to a module, use `frame.args`
	local CW = frame.args[1]  
	local numbervol = tonumber(frame.args[2])
	local i = 1
	local varlist = '<div id="CW-list"><p>'
	while i <= numbervol do 
		varlist = varlist..'[[Recueil:'..CW..'/Volume_'..i..'|'..i..']]'
		if (i % 10 == 0) then varlist = varlist..'</p><p>' end
		i = i + 1
	end
	return varlist..'</p></div>'
end

return p    --All modules end by returning the variable containing their functions to Wikipedia.
-- Now we can use this module by calling {{#invoke: CW | list | arg }},
-- Note that the first part of the invoke is the name of the Module's wikipage,
-- and the second part is the name of one of the functions attached to the 
-- variable that you returned.

-- The "print" function is not allowed in Wikipedia.  All output is accomplished
-- via strings "returned" to Wikipedia.