Module:Sandbox/ProcrastinatingReader: Difference between revisions

Content deleted Content added
no tag error
param sub, fetch delete discussions
Line 5:
local data = mw.loadData('Module:Sandbox/ProcrastinatingReader/data')
 
-- G4 functions
function p.main(frame)
local function getDeletionDiscussions()
local args = getArgs(frame, {
local namespaceMap = {
wrappers = {
[""] = "Articles for deletion"
--'Template:Sandbox/ProcrastinatingReader'
}
--local current_page = mw.title.getCurrentTitle()
})
local output = ""
return p.build(frame, args)
local n = 1
local current_page = mw.title.new("Premadasa Hegoda")
local namespace = current_page.nsText
while true do -- possibly expensive
page = mw.title.makeTitle('Wikipedia', namespaceMap[namespace]..'/'..current_page.text..(n > 1 and " ("..n.."nd nomination)" or ""))
if page.exists then
output = output .. "[["..page.prefixedText.."]]"
n = n + 1
else
break
end
end
return output
end
 
-- Message functions
local function substitute(msg, args)
return args and mw.message.newRawMessage( msg, args ):plain() or msg;
end
 
local function substituteMsgParams(msgKey, msg)
local replacements = {
['g4.message'] = {"{{fullurl:Special:Log|type=delete&page={{FULLPAGENAMEE}}}}"},
['g4.extra'] = {getDeletionDiscussions()}
}
 
return substitute(msg, replacements[msgKey])
end
 
Line 29 ⟶ 56:
template = frame:expandTemplate{ title = 'db-meta', args = {
-- Required
' '..frame:preprocess(substituteMsgParams(criterion:lower()..'.message', tag['message'])), -- Main text, in bold
frame:preprocess(substituteMsgParams(criterion:lower()..'.extra', tag['extra'])) or '', -- Main text, in italics
criterion = criterion, -- Criteron
 
Line 61 ⟶ 88:
 
return template .. frame:preprocess(categorisation)
end
 
function p.main(frame)
local args = getArgs(frame, {
wrappers = {
--'Template:Sandbox/ProcrastinatingReader'
}
})
return p.build(frame, args)
end