Module:Collapsible list: Difference between revisions

m
1 revision imported from wikipedia:Module:Collapsible_list
(trying to paste in the current version)
m (1 revision imported from wikipedia:Module:Collapsible_list)
 
(8 intermediate revisions by 6 users not shown)
Line 67:
end
listItems = table.concat( listItems )
 
-- hack around mw-collapsible show/hide jumpiness by looking for text-alignment
-- by setting a margin if centered
local textAlignmentCentered = 'text%-align%s*:%s*center'
local centeredTitle = (args.title_style and args.title_style:lower():match(textAlignmentCentered)
or args.titlestyle and args.titlestyle:lower():match(textAlignmentCentered))
local centeredTitleSpacing
if centeredTitle then
centeredTitleSpacing = 'margin: 0 4em'
else
centeredTitleSpacing = ''
end
 
-- Get class, style and title data.
local div1classcollapsibleContainerClass = formatAttributes( 'class', 'NavFrame', not args.expand and 'collapsed' )
'class',
local div1style = formatAttributes(
'mw-collapsible', not args.expand and 'mw-collapsed'
)
local collapsibleContainerStyle = formatAttributes(
'style',
'text-align: center; font-size: 100%;',
args.frame_style,
args.framestyle,
not ( args.frame_style or args.framestyle ) and 'border: none; padding: 0;'
)
local div2classcollapsibleTitleStyle = formatAttributes( 'class', 'NavHead' )
local div2style = formatAttributes(
'style',
'line-height: 1.6em; font-weight: bold; font-size: 105100%; text-align: left;',
args.title_style,
args.titlestyle,
)
not ( args.title_style or args.titlestyle ) and 'background: transparent; text-align: left;'
local div1stylejumpyTitleStyle = formatAttributes(
'style',
centeredTitleSpacing
)
local title = args.title or 'List'
local ulclass = formatAttributes( 'class', 'NavContentmw-collapsible-content', args.hlist and 'hlist' )
local ulstyle = formatAttributes(
'style',
not args.bullets and 'listfont-stylesize: none100%; nonemargin-top: 0; margin-leftbottom: 0; line-height: inherit; text-align: left;',
not args.bullets and 'list-style: none; margin-left: 0;',
args.list_style,
args.liststyle,
not ( args.list_style or args.liststyle ) and 'text-align: left;',
'font-size: 105%; margin-top: 0; margin-bottom: 0; line-height: inherit;'
)
-- Build the list.
return mw.ustring.format(
'<div%s%s>\n<div%s><div%s>%s</div></div>\n<ul%s%s>%s</ul>\n</div>',
collapsibleContainerClass, collapsibleContainerStyle,
div1classcollapsibleTitleStyle, div1style, div2class, div2stylejumpyTitleStyle, title, ulclass, ulstyle, listItems
) .. gettitlestyletracking(args.title_style or args.titlestyle)
end
verified
2,497

edits