Module:Icôna de titro

De Vouiquipèdia, l’enciclopèdia abada.

La documentation pour ce module peut être créée à Module:Icôna de titro/doc

local p = {}

function p.main(frame)
	local args = {}
	local argsParent = frame:getParent().args

	--Paramètros vouedos entèrprètâs per Lua
	for cllaf, val in pairs(argsParent) do
		if val ~= '' then
			args[cllaf] = mw.text.trim(val)
		end
	end

	return p._main(args)
end

function p._main(args)
	local res = mw.html.create()
	local iconaTitro = mw.html.create()
	local frame = mw.getCurrentFrame()
	local fichierVouiqui = '[[Fichiér:%s|%spx|link=%s|%s|%s|alt=%s]]'
	local argsId = args.id
	local nowiki = frame:extensionTag{name = 'nowiki'}

	iconaTitro
 		:wikitext(mw.ustring.format(fichierVouiqui,
			args.emage or 'Fairytale bookmark.png',
			args.talye or 20,
			args.lim or 'Modèlo:Icôna de titro',
			args['paramètro'] or '',
			args.texto or 'Ègzemplo de tèxto',
			args.texto or 'Ègzemplo de tèxto'))

	if not args.id then
		local nsPage = mw.title.getCurrentTitle().namespace
		if nsPage == 2 or nsPage == 3 then
			argsId = args.emage or 'Fairytale bookmark.png'
		end
	end

	res:wikitext(frame:extensionTag('indicator', tostring(iconaTitro), {name = argsId}))

	if not args.id then
		res:wikitext('[[Catègorie:Pâge qu’emplèye un’icôna de titro sen identifient]]')
	end

	return nowiki .. tostring(res)
end

return p