Module:List: Difference between revisions
Content added Content deleted
m (3 revisions imported: Importing Template:Tmbox, with templates.) |
m (已更改“Module:List”的保护等级:高風險模板:29009引用<!-- 機器人3 -->([编辑=仅允许模板编辑员和管理员](无限期)[移动=仅允许模板编辑员和管理员](无限期))) |
||
Line 23: | Line 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') |
||
elseif listType == 'unbulleted' then |
elseif listType == 'unbulleted' then |
||
table.insert(data.classes, 'plainlist') |
table.insert(data.classes, 'plainlist') |
||
Line 92: | Line 92: | ||
item.style = args['item' .. tostring(num) .. '_style'] |
item.style = args['item' .. tostring(num) .. '_style'] |
||
or args['item_style' .. tostring(num)] |
or args['item_style' .. tostring(num)] |
||
or args['li_style' .. tostring(num)] |
|||
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)] |
||
or args['li_value' .. tostring(num)] |
|||
table.insert(data.items, item) |
table.insert(data.items, item) |
||
end |
end |
||
Line 158: | Line 160: | ||
local ret = '' |
local ret = '' |
||
if isDeprecated then |
if isDeprecated then |
||
ret = ret .. '[[Category: |
ret = ret .. '[[Category:含有过期参数的列表模板]]' |
||
end |
end |
||
return ret |
return ret |
||
Line 166: | Line 168: | ||
if not listType or not listTypes[listType] then |
if not listType or not listTypes[listType] then |
||
error(string.format( |
error(string.format( |
||
"bad argument #1 to 'makeList' ('%s' |
"bad argument #1 to 'makeList' ('%s'不是合适的列表类型)", |
||
tostring(listType) |
tostring(listType) |
||
), 2) |
), 2) |
||
Line 180: | Line 182: | ||
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 = {} |