-- The purpose of this module ("Articles To Avoid") is to allow people-- who want to avoid editing specific articles to add the following in their signature:
--
-- The Lua script will go to the first anon parameter and import its content.-- This is a list of articles you don't want to edit-- (say, because you're topic banned, or you're worried Putin is out to get you), -- does a frame.preprocess on it to ensure (???) any transclusions are done, -- gets the current page you are editing, and sees if currentpage is in the list.-- If so, it returns the link to Encyclopedia Dramatica-- (eventually, a proposal should be made to add an error message added to the blacklist-- that explains the program that is doing it and what you need to do to your signature to undo it).-- Note that the signature preferences are not directly accessible to very many people, -- maintaining a certain sort of privacy-- (if you elect to make a call to an existing blacklist posted by someone else, for example, or-- if you opt out of the blacklist hoping you'll get away with it)-- but of course, right now anyone can see what articles you've edited.-- starting below from a straight copy of my Module:TrainingPages: local p = function anonymize(name) return mw.ustring.gsub(name,"^"..mw.site.siteName,"Project") or nameend function p.block(frame) local debuglog="" local parent=frame.getParent(frame) local currentpage,indexmodule,defaultpage,noerr ---- args in the #invoke itself trump args in the parent frame currentpage = frame.args.page -- this is only useful for testing! debugout = frame.args.debug indexmodule = frame.args[1] or frame.args.index noerr=frame.args.noerr anonymizereturn = frame.args.anonymize whitelist = frame.args.allow ---- args in the parent frame come next if parent then currentpage=currentpage or parent.args.page indexmodule=indexmodule or parent.args[1] or parent.args.index -- index here is NOT generally a module, unlike TrainingPages, -- because it needs to be accessible to newbies and possibly support transclusions noerr=noerr or parent.args.noerr debugout = debugout or parent.args.debug anonymizereturn = anonymizereturn or parent.args.anonymize whitelist = whitelist or parent.args.allow end ---- default values if parameters aren't provided whitelist = whitelist or "" if not(indexmodule) then if noerr then return "" else return " error:no index parameter specified" end end if not(currentpage) then local pp=mw.title.getCurrentTitle if not pp then if noerr then return "" else return " error:failed to access getCurrentTitle" -- this shouldn't happen anyway, I don't think.... end end currentpage=pp.fullText end -- process parameters whiteitem = for i in string.gmatch(whitelist, "%[%[(.-)%]%]") do debuglog = debuglog .. "WHITELIST" .. i whiteitem [mw.uri.encode(anonymize(i),"WIKI")] = true end currentpage = anonymize(currentpage) --- convert "Wikipedia:, "Meta:" etc. into "Project: currentpage = mw.uri.encode(currentpage,"WIKI") --- hopefully this gets the +'s and diacritics right... debuglog = debuglog .. currentpage local index= if mw.ustring.sub(indexmodule,1,6)
currentpage) .. (tostring(whiteitem[link]) or "nope") if not(whiteitem[link]) and (link
return p