Difference between revisions of "Module:List"

8 bytes removed ,  05:51, 14 November 2013
replace "numbered" with "ordered"
meta>Mr. Stradivarius
(fix horizontal numbered list style)
meta>Mr. Stradivarius
(replace "numbered" with "ordered")
Line 1: Line 1:
-- This module outputs different kinds of lists. At the moment, bulleted, unbulleted,
-- This module outputs different kinds of lists. At the moment, bulleted, unbulleted,
-- horizontal, numbered, and horizontal numbered lists are supported.
-- horizontal, ordered, and horizontal ordered lists are supported.


local p = {}
local p = {}
Line 41: Line 41:
local function getClass(listType, class)
local function getClass(listType, class)
local classes = {}
local classes = {}
if listType == 'horizontal' or listType == 'horizontal_numbered' then
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(classes, 'hlist')
table.insert(classes, 'hlist')
elseif listType == 'unbulleted' then
elseif listType == 'unbulleted' then
Line 56: Line 56:
local function getStyle(listType, indent, style)
local function getStyle(listType, indent, style)
local styles = {}
local styles = {}
if listType == 'horizontal' or listType == 'horizontal_numbered' then
if listType == 'horizontal' or listType == 'horizontal_ordered' then
indent = indent and tonumber(indent)
indent = indent and tonumber(indent)
indent = tostring((indent and indent * 1.6) or 0)
indent = tostring((indent and indent * 1.6) or 0)
Line 87: Line 87:
local listTag = 'ul'
local listTag = 'ul'
local startAttr, typeAttr
local startAttr, typeAttr
if listType == 'numbered' or listType == 'horizontal_numbered' then
if listType == 'ordered' or listType == 'horizontal_ordered' then
listTag = 'ol'
listTag = 'ol'
startAttr = args.start
startAttr = args.start
Line 134: Line 134:
end
end


local funcNames = {'bulleted', 'unbulleted', 'horizontal', 'numbered', 'horizontal_numbered'}
local funcNames = {'bulleted', 'unbulleted', 'horizontal', 'ordered', 'horizontal_ordered'}


for _, funcName in ipairs(funcNames) do
for _, funcName in ipairs(funcNames) do
Anonymous user