Difference between revisions of "Module:LatestAfD"
Jump to navigation
Jump to search
blackwiki>Swpb |
blackwiki>Swpb |
||
| Line 3: | Line 3: | ||
function p.latestafd(frame) | function p.latestafd(frame) | ||
local page = frame.args[1] | local page = frame.args[1] | ||
| + | base_string = "Wikipedia:Articles for deletion/" .. page | ||
| − | |||
base_title = mw.title.new(base_string) | base_title = mw.title.new(base_string) | ||
| + | afd2_title = mw.title.new(base_string .. " (2nd nomination)") | ||
if not base_title.exists then | if not base_title.exists then | ||
return "Error, no AfD exists" | return "Error, no AfD exists" | ||
| + | elseif not afd2_title.exists then | ||
| + | return "[[" .. base_string .. "]]" | ||
else | else | ||
afd_num = 1 | afd_num = 1 | ||
latest = false | latest = false | ||
while not latest do | while not latest do | ||
| − | + | next_title = mw.title.new(base_string .. "") | |
| − | if | + | if not next_title.exists then |
| − | return "[[" .. base_string .. "]]" | + | return "[[" .. base_string .. " (afd_num nomination)]]" |
end | end | ||
| + | afd_num = afd_num + 1 | ||
end | end | ||
Revision as of 18:03, 30 May 2017
local p = {}
function p.latestafd(frame)
local page = frame.args[1]
base_string = "Wikipedia:Articles for deletion/" .. page
base_title = mw.title.new(base_string)
afd2_title = mw.title.new(base_string .. " (2nd nomination)")
if not base_title.exists then
return "Error, no AfD exists"
elseif not afd2_title.exists then
return "[[" .. base_string .. "]]"
else
afd_num = 1
latest = false
while not latest do
next_title = mw.title.new(base_string .. "")
if not next_title.exists then
return "[[" .. base_string .. " (afd_num nomination)]]"
end
afd_num = afd_num + 1
end
end
end
return p