Diferencia entre revisiones de «Módulo:Ficha»

Sin resumen de edición
Sin resumen de edición
Línea 1: Línea 1:
--
--
-- This module will implement {{Infobox}}
-- Este módulo es para implementar en {{Ficha}}
--
--
   
   
Línea 11: Línea 11:
   
   
function union(t1, t2)
function union(t1, t2)
     -- return the union of the values of two tables, as a sequence
     -- 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 rows]]')
         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
     -- If called via #invoke, use the args passed into the invoking template.
     -- Si se llama a través de #invoke, utilice los argumentos pasados ​​a la plantilla de invocación.
     -- Otherwise, for testing purposes, assume args are being passed directly in.
     -- 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 considers the empty string to be false, so to preserve the previous
     -- ParserFunctions considera que una cadena vacía es falsa, por lo que para preservar el anterior
     -- behavior of {{infobox}}, change any empty arguments to nil, so Lua will consider
     -- comportamiento de {{Ficha}}, debe cambiar los argumentos vacíos a cero, por lo que Lua los considerará
     -- them false too. (Except the 'italic title' param, which specifies different behavior
     -- que son falsos también (excepto parámetros 'title cursiva', que especifica un comportamiento diferente
     -- depending on whether it's absent or empty)
     -- dependiendo de si está ausente o vacío)
     args = {}
     args = {}
     for k, v in pairs(origArgs) do
     for k, v in pairs(origArgs) do