Module:List: Difference between revisions

353 bytes added ,  10 years ago
add support for start and type attributes in ordered lists
Enwikipedia>Mr. Stradivarius
(Create modified version of Module:Bulleted list. The code is by myself and User:Frietjes.)
 
Enwikipedia>Mr. Stradivarius
(add support for start and type attributes in ordered lists)
Line 83:
return ''
end
-- Check if we need a ul tag or an ol tag, and get the start and type attributes for ordered lists.
local listTag = 'ul'
local startAttr, typeAttr
if listType == 'numbered' then
listTag = 'ol'
startAttr = args.start
if startAttr then
startAttr = ' start="' .. startAttr .. '"'
end
typeAttr = args.type
if typeAttr then
typeAttr = ' type="' .. typeAttr .. '"'
end
end
startAttr = startAttr or ''
typeAttr = typeAttr or ''
-- Get the classes and styles and output the list.
local class = getClass(listType, args.class) or ''
Line 94 ⟶ 105:
list_style = list_style and (' style="' .. list_style .. '"') or ''
return mw.ustring.format(
'<div%s%s><%s%s%s%s>%s</%s></div>',
class, style, listTag, startAttr, typeAttr, list_style, table.concat(listItems), listTag
)
end