「モジュール:List」の版間の差分
ナビゲーションに移動
検索に移動
コード修正。モジュール:List/sandboxの2021年12月13日 (月) 00:33(JST)の版から。
細 (1版) |
bsd>STS2657 (コード修正。モジュール:List/sandboxの2021年12月13日 (月) 00:33(JST)の版から。) |
||
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 | ||
} | } | ||
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 = {} |