Diferencia entre revisiones de «Módulo:Ficha»
Sin resumen de edición |
Sin resumen de edición |
||
| Línea 1: | Línea 1: | ||
-- | -- | ||
-- | -- Este módulo es para implementar en {{Ficha}} | ||
-- | -- | ||
| Línea 11: | Línea 11: | ||
function union(t1, t2) | function union(t1, t2) | ||
-- | -- devuelve la unión de los valores de dos tablas, como una secuencia | ||
local vals = {} | local vals = {} | ||
for k, v in pairs(t1) do | for k, v in pairs(t1) do | ||
| Línea 196: | Línea 196: | ||
local function renderTrackingCategories() | local function renderTrackingCategories() | ||
if args.decat ~= 'yes' and #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then | if args.decat ~= 'yes' and #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then | ||
root.wikitext('[[Categoría:Wikipedia:Artículos que usan ficha sin datos | root.wikitext('[[Categoría:Wikipedia:Artículos que usan ficha sin datos en filas]]') | ||
end | end | ||
end | end | ||
| Línea 205: | Línea 205: | ||
root | root | ||
.addClass('infobox_v2 ') | .addClass('infobox_v2') | ||
.addClass(args.bodyclass) | .addClass(args.bodyclass) | ||
--.attr('cellspacing', 3) | --.attr('cellspacing', 3) | ||
| Línea 237: | Línea 237: | ||
function p.infobox(frame) | function p.infobox(frame) | ||
local origArgs | local origArgs | ||
-- | -- Si se llama a través de #invoke, utilice los argumentos pasados a la plantilla de invocación. | ||
-- | -- De lo contrario, para fines de prueba, asumen args que se pasan directamente. | ||
if frame == mw.getCurrentFrame() then | if frame == mw.getCurrentFrame() then | ||
origArgs = frame:getParent().args | origArgs = frame:getParent().args | ||
| Línea 245: | Línea 245: | ||
end | end | ||
-- ParserFunctions | -- ParserFunctions considera que una cadena vacía es falsa, por lo que para preservar el anterior | ||
-- | -- comportamiento de {{Ficha}}, debe cambiar los argumentos vacíos a cero, por lo que Lua los considerará | ||
-- | -- que son falsos también (excepto parámetros 'title cursiva', que especifica un comportamiento diferente | ||
-- | -- dependiendo de si está ausente o vacío) | ||
args = {} | args = {} | ||
for k, v in pairs(origArgs) do | for k, v in pairs(origArgs) do | ||