有兽档案馆
搜索
切换搜索
切换菜单
切换个人菜单
查看“Module:Template:Delete2”的源代码
来自有兽档案馆
阅读
查看源代码
查看历史
模块
讨论
更多操作
←
Module:Template:Delete2
因为以下原因,您没有权限编辑该页面:
您所请求的操作,仅限具有
注册用户
、
自动确认用户
、
管理员
、
界面管理员
、
优质编辑者
、
确认用户
、
巡查员
、
档案理事员
等
权限
的
用户
执行。
若您尚未登录有兽档案馆账号,请您
登录
有兽档案馆账号后操作。
您尚未完成电子邮件确认,因此操作受限,请尽快
完成电子邮件确认
。
若您无法完成前述手续,请通过适当渠道请求管理员或档案理事员协助。
您可以查看和复制此页面的源代码。
若您无权编辑本页面,您可以
提出编辑请求
,提请有权限者代为编辑。
local mDelete = require('Module:Delete') local mDelcat = require('Module:Delcat') local data = require('Module:Delete/data') local data_sandbox = require('Module:Delete/data/sandbox') local z = {} function extractAliases(item) allnames = {item['code']} for j, alias in ipairs(item['aliases']) do table.insert(allnames, alias) end return allnames end function extractShortDesc(item) if item['description'] then return item['description']:gsub('{', '{'):gsub('}', '}'):gsub('|', '|') else return '' end end function z.reasonsBox(frame) local wt = [=[ {|class="wikitable |- !速刪編號!!可使用的代碼!!簡介!!詳細說明 ]=] for i, item in ipairs(data) do allnames = extractAliases(item) wt = wt .. string.format([=[ |- |%s | * %s |%s |%s ]=] , item['code'], mw.text.listToText(allnames, '\n* ', '\n* '), item['criteria'], extractShortDesc(item):gsub('{{', '{{tl|'):gsub('|', '|'):gsub('}}', '}}')) end wt = wt .. '|}' return frame:preprocess(wt) end function z.reasonsBox_sandbox(frame) local wt = [=[ <span style="font-weight:bold; background-color:#FFDD77; color:#800000;">(*)</span><span style="font-weight:bold; color:red;">提醒:此渲染版本為沙盒版本,可能與目前通行版本有所不同!</span> {|class="wikitable |- !速刪編號!!可使用的代碼!!簡介!!詳細說明 ]=] for i, item in ipairs(data_sandbox) do allnames = extractAliases(item) wt = wt .. string.format([=[ |- |%s | * %s |%s |%s ]=] , item['code'], mw.text.listToText(allnames, '\n* ', '\n* '), item['criteria'], extractShortDesc(item):gsub('{{', '{{tl|'):gsub('|', '|'):gsub('}}', '}}')) end wt = wt .. '|}' return frame:preprocess(wt) end function z.CSD_reason(frame) if frame.args.parent then args = frame:getParent().args else args = frame.args end map = {} for i, item in ipairs(data) do map[item['code']:lower()] = i for j, alias in ipairs(item['aliases']) do map[alias:lower()] = i end end i = 1 rows = {} arg = args[1] if arg ~= nil then if arg and map[mw.text.trim(arg:lower())] then item = data[map[mw.text.trim(arg:lower())]] local text = '' if args[2] ~= nil and args[2] ~= '' then text = args[2] elseif args['notCSD'] ~= nil and args['notCSD'] ~= '' then text = item['code'] else text = 'CSD ' .. item['code'] end if args.nolink then return text elseif args.reason then return '[[LIB:CSD#' .. item['code'] .. '|' .. text .. ']]:<span title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '</span>' elseif args.onlyreason then return '<span title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '</span>' else return '[[LIB:CSD#' .. item['code'] .. '|' .. text .. ']]' end elseif arg and mw.text.trim(arg) ~= '' then return require('Module:Error').error{'錯誤:無法找到速刪代碼為' .. args[i] .. '的速刪項目。'} end else return '[[LIB:CSD|' .. (args[2] or '快速删除条例') .. ']]' end end function z.CSD_reason_sb(frame) if frame.args.parent then args = frame:getParent().args else args = frame.args end map = {} for i, item in ipairs(data_sandbox) do map[item['code']:lower()] = i for j, alias in ipairs(item['aliases']) do map[alias:lower()] = i end end i = 1 rows = {} arg = args[1] if arg ~= nil then if arg and map[mw.text.trim(arg:lower())] then item = data_sandbox[map[mw.text.trim(arg:lower())]] local text = '' if args[2] ~= nil and args[2] ~= '' then text = args[2] elseif args['notCSD'] ~= nil and args['notCSD'] ~= '' then text = item['code'] else text = 'CSD ' .. item['code'] end if args.nolink then return text elseif args.reason then return '[[LIB:CSD#' .. item['code'] .. '|' .. text .. ']]:<span title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '</span>' elseif args.onlyreason then return '<span title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '</span>' else return '[[LIB:CSD#' .. item['code'] .. '|' .. text .. ']]' end elseif arg and mw.text.trim(arg) ~= '' then return require('Module:Error').error{'錯誤:無法找到速刪代碼為' .. args[i] .. '的速刪項目。'} end else return '[[LIB:CSD|' .. (args[2] or '快速删除条例') .. ']]' end end function z._input(args, callargs) callargs = callargs or {} local vaildArgs = false local i = 0 while i < 10 do arg = args[i] if arg and mw.text.trim(arg) ~= '' then vaildArgs = true end i = i + 1 end if not vaildArgs then return nil end -- hack args.parent = false args.reasoncode = callargs.reasoncode args.deletelink = callargs.deletelink return mDelete.input({ args = args }) end function z._getInputWithoutError(args) local result = z._input(args, { reasoncode = false, deletelink = false }) if not result then return nil end -- remove error and category result = mDelcat.delete_category(result, {}) result = mw.ustring.gsub(result, "<br><span class=\"error\">.-</span>", "") -- replace <strong><span id="speedy-delete-XXX" title="xxx">(.-)</span></strong> result = mw.ustring.gsub(result, "<strong><span id=\"speedy%-delete%-.-\" title=\".-\" ->(.-)</span></strong>", "%1") return result end function z.getInputWithoutError(frame) local args = frame:getParent().args local out = z._getInputWithoutError(args); if not out then return '* <span style="color:#080;">(未填寫理由)</span>' end return out end z.reasons_box = z.reasonsBox z.reasons_box_sb = z.reasonsBox_sandbox z.CSD_reason_sb = z.CSD_reason_sandbox return z
该页面使用的模板:
Module:Arguments
(
查看源代码
)
Module:Delete
(
查看源代码
)
Module:Documentation
(
查看源代码
)
Module:Fullurl
(
查看源代码
)
Module:No globals
(
查看源代码
)
Module:Page name
(
查看源代码
)
Module:Template:Delete
(
查看源代码
)
Module:Template:Delete/data
(
查看源代码
)
Module:Template:Delete2
(
查看源代码
)
Module:Template:Delete2/doc
(
查看源代码
)
Module:Yesno
(
查看源代码
)
返回
Module:Template:Delete2
。