Module:List: Difference between revisions
Jump to navigation
Jump to search
m>Frietjes use nil |
m>Mr. Stradivarius simplify the type-property-checking code |
||
Line 67: | Line 67: | ||
root.css('margin-left', indent .. 'em') | root.css('margin-left', indent .. 'em') | ||
end | end | ||
if args['type'] | -- 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 not | local listStyleType = args.list_style_type or args['list-style-type'] | ||
local listType = args['type'] | |||
if listType and not listType:match('^%s*[1AaIi]%s*$') then | |||
if not listStyleType then | |||
listStyleType = listType | |||
listType = nil | |||
end | end | ||
end | end | ||
Line 77: | Line 80: | ||
list | list | ||
.attr('start', args.start) | .attr('start', args.start) | ||
.attr('type', | .attr('type', listType) | ||
.css('list-style-type', | .css('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. | .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)) | .wikitext(table.concat(listItems)) |