Diferencia entre revisiones de «Módulo:Ficha»
Sin resumen de edición |
|||
| Línea 5: | Línea 5: | ||
local p = {} | local p = {} | ||
local HtmlBuilder = require('Module:HtmlBuilder') | |||
local marco = {} | local marco = {} | ||
local args | local args | ||
| Línea 53: | Línea 53: | ||
if rowArgs.seccion then | if rowArgs.seccion then | ||
root | root | ||
.tag('tr') | |||
.tag('th') | |||
.attr('colspan', 3) | |||
.addClass(rowArgs.clasefila) | |||
.css('text-align', 'center') | |||
.cssText(rowArgs.estiloseccion or args.estiloseccion) | |||
.wikitext(rowArgs.seccion) | |||
elseif rowArgs.datos then | elseif rowArgs.datos then | ||
local fila = root | local fila = root.tag('tr') | ||
fila.addClass(rowArgs.clasefila) | fila.addClass(rowArgs.clasefila) | ||
if rowArgs.etiqueta then | if rowArgs.etiqueta then | ||
fila | fila | ||
.tag('th') | |||
.attr('scope', 'row') | |||
.css('text-align', 'left') | |||
.addClass(rowArgs.clasefila) | |||
.cssText (rowArgs.estiloetiqueta or args.estiloetiqueta) | |||
.wikitext(rowArgs.etiqueta) | |||
.done() | |||
end | end | ||
local datosCelula = fila | local datosCelula = fila.tag('td') | ||
if rowArgs.etiqueta then | if rowArgs.etiqueta then | ||
datosCelula | datosCelula | ||
.attr('colspan', 2) | |||
else | else | ||
datosCelula | datosCelula | ||
.attr('colspan', 3) | |||
.css('text-align', 'center') | |||
end | end | ||
datosCelula | datosCelula | ||
.addClass(rowArgs.clase) | |||
.cssText (rowArgs.estilodatos or args.estilodatos) | |||
.wikitext(detectaTablas(rowArgs.datos)) | |||
end | end | ||
end | end | ||
| Línea 105: | Línea 105: | ||
end | end | ||
root | root | ||
.tag('tr') | |||
.tag('th') | |||
.attr('colspan', 3) | |||
.addClass(cabecera) | |||
.css('text-align', 'center') | |||
.css('background-color', args.colorfondo or args.colorfondotitulo or 'transparent') | |||
.css('color', args.colortexto or 'black') | |||
.cssText(args.estilotitulo) | |||
.wikitext(args.titulo) | |||
end | end | ||
local function hacerFilaArriba() | local function hacerFilaArriba() | ||
| Línea 119: | Línea 119: | ||
root | root | ||
.tag('tr') | |||
.tag('th') | |||
.attr('colspan', 3) | |||
.addClass(args.clasearribaor or args.clasetitulo2) | |||
.css('text-align', 'center') | |||
.css('font-size', '125%') | |||
.css('font-weight', 'bold') | |||
.cssText(args.estiloarriba or args.estilotitulo2) | |||
.wikitext(args.arriba or args.titulo2) | |||
end | end | ||
| Línea 134: | Línea 134: | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.addClass(args.clasepiedetabla) | |||
.css('text-align', 'center') | |||
.cssText(args.estilopiedetabla) | |||
.wikitext(args.piedetabla) | |||
end | end | ||
local function hacerImagenInferior()-- Imagen que aparecerá en la parte inferior de la tabla | local function hacerImagenInferior()-- Imagen que aparecerá en la parte inferior de la tabla | ||
| Línea 155: | Línea 155: | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.addClass(args.claseimageninferior) | |||
.css('text-align', 'center') | |||
.cssText(args.estiloimageninferior) | |||
.newline() | |||
.wikitext(imageninferior) | |||
.tag('br', {selfClosing = true}) | |||
.done() | |||
.tag('span') | |||
.cssText(args.estilopieinferior) | |||
.wikitext(args.pieinferior) | |||
.newline() | |||
end | end | ||
| Línea 184: | Línea 184: | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.addClass(args.claseimagensuperior) | |||
.css('text-align', 'center') | |||
.cssText(args.estiloimagensuperior) | |||
.newline() | |||
.wikitext(imagensuperior) | |||
.tag('br', {selfClosing = true}) | |||
.done() | |||
.tag('span') | |||
.cssText(args.estilopiesuperior) | |||
.wikitext(args.piesuperior) | |||
.newline() | |||
end | end | ||
| Línea 250: | Línea 250: | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
-- | --.attr('cellspacing', '0em') | ||
-- | --.attr('padding','0em') | ||
.attr('colspan', '3') | |||
.css('align', 'center') | |||
.tag('table') -- tiene que ir dentro de una tabla para que las filas no lo deformen | |||
.css('width', '100%') | |||
.addClass('mergedrow') | |||
.tag('tr') | |||
.tag('td') | |||
.css('text-align', 'center') | |||
.css('background-color', 'transparent') | |||
.addClass(args.claseimagenizquiera) | |||
.css('align', 'center')-- Se alinea en el centro horizontal | |||
.css('text-align', 'center') -- Se alinea en el centro horizontal | |||
.css('vertical-align', 'middle')-- Se alinea en el centro vertical | |||
.cssText(args.estiloimagenizquierda) | |||
.wikitext('[[Archivo:' .. args.imagenizquierda .. '|' .. args['tamañoimagenizquierda'] .. ']]' ) | |||
.tag('br') | |||
.tag('span') | |||
.cssText(args.estilopieizquierdo) | |||
.wikitext(args.pieizquierdo) | |||
.tag('td') | |||
.css('text-align', 'center')-- Se alinea en el centro horizontal | |||
.css('align', 'center')-- Se alinea en el centro horizontal | |||
.css('vertical-align', 'middle')-- Se alinea en el centro vertical | |||
.css('background-color', 'transparent') | |||
.addClass(args.claseimagenderecha) | |||
.cssText(args.estiloimagenderecha) | |||
.wikitext('[[Archivo:' .. args.imagenderecha .. '|' .. args['tamañoimagenderecha'] .. ']]' ) | |||
.tag('br') | |||
.tag('span') | |||
.cssText(args.estilopiederecho) | |||
.wikitext(args.piederecho) | |||
.newline() | |||
elseif args.imagenderecha or args.imagenizquierda then | elseif args.imagenderecha or args.imagenizquierda then | ||
-- Si solo una de las dos, la imagen que aparezca estará en el centro | -- Si solo una de las dos, la imagen que aparezca estará en el centro | ||
| Línea 301: | Línea 301: | ||
end | end | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.addClass(args['clase' .. imagenL]) | |||
.css('text-align', 'center') | |||
.cssText(args['estilo' .. imagenL]) | |||
.newline() | |||
.wikitext('[[Archivo:' .. args[imagenL] .. '|'.. args['tamaño'..imagenL] .. ']]' ) | |||
.tag('br') | |||
.tag('span') | |||
.cssText(args['estilo' .. pieL]) | |||
.wikitext(args[pieL]) | |||
end | end | ||
end | end | ||
| Línea 342: | Línea 342: | ||
imagen = args['imagen'..num] | imagen = args['imagen'..num] | ||
end | end | ||
local datos = | local datos = HtmlBuilder.create().wikitext(imagen) | ||
if pie and not flotante then | if pie and not flotante then | ||
datos | datos | ||
.tag('br', {selfClosing = true}) | |||
.done() | |||
end | end | ||
if pie then | if pie then | ||
datos | datos | ||
.tag('span') | |||
.cssText(args.estilopie) | |||
.wikitext(pie) | |||
end | end | ||
anadirfila({ | anadirfila({ | ||
| Línea 406: | Línea 406: | ||
function anadirSucesion(argumentosSucesion) | function anadirSucesion(argumentosSucesion) | ||
local fila = root | local fila = root.tag('tr') | ||
fila | fila.css('font-size', '88%') | ||
fila | fila.css('text-align', 'center') | ||
local celda | local celda | ||
| Línea 415: | Línea 415: | ||
width = '33%' | width = '33%' | ||
celda = fila | celda = fila.tag('td') | ||
celda | celda | ||
.css('width', width) | |||
.css('padding', '0.2em 0.1em 0.2em 0') | |||
.css('vertical-align', 'middle') | |||
if argumentosSucesion['estilo fuente'] then | if argumentosSucesion['estilo fuente'] then | ||
celda | celda | ||
.tag('span') | |||
.css('font-style', argumentosSucesion['estilo fuente']) | |||
.wikitext(argumentosSucesion.anterior) | |||
else | else | ||
celda | celda.wikitext(argumentosSucesion.anterior) | ||
end | end | ||
if argumentosSucesion['año anterior'] then | if argumentosSucesion['año anterior'] then | ||
celda | celda | ||
.tag('br') | |||
.wikitext('(' .. argumentosSucesion['año anterior'] .. ')') | |||
end | end | ||
celda = fila | celda = fila.tag('td') | ||
celda | celda | ||
.css('width', width) | |||
.css('padding', '0.2em 0.1em') | |||
.css('vertical-align', 'middle') | |||
.css('background-color', argumentosSucesion.color or '#E6E8FA') | |||
celda | celda | ||
.tag('span') | |||
.css('font-weight', 'bold') | |||
.css('font-style', argumentosSucesion['estilo fuente'] or '') | |||
.wikitext(argumentosSucesion.actual or args.titulo) | |||
if argumentosSucesion['año'] then | if argumentosSucesion['año'] then | ||
celda | celda | ||
.tag('br') | |||
.wikitext('(' .. argumentosSucesion['año'] .. ')') | |||
end | end | ||
celda = fila | celda = fila.tag('td') | ||
celda | celda | ||
.css('width', width) | |||
.css('padding', '0.2em 0 0.2em 0.1em') | |||
.css('vertical-align', 'middle') | |||
if argumentosSucesion['estilo fuente'] then | if argumentosSucesion['estilo fuente'] then | ||
celda | celda | ||
.tag('span') | |||
.css('font-style', argumentosSucesion['estilo fuente']) | |||
.wikitext(argumentosSucesion.siguiente) | |||
else | else | ||
celda | celda.wikitext(argumentosSucesion.siguiente) | ||
end | end | ||
if argumentosSucesion['año siguiente'] then | if argumentosSucesion['año siguiente'] then | ||
celda | celda | ||
.tag('br') | |||
.wikitext('(' .. argumentosSucesion['año siguiente'] .. ')') | |||
end | end | ||
end | end | ||
| Línea 525: | Línea 525: | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.css('text-align', 'right') | |||
.wikitext(mw.getCurrentFrame():expandTemplate({ | |||
title = 'navbar', | title = 'navbar', | ||
args = { args.nombre, mini = 1 } | args = { args.nombre, mini = 1 } | ||
| Línea 553: | Línea 553: | ||
if textoPie ~= '' then | if textoPie ~= '' then | ||
root | root | ||
.tag('tr') | |||
.tag('td') | |||
.attr('colspan', '3') | |||
.css('text-align', 'left') | |||
.wikitext(textoPie) | |||
end | end | ||
end | end | ||
local function hacerCategoriasSeguimiento() | local function hacerCategoriasSeguimiento() | ||
if args.decat ~= 'si' and #(getArgNums('datos')) == 0 and not args[1] and mw.title.getCurrentTitle().namespace == 0 then | if args.decat ~= 'si' and #(getArgNums('datos')) == 0 and not args[1] and mw.title.getCurrentTitle().namespace == 0 then | ||
root | root.wikitext('[[Categoría:Wikipedia:Artículos que usan ficha sin datos en filas]]') | ||
end | end | ||
end | end | ||
| Línea 568: | Línea 568: | ||
function _infobox() | function _infobox() | ||
if args.child ~= 'si' and args.integrada ~= 'sí' then | if args.child ~= 'si' and args.integrada ~= 'sí' then | ||
root = | root = HtmlBuilder.create('table') | ||
root -- Estilo de toda la ficha | root -- Estilo de toda la ficha | ||
.addClass('infobox_v2 ') | |||
.addClass(args.clase) | |||
.cssText('width:22.7em; line-height: 1.4em; text-align:left; padding:.23em') -- Lo mismo que la plantilla:Ficha | |||
.cssText(args.estilo) | |||
if args.estilo then | if args.estilo then | ||
root | root.wikitext('[[Categoría:Wikipedia:Fichas con el parámetro estilo]]') | ||
end | end | ||
| Línea 582: | Línea 582: | ||
hacerFilaArriba() | hacerFilaArriba() | ||
else | else | ||
root = | root = HtmlBuilder.create() | ||
if args.titulo then | if args.titulo then | ||
root | root.wikitext("'''" .. args.titulo .. "'''") | ||
end | end | ||
end | end | ||