Difference between revisions of "Module:List"
Jump to navigation
Jump to search
fix ordered lists - had a stupid variable clash
meta>Mr. Stradivarius (simplify the type-property-checking code) |
meta>Mr. Stradivarius (fix ordered lists - had a stupid variable clash) |
||
Line 69: | Line 69: | ||
-- 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. | -- 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. | ||
local listStyleType = args.list_style_type or args['list-style-type'] | local listStyleType = args.list_style_type or args['list-style-type'] | ||
local | local typeAttr = args['type'] | ||
if | if typeAttr and not typeAttr:match('^%s*[1AaIi]%s*$') then | ||
if not listStyleType then | if not listStyleType then | ||
listStyleType = | listStyleType = typeAttr | ||
typeAttr = nil | |||
end | end | ||
end | end | ||
Line 80: | Line 80: | ||
list | list | ||
.attr('start', args.start) | .attr('start', args.start) | ||
.attr('type', | .attr('type', typeAttr) | ||
.css('list-style-type', listStyleType) | .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. |