Module:Deletion sorting/sandbox
| This is the module sandbox page for Module:Deletion sorting (diff). |
Implements {{Deletion sorting/multi}}.
local p = {}
local introText = 'Note: This discussion has been included in the '
local delsortRoot = '[[Wikipedia:WikiProject Deletion sorting'
local dateTime = os.date("!%H:%M, %e %B %Y (UTC)")
local function _error(msg)
return mw.text.tag('strong', {['class']='error'}, 'Error in [[Template:Deletion sorting]]: ' .. msg)
end
local function _small(s)
return mw.text.tag('small', {['class']='delsort-notice'}, s)
end
local function _single(cat, sig)
return _small(introText..delsortRoot..'/'..cat..'|list of '..cat..'-related deletion discussions]]. '..sig)
end
function p.single(frame)
local args = frame:getParent().args
if not mw.ustring.match(args[1],'%S') then
if frame.args.example then args[1] = frame.args.example else return _error('Category not specified.') end
end
return _single(args[1], args.sig or args[2] or dateTime)
end
function p.multi(frame)
local args = {}
local sig=dateTime
for k, v in pairs(frame:getParent().args) do
if mw.ustring.match(v,'%S') then
if type(k) == 'number' then
local title = mw.title.new(v)
if title and title.rootText then
table.insert(args, title.rootText)
else
return _error('Input contains forbidden characters.')
end
elseif k:sub(0,3) == 'sig' then
sig = v
end
end
end
if #args == 0 then
if frame.args.example then args[1] = frame.args.example else return _error('Category not specified.') end
end
local outStr = 'Note: This discussion has been included in the '
if #args == 1 then
return _single(args[1], sig)
else
outStr = outStr..delsortRoot..'|deletion sorting]] lists for the following topics: '
for i = 1, #args do
if i > 1 then
if #args > 2 then outStr = outStr..', ' end
if i == #args then outStr = outStr..' and ' end
end
outStr = outStr..delsortRoot..'/'..args[i]..'|'..args[i]..']]'
end
return _small(outStr..'. '..sig)
end
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.