Module:List: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(fix horizontal numbered list style) |
(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, |
-- 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 == ' |
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 == ' |
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 == ' |
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', ' |
local funcNames = {'bulleted', 'unbulleted', 'horizontal', 'ordered', 'horizontal_ordered'} |
||
for _, funcName in ipairs(funcNames) do |
for _, funcName in ipairs(funcNames) do |