Módulo:Lista despregable: Diferenzas entre revisións
Contido eliminado Contido engadido
m Importáronse 7 revisións desde w:Módulo:Lista_despregable |
update |
||
Liña 1:
-- This module implements {{collapsible list}}.
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
-- that contain data (i.e. non-whitespace values).
local function getArgNums( args )
local nums = {}
Liña 27 ⟶ 42:
end
--
local function formatAttributes( attrType, ... )
local attributes = { ... }
Liña 36 ⟶ 51:
end
if #t == 0 then
return '' --
end
return mw.ustring.format( ' %s="%s"', attrType, table.concat( t, ' ' ) )
Liña 42 ⟶ 57:
local function buildList( args )
--
local listItems = {}
local argNums = getArgNums( args )
Liña 53 ⟶ 68:
listItems = table.concat( listItems )
--
local div1class = formatAttributes( 'class', 'NavFrame', not args.expand and 'collapsed' )
local div1style = formatAttributes(
Liña 59 ⟶ 74:
args.frame_style,
args.framestyle,
args.marcoestilo,
args.marco_estilo,
not ( args.frame_style or args.framestyle or args. )
local div2class = formatAttributes( 'class', 'NavHead' )
Liña 69 ⟶ 84:
args.title_style,
args.titlestyle,
args.tituloestilo,
args.titulo_estilo,
not ( args.title_style or args.titlestyle or args. )
local title = args.title or args.titulo or '
local ulclass = formatAttributes( 'class', 'NavContent', args.hlist and 'hlist' )
local ulstyle = formatAttributes(
Liña 80 ⟶ 95:
args.list_style,
args.liststyle,
args.listaestilo,
not ( args.list_style or args.liststyle
'font-size: 105%; margin-top: 0; margin-bottom: 0; line-height: inherit;'
)
--
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
|