跳至內容
主選單
主選單
移至側邊欄
隱藏
導覽
首頁
近期變更
建立新頁面
隨機頁面
五大觀念?
新手使用指南
頁面存廢討論
百科財務報告
微國家百科
搜尋
搜尋
建立帳號
登入
個人工具
建立帳號
登入
暗色模式
檢視 模組:Template:Delete 的原始碼
模組
討論
English
閱讀
檢視原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
檢視原始碼
檢視歷史
一般
連結至此的頁面
相關變更
特殊頁面
頁面資訊
取得短網址
←
模組:Template:Delete
由於以下原因,您無權編輯此頁面:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
local data = require('Module:Template:Delete/data') 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 extractDeleteReason(item) return item['deletereason'] or item['criteria'] or '' end function shortDesc(frame, name) name = mw.text.trim(name):upper() wt = {} for i, item in ipairs(data) do if name == '' or #name == 1 and item['code']:sub(1, 1) == name or item['code'] == name then para = extractShortDesc(item) if para ~= '' then table.insert(wt, para) end end end if short then return table.concat(wt, '\n') else return frame:preprocess(table.concat(wt, '\n')) end end function z.shortDesc(frame) return shortDesc(frame, frame.args[1]) end function z.reasons(frame) wt = {} for i, item in ipairs(data) do if item['code'] == 'G8' then -- 在提示選單隱藏G8 else allnames = extractAliases(item) table.insert(wt, '<tr><td>' .. mw.text.listToText(allnames, '、', '或') .. '<td title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '</td>') end end return '<table class="wikitable">' .. table.concat(wt) .. '</table>' end function z.input(frame) if frame.args.parent then args = frame:getParent().args else args = frame.args end -- precache 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 -- parse i = 1 rows = {} pretext = {} deletelinks = {} while i < 10 do arg = args[i] if arg and map[mw.text.trim(arg:lower())] then item = data[map[mw.text.trim(arg:lower())]] if frame.args.reasoncode then return item['code'] end title = mw.title.getCurrentTitle() checkfunc = item['check'] if checkfunc then check = checkfunc(title) else check = nil end rowsuffix2 = '' deletesuffix = '' -- special case for F1/F5 if item['code'] == 'F1' or item['code'] == 'F5' then i = i + 1 if args[i] then img = mw.text.trim(args[i]) else img = nil end if img then imgtitle = mw.title.new(img, 'Media') else imgtitle = nil end if imgtitle then deletesuffix = ':[[:File:' .. imgtitle.text .. ']]' else if check then rowsuffix2 = '<br><span class="error">為方便管理員檢查,請加上保留檔案的名稱。</span>' else check = '為方便管理員檢查,請加上保留檔案的名稱。' end end end if title.namespace == 2 and (item['code'] == 'O1' or item['code'] == 'G10') then rowsuffix2 = args.cat or args.cate or args.category or ('[[Category:O1快速刪除候選]]') end if check then rowsuffix = '<br><span class="error">' .. check .. '</span>' .. (args.cat or args.cate or args.category or '[[Category:快速刪除候選|錯]]') else if frame.args.deletelink then table.insert(deletelinks, '[[WP:CSD#' .. item['code'] .. '|' .. item['code'] .. ']]: ' .. extractDeleteReason(item) .. deletesuffix) end rowsuffix = args.cat or args.cate or args.category or ('[[Category:快速刪除候選|' .. (item['category'] or '速') .. ']]') end if deletesuffix then row = '* <strong><span id="speedy-delete-' .. item['code'] .. '" title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '([[WP:CSD#' .. item['code'] .. '|CSD ' .. item['code'] .. ']]' .. deletesuffix .. ')' .. rowsuffix .. rowsuffix2 .. '</span></strong>' else row = '* <strong><span id="speedy-delete-' .. item['code'] .. '" title="' .. extractShortDesc(item) .. '">' .. item['criteria'] .. '([[WP:CSD#' .. item['code'] .. '|CSD ' .. item['code'] .. ']])' .. rowsuffix .. rowsuffix2 .. '</span></strong>' end table.insert(rows, row) elseif arg and mw.text.trim(arg) ~= '' then if frame.args.reasoncode then return '' end -- try to read it as a title title = mw.title.new(mw.text.trim(arg)) cat = args.cat or args.cate or args.category or '[[Category:快速刪除候選|速]]' if title and title.exists then if frame.args.deletelink then table.insert(deletelinks, '[[:' .. arg .. ']]') end table.insert(rows, '*<strong>' .. cat .. '[[:' .. arg .. ']]</strong>') else if frame.args.deletelink then table.insert(deletelinks, arg) end arg = string.gsub(arg, '^([*:#]*)(.*)', '%1<strong>%2</strong>') table.insert(rows, '*' .. cat .. arg) end end arg = args['c' .. i] if arg and mw.text.trim(arg) ~= '' then table.insert(rows, '*' .. arg) end i = i + 1 end -- for use by Twinkle if frame.args.deletelink then local temp = table.concat(deletelinks, ';'):gsub('。;', ';'):gsub('。:', ':') return mw.text.trim(temp) end if #rows > 0 then return mw.text.trim(table.concat(pretext) .. '\n' .. table.concat(rows, '\n')) else return '<span style="font-weight:bold;color:red;">(請填寫理由)</span>' .. (args.cat or args.cate or args.category or '[[Category:快速刪除候選|錯]]') end end return z
此頁面使用了以下模板:
模組:Template:Delete/doc
(
檢視原始碼
)
返回到「
模組:Template:Delete
」。
切換限制內容寬度