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 endend
-- Based on _findFreePageNumfunction 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 endend
local function titleParts(title, numSegments, firstSegment) -- Intended to replicate the behavior of -- Can probably be more efficient with pure Lua. return mw.getCurrentFrame:callParserFunctionend
-- 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 "" else return frame:expandTemplate endend
-- 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) and currentTitle.rootText
1 then return "GAN review not found" else return "Most recent review" end -- Error message: -- " This template should be substituted on a community good article reassessment page." endend
return p