Module:Sandbox/DannyS712/count

local p = {}

function p.count(frame) local page = mw.title.getCurrentTitle local content = page:getContent if content == nil then return "" end local replaced = "" local number = 0; replace, number = string.gsub( content, "#", "#") return number; end

function p.countAt(frame) local target = frame.args[1] if target == nil then return "target was nil" end local title = "WikiProject Abandoned Drafts/Stale drafts/" .. target local page = mw.title.makeTitle( 4, title ) local content = page:getContent or 0 local replaced = "" local number = 0; replace, number = string.gsub( content, "#", "#") local total = frame.args[2] or 1000 local progress = ( total - number ) / 10 local result = number .. " || " .. progress .. "%"   return result; end

function p.countFfD(frame) local content = mw.title.makeTitle( 4, "Files_for_discussion" ):getContent or "Error #1" content = mw.text.split( content, "== Old discussions ==")[2] content = mw.text.split( content, "For older nominations") local to_return = content[1] return to_return end

function p.countRM(frame) local content = mw.title.makeTitle( 4, "Requested_moves/Current_discussions" ):getContent or "Error #1" content = mw.text.split( content, "===Elapsed listings===")[2] local _, count = string.gsub( content, "|Discuss%]%]%)", "|Discuss%]%]%)") local _, count2 = string.gsub( content, "|Di scu ss%]%]%)", "|Di scu ss%]%]%)"); local dump = require('Module:Dump')._dump return "Elapsed listings:" .. (count + count2) .. dump( content, 'content' ) --return to_return end

return p