Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Retro/GA
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local function _findFreePageNum(titleBody) local pageNum = 1 while true do local pageTitle = mw.title.new(titleBody .. pageNum) if not pageTitle.exists then return pageNum end pageNum = pageNum + 1 end end -- Based on _findFreePageNum function p.countPages(frame) local titleBody = frame.args[1] or "" local pageNum = 1 while true do local pageTitle = mw.title.new(titleBody .. pageNum) if not pageTitle.exists then return pageNum - 1 end pageNum = pageNum + 1 end end local function titleParts(title, numSegments, firstSegment) -- Intended to replicate the behavior of {{#titleparts: ... }} -- Can probably be more efficient with pure Lua. return mw.getCurrentFrame:callParserFunction{'titleparts', { title, numSegments, firstSegment }} end -- Probably will want to use more descriptive variable names function p.GAR(frame) local currentTitle = mw.title.getCurrentTitle() if mw.isSubsting() and currentTitle.inNamespace(1) then local pageNum = _findFreePageNum("Talk:" .. currentTitle.text .. "/GA") local GARpageNum = _findFreePageNum("Wikipedia:Good article reassessment/" .. currentTitle.text .. "/") return "{{GAR/link|" .. frame:preprocess("~~~~~") .. "|page=" .. pageNum .. "|GARpage=" .. GARpageNum .. "|status= }}" else return frame:expandTemplate{ title = "error", args = { frame:preprocess("This template should be '''substituted''' at the top of the article '''talk''' page.") } } end end -- Maybe specify the name further; this is currently only for community reviews -- Should there be a variant for individual reviews? function p.mostRecentReview(frame) currentTitle = mw.title.getCurrentTitle() -- ns comparison is inaccurate if mw.isSubsting() and currentTitle.inNamespace(4) -- Wikipedia namespace (see [[WP:NS]]) and currentTitle.rootText == "Good article reassessment" then articleTitle = titleParts(currentTitle.text, 1, 2) local pageNum = _findFreePageNum("Talk:" .. articleTitle .. "/GA") if pageNum == 1 then return "GAN review not found" else return "[[" .. articleTitle .. "/GA" .. (pageNum - 1) .. "|Most recent review]]" end -- Error message: -- " This template should be [[Wikipedia:Substitution|substituted]] on a community good article reassessment page." end end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Retro/GA/doc
(
edit
)