Modul:List: Perbedaan revisi
xfer from sandbox per edit request on talk page
Mediawiki>Gervant of Shiganshina k (Melindungi "Modul:List": 7. Templat atau modul yang banyak digunakan ([Sunting=Hanya untuk pengurus] (selamanya) [Pindahkan=Hanya untuk pengurus] (selamanya))) |
Mediawiki>Paine Ellsworth (xfer from sandbox per edit request on talk page) |
||
| Baris 4: | Baris 4: | ||
local libUtil = require('libraryUtil') | local libUtil = require('libraryUtil') | ||
local checkType = libUtil.checkType | local checkType = libUtil.checkType | ||
local mTableTools = require(' | local mTableTools = require('Module:TableTools') | ||
local p = {} | local p = {} | ||
| Baris 158: | Baris 158: | ||
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 | ||
| Baris 166: | Baris 166: | ||
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' is not a valid list type)", | ||
tostring(listType) | tostring(listType) | ||
), 2) | ), 2) | ||
| Baris 179: | Baris 179: | ||
for listType in pairs(listTypes) do | for listType in pairs(listTypes) do | ||
p[listType] = function (frame) | p[listType] = function (frame) | ||
local mArguments = require(' | 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 = {} | ||