Module:List: Difference between revisions

142 bytes added ,  10 years ago
simplify the type-property-checking code
Enwikipedia>Frietjes
(use nil)
Enwikipedia>Mr. Stradivarius
(simplify the type-property-checking code)
Line 67:
root.css('margin-left', indent .. 'em')
end
-- Detect if the type attribute specified by args.type is using an invalid value, and if so try passing it as a list-style-type CSS property.
if args['type'] and not args['type']:match('^%s*[1AaIi]%s*$') then
if local notlistStyleType = args['.list_style_type'] and notor args['list-style-type'] then
args['list_style_type'] local listType = args['type']
if args['type']listType and not args['type']listType:match('^%s*[1AaIi]%s*$') then
args['type'] = nil
if not listStyleType then
listStyleType = listType
args['type']listType = nil
end
end
Line 77 ⟶ 80:
list
.attr('start', args.start)
.attr('type', args.typelistType)
.css('list-style-type', args.list_style_type or args['list-style-type']listStyleType)
.cssText(args.list_style or args.ul_style or args.ol_style) -- ul_style and ol_style are included for backwards compatibility. No distinction is made for ordered or unordered lists.
.wikitext(table.concat(listItems))