「モジュール:List」の版間の差分

2版 をインポートしました
(1版 をインポートしました)
(2版 をインポートしました)
 
(5人の利用者による、間の6版が非表示)
23行目: 23行目:
data.classes = {}
data.classes = {}
if listType == 'horizontal' or listType == 'horizontal_ordered' then
if listType == 'horizontal' or listType == 'horizontal_ordered' then
table.insert(data.classes, 'hlist')
table.insert(data.classes, 'hlist hlist-separated')
elseif listType == 'unbulleted' then
elseif listType == 'unbulleted' then
table.insert(data.classes, 'plainlist')
table.insert(data.classes, 'plainlist')
69行目: 69行目:
-- Start number for ordered lists
-- Start number for ordered lists
data.start = args.start
data.start = args.start
if listType == 'horizontal_ordered' then
if listType == 'ordered' or listType == 'horizontal_ordered' then
-- Apply fix to get start numbers working with horizontal ordered lists.
-- Apply fix to get start numbers working with horizontal ordered lists.
local startNum = tonumber(data.start)
local startNum = tonumber(data.start)
if startNum then
if startNum then
data.counterReset = 'listitem ' .. tostring(startNum - 1)
data.counterReset = 'listitem ' .. tostring(startNum)
data.counterIncrement = 'listitem -1'
end
end
end
end
94行目: 95行目:
item.value = args['item' .. tostring(num) .. '_value']
item.value = args['item' .. tostring(num) .. '_value']
or args['item_value' .. tostring(num)]
or args['item_value' .. tostring(num)]
if item.value ~= nil then
item.style = 'counter-reset: listitem ' .. item.value .. ';counter-increment: none;' .. ((item.style) or '')
end
table.insert(data.items, item)
table.insert(data.items, item)
end
end
124行目: 128行目:
:css{
:css{
['counter-reset'] = data.counterReset,
['counter-reset'] = data.counterReset,
['counter-increment'] = data.counterIncrement,
['list-style-type'] = data.listStyleType
['list-style-type'] = data.listStyleType
}
}
158行目: 163行目:
local ret = ''
local ret = ''
if isDeprecated then
if isDeprecated then
ret = ret .. ''
ret = ret .. '[[Category:List templates with deprecated parameters]]'
end
end
return ret
return ret
180行目: 185行目:
p[listType] = function (frame)
p[listType] = function (frame)
local mArguments = require('Module:Arguments')
local mArguments = require('Module:Arguments')
local origArgs = mArguments.getArgs(frame)
local origArgs = mArguments.getArgs(frame, {
valueFunc = function (key, value)
if not value or not mw.ustring.find(value, '%S') then return nil end
if mw.ustring.find(value, '^%s*[%*#;:]') then
return value
else
return value:match('^%s*(.-)%s*$')
end
return nil
end
})
-- Copy all the arguments to a new table, for faster indexing.
-- Copy all the arguments to a new table, for faster indexing.
local args = {}
local args = {}