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

De USAC-CGT
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 15 : Ligne 15 :
--box
--box
local box = mw.html.create('div')
local box = mw.html.create('div')
  :addClass('infobox')
  :addClass('infobox_v3')
--Title
--Title
box:node(
box:node(
mw.html.create('div')
mw.html.create('div')
:addClass('infobox-title')
:addClass('entete')
:wikitext(title)
:wikitext(title)
:done())
:done())

Version du 22 septembre 2023 à 18:12

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

local p = {} --p stands for package

local title = mw.title.getCurrentTitle().text
local contents = {} -- table for html element for the contents of the box

function p.hello( frame )
	contents[#contents + 1] = mw.html.create('span')
	  :wikitext("Hello, world 2!")
	  :done()
	
    return returnBox()
end

function returnBox()
	--box
	local box = mw.html.create('div')
	  :addClass('infobox_v3')
	
	--Title
	box:node(
		mw.html.create('div')
		:addClass('entete')
		:wikitext(title)
		:done())

	--contents
	for i, v in ipairs(contents) do
		box:node(v)
	end
	
	box:done()
	
	return box
end	  

return p