جز
Changed protection settings for "Module:List": High-risk Lua module: Used in MediaWiki interface ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
جز (۱ نسخه واردشده) |
fa>Wikinoor.ir جز (Changed protection settings for "Module:List": High-risk Lua module: Used in MediaWiki interface ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))) |
||
خط ۱: | خط ۱: | ||
-- This module outputs different kinds of lists. At the moment, bulleted, | -- This module outputs different kinds of lists. At the moment, bulleted, | ||
-- unbulleted, horizontal, ordered, and horizontal ordered lists are supported. | -- unbulleted, horizontal, ordered, and horizontal ordered lists are supported. | ||
خط ۲۴: | خط ۲۳: | ||
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') | ||
خط ۳۸: | خط ۳۷: | ||
indent = indent and indent * 1.6 or 0 | indent = indent and indent * 1.6 or 0 | ||
if indent > 0 then | if indent > 0 then | ||
data.marginLeft = indent .. 'em' | |||
data. | |||
end | end | ||
end | end | ||
خط ۱۱۵: | خط ۱۱۳: | ||
root:addClass(class) | root:addClass(class) | ||
end | end | ||
root:css{['margin- | root:css{['margin-left'] = data.marginLeft} | ||
if data.style then | if data.style then | ||
root:cssText(data.style) | root:cssText(data.style) | ||
خط ۱۶۰: | خط ۱۵۸: | ||
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 | ||
خط ۱۶۸: | خط ۱۶۶: | ||
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' is not a valid list type)", | ||
tostring(listType) | tostring(listType) | ||
), 2) | ), 2) | ||
خط ۱۸۲: | خط ۱۸۰: | ||
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 = {} |