Módulo:Dynkin

Revisión del 07:34 25 abr 2023 de Pyc1948 (discusión | contribs.) (Página creada con «-- module to turn a parameter list into a list of Dynkin diagram images. -- See the template documentation or any example for how it is used and works. local p = {} function p.Dynkin(frame) -- For calling from #invoke. local pframe = frame:getParent() local args = pframe.args return p._Dynkin(args) end function p._Dynkin(args) -- For calling from other Lua modules. local body ='<span style="display:inline-block;">' -- create and start the output s…»)
(difs.) ← Revisión anterior | Revisión actual (difs.) | Revisión siguiente → (difs.)

Plantilla:En obras Este módulo es utilizado por la plantilla de diagrama Dynkin, Plantilla:Dynkin. Se invoca como

  • {{#invoke:Dynkin|Dynkin}}

aunque el parámetro se ignora; en su lugar, utiliza los parámetros pasados a la plantilla. Consulte la documentación de la plantilla para saber cómo se usa.

Para usar esto desde otros módulos Lua, primero cargue el módulo.

<syntaxhighlight lang="lua"> local Dynkin = require('Module:Dynkin')._Dynkin </syntaxhighlight>

Luego puede usarlo con la siguiente sintaxis.

<syntaxhighlight lang="lua"> Dynkin{"node", "3", "node"} </syntaxhighlight>

Consulte la documentación de la plantilla para posibles entradas.


-- module to turn a parameter list into a list of [[Dynkin diagram]] images.
-- See the template documentation or any example for how it is used and works.
local p = {}

function p.Dynkin(frame)
	-- For calling from #invoke.
	local pframe = frame:getParent()
	local args = pframe.args
	return p._Dynkin(args)
end
	
function p._Dynkin(args)
	-- For calling from other Lua modules.
	local body ='<span style="display:inline-block;">'         -- create and start the output string
	for v, x in ipairs(args) do                                -- process params, ignoring any names
		body = body .. "[[File:dyn-" .. x .. ".png]]"          -- write file for this parameter
	end
	body = body .. "</span>"                                   -- finish output string
	return body                                                -- return result
end

return p