Module:TFA subpage transcluder
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
| This module depends on the following other modules: |
This template silently transcludes subpages of {{TFA title}} to keep them out of Special:UnusedTemplates. It takes two parameters: the first date to transclude and the final date to transclude. If no end date it given, it will default to seven days after the current date. The module will then record transclusions of all subpages from that date until the current day. For example, {{#invoke:TFA subpage transcluder|main|November 29, 2025}} or {{#invoke:TFA subpage transcluder|main|November 29, 2025|January 8, 2026}}. It returns the number of pages transcluded.
It is highly unlikely that this module will be helpful outside of WP:USED.
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
-- set up the date to stop processing; default to seven days from today:
local endProcessingDate = args[2] and Date(args[2]) or (Date('currentdate') + '7 days')
local dummy = '' -- dummy variable (only used so we Do Something with each date transclusion)
local count = 0 -- init the days counter
while currentProcessingDate <= endProcessingDate 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