Módulo:Lista despregable: Diferenzas entre revisións

Contido eliminado Contido engadido
m Importáronse 7 revisións desde w:Módulo:Lista_despregable
Banjo (conversa | contribucións)
update
Liña 1:
-- This module implements {{collapsible list}}.
-- Este é o módulo que usa o modelo {{Lista despregable}}.
 
local p = {}
 
-- local function gettitlestyletracking( ts )
-- if not ts then return '' end
-- ts = mw.ustring.gsub(mw.ustring.lower(ts), '%s', '')
-- local tsvals = mw.text.split(ts, ';')
-- table.sort(tsvals)
-- local skey = table.concat(tsvals,';')
-- skey = mw.ustring.gsub(skey, '^;', '')
-- skey = mw.text.encode(mw.text.encode(skey),'%c%[%]=')
-- if (mw.ustring.match(';' .. ts, ';background:') or mw.ustring.match(';' .. ts, ';background%-color:'))
-- and mw.ustring.match(';' .. ts, ';text%-align:') then
-- return '[[Category:Pages using collapsible list with both background and text-align in titlestyle|' .. skey .. ' ]]'
-- end
-- return '[[Category:Pages using collapsible list without both background and text-align in titlestyle|' .. skey .. ' ]]'
--end
 
local function getListItem( data )
Liña 10 ⟶ 25:
end
 
-- Returns an array containing the keys of all positional arguments
-- Devolve unha matriz que contén as chaves dos argumentos posicionais
-- that contain data (i.e. non-whitespace values).
-- que conteñen datos.
local function getArgNums( args )
local nums = {}
Liña 27 ⟶ 42:
end
 
-- Dá formatoFormats a listalist deof clasesclasses, estilosstyles eor outrosother atributosattributes.
local function formatAttributes( attrType, ... )
local attributes = { ... }
Liña 36 ⟶ 51:
end
if #t == 0 then
return '' -- DevolveReturn unhathe cadeablank enstring brancoso paraconcatenation quewill funcione a concatenaciónwork.
end
return mw.ustring.format( ' %s="%s"', attrType, table.concat( t, ' ' ) )
Liña 42 ⟶ 57:
 
local function buildList( args )
-- ObterGet osthe elementoslist da listaitems.
local listItems = {}
local argNums = getArgNums( args )
Liña 53 ⟶ 68:
listItems = table.concat( listItems )
-- ObterGet a claseclass, estilo estyle datosand dotitle títulodata.
local div1class = formatAttributes( 'class', 'NavFrame', not args.expand and 'collapsed' )
local div1style = formatAttributes(
Liña 59 ⟶ 74:
args.frame_style,
args.framestyle,
args.marco_estilo,
args.marcoestilo,
args.marco_estilo,
not ( args.frame_style or args.framestyle or args.marco_estilomarcoestilo or args.marcoestilomarco_estilo ) and 'border: none; padding: 0;'
)
local div2class = formatAttributes( 'class', 'NavHead' )
Liña 69 ⟶ 84:
args.title_style,
args.titlestyle,
args.titulo_estilo,
args.tituloestilo,
args.titulo_estilo,
not ( args.title_style or args.titlestyle or args.titulo_estilotituloestilo or args.tituloestilotitulo_estilo ) and 'background: transparent; text-align: left;'
)
local title = args.title or args.titulo or 'Ver a listaLista'
local ulclass = formatAttributes( 'class', 'NavContent', args.hlist and 'hlist' )
local ulstyle = formatAttributes(
Liña 80 ⟶ 95:
args.list_style,
args.liststyle,
args.lista_estilo,
args.listaestilo,
not ( args.list_style or args.liststyle or args.lista_estilo or args.listaestilo ) and 'text-align: left;',
'font-size: 105%; margin-top: 0; margin-bottom: 0; line-height: inherit;'
)
-- ConstruírBuild athe listalist.
return mw.ustring.format(
'<div%s%s>\n<div%s%s>%s</div>\n<ul%s%s>%s</ul>\n</div>',
div1class, div1style, div2class, div2style, title, ulclass, ulstyle, listItems
) --.. gettitlestyletracking(args.title_style or args.titlestyle)
)
end