Diferencia entre revisiones de «Módulo:Centrar/pruebas»
Contenido eliminado Contenido añadido
Sin resumen de edición |
Prueba para módulo todo terreno personalizable full 100% real no fake |
||
Línea 1:
-- módulo para plantillas de formato
local p = {}
local tamFuente = { --tamaños de letra segun nombre de las plantillas
Línea 35 ⟶ 36:
['line-height']='lh', ['interlineado']='lh',
['letter-spacing']='sp', ['espaciado']='sp',
['offset']='margen',
['id']='anclaje'
}
Línea 41 ⟶ 43:
function p.centrar( frame ) -- función principal para llamar desde {{centrar}}
local argus = {}
for k,v in pairs(frame.args) do
argus[k] = v
for k,v in pairs(frame:getParent().args) do -- crea una tabla con los parámetros incluídos en la plantilla, y elimina parámetros vacíos
argus[k] = v
Línea 52 ⟶ 57:
local html = mw.html.create() -- cuerpo principal de la plantilla
local div = html:tag(
div:css('text-align',
if
div:css('float',
end
--if
-- div:css('border-bottom','0 none')
-- end
--if argus['tag'] == "h3" or argus['tag'] == "h4" or argus['tag'] == "h5" then
-- div:css('font-weight','normal')
--end
-- sección de parámetros
Línea 84 ⟶ 92:
if textTransform[argus[k]] ~= nil then
div:css('text-transform',textTransform[argus[k]]) --opciones transformación de texto
▲ end
▲ if fontVariant[argus[k]] ~= nil then -- opcion variante de fuente (small caps)
div:css('font-variant',fontVariant[argus[k]])
end▼
▲ if fontFamily[argus[k]] ~= nil then -- opcion familia de fuentes
div:css('font-family',fontFamily[argus[k]])
▲ if tamFuente[argus[k]] ~= nil then -- opciones de tamaño de fuente sin usar el parámetro fs
div:css('font-size',tamFuente[argus[k]])
end
Línea 104 ⟶ 109:
--texto
div:wikitext(argus[1])
if
div:css('margin-right',argus[2] or argus['margen'] or '' )
end
if
div:css('margin-right', argus[2] or argus['margen'] or '0')
div:css('margin-top', argus[3] or '0')
Línea 113 ⟶ 118:
div:css('margin-left', argus[4] or '0')
end
if
div:css('margin-top', argus[2] or '0')
div:css('margin-bottom', argus[2] or '0')
div:css('margin-right', argus[3] or '0')
end
-- anclaje
if argus['anclaje'] then
div:attr('id', argus['anclaje'])
return tostring(html)
end
|