Module:TFA subpage transcluder

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

local p = {}
local Date = require('Module:Date')._Date
local getArgs = require('Module:Arguments').getArgs

function p.main(frame)
	local args = getArgs(frame) -- get the args
	local currentProcessingDate = Date(args[1]) -- init the current processing date
	local now = Date('currentdate') -- set up as today as a Date table
	local dummy = '' -- dummy variable (only used so we Do Something with each date transclusion)
	local count = 0 -- init the days counter
	
	while currentProcessingDate <= now do
		dummy = mw.title.new('Template:TFA title/' .. currentProcessingDate:text('mdy')).content
		count = count + 1 -- increment the count of pages checked
		currentProcessingDate = currentProcessingDate + '1 day' -- move on the the next day
	end
	
	return count
end

return p