Module:Sandbox/Od Mishehu/cfd

local p = {};

p.all = function(frame)

text = "'''This category is being considered for ";

type = frame.args[1]; targetText=""; if type=="d" then text = text .. "deletion"; elseif type=="r" then text = text .. "renaming to "; target=frame.args["target"] if target == nil then text = text .. "some other name" else targetText = "Category:"..target..""; text = text .. targetText; end elseif type=="m" then text = text .. "merging into "; target=frame.args["target"] if target == nil then text = text .. "some other category" else targetText = "Category:"..target.."" target2=frame.args["target2"] if not (target2 == nil) then target3 = frame.args["target3"] if target3==nil then targetText = targetText .. " and Category:"..target2.."" else targetText = targetText .. ", Category:"..target2.." and Category:"..target3.."" end end text = text .. targetText; end elseif type=="l" then text = text .. "conversion into a list"; target=frame.args["target"] if not(target == nil) then targetText = ""..target..""; text = text .. " named "..targetText end end

text = text .. ".'''"       section = frame.args["section"] if not (section == nil) then text = text .. " This nomination is part of a discussion of several related categories." end

text = text .. " This does not mean that any of the pages in the category will be deleted. They may, however, be recategorized. "

year = frame.args["year"] month = frame.args["month"] day = frame.args["day"]

discussionPlace = "Wikipedia:Categories for discussion/Log/"..year.." "..month.." "..day.."#" if section==nil then discussionPlace = discussionPlace .. mw.title.getCurrentTitle.fullText else discussionPlace = discussionPlace ..section end

text = text .. "Please share your thoughts on the matter at this category's entry on the Categories for discussion page. Please do not empty the category or remove this notice while the discussion is in progress. "

discussionpage = "Categories for discussion/Log/" .. os.date("%Y %B %e") text = text .. " " .. frame:expandTemplate{title="strong",args={"["..mw.title.makeTitle(4,discussionpage):fullUrl.."?action=edit&section=2 Add entry]"}}..": "..mw.title.getCurrentTitle.text if not(section==nil) then text = text .. " "

if type=="r" then adminMsg = "[https://en.wikipedia.org/w/index.php?title=Special:MovePage&wpOldTitle="..mw.uri.encode(mw.title.getCurrentTitle.prefixedText).. "&wpReason="..mw.uri.encode(""..discussionPlace.."").."&wpNewTitle="..mw.uri.encode("Category:"..target).." Click here to rename]."; else adminMsg = "If this category is empty, " adminMsg = adminMsg .. "and all incoming links have been cleaned up," reason = ""..discussionPlace..""; if type=="d" then reason = "This category has been deleted per the discussion at "..reason elseif type=="m" then if targetText=="" then reason = "Merged per "..reason; else reason = "Merged into "..targetText.." per "..reason end elseif type=="l" then if targetText=="" then reason = "Listified per "..reason; else reason = "Listified into "..targetText.." per "..reason end end adminMsg = adminMsg .. " ["..mw.title.getCurrentTitle:fullUrl.."?action=delete&wpReason=" ..mw.uri.encode(reason) adminMsg = adminMsg .. " click here to delete]." adminMsg = adminMsg .. ' '           adminMsg = adminMsg .. mw.uri.encode(""..discussionPlace.."") adminMsg = adminMsg .. ' '        end

text = text .. '

' .. "Administrators: " .. adminMsg .. " "

category=""

if mw.title.getCurrentTitle.namespace==14 then category="[[Category:Categories for "           if type=="d" then                category=category.."deletion"            elseif type=="m" then                category=category.."merging"            elseif type=="l" then                category=category.."listifying"            elseif type=="r" then                category=category.."renaming"            end            category=category.."]]" category=category..frame:expandTemplate{title="DMC",args={"Categories for discussion","from",month.." "..year}} end

return frame:expandTemplate{title="Cmbox",args={type="delete",image="none",text=text}}..category; end

return p;