Jump to content

Module:Top 25 report

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Od Mishehu (talk | contribs) at 12:26, 6 May 2019 (create). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {};

p.list = function(frame)
    text = "This article has been viewed enough times in a single week to make it into the [[WP:TOP25|top 25 viewed articles of that week]]";

    text = text .. "<br/>The weeks in which this happened:<ul>"

    frame = frame:getParent();

    args = frame.args
    
    Date = require('Module:Date')._Date
    for _, dateStr in pairs( frame.args ) do
        text = text .. "<li>[[Wikipedia:Top 25 Report/"
        date = Date(dateStr);
        diff=6;
        date2 = date+diff;

        if not (date2:text("%Y")==date:text("%Y")) then
            text = text..date:text("%B %-d, %Y").." to "..date2:text("%B %-d, %Y")
        else
            if not (date2:text("%B")==date:text("%B")) then
                text = text .. date:text("%B %-d") .. " to "..date2:text("%B %-d, %Y")
            else
                text = text .. date:text("%B %-d") .. " to "..date2:text("%-d, %Y")
            end
        end
        
        text = text.."|"..date:text("%B %-d, %Y").."]]</li>"
    end
    text = text .. "</ul>"

    return  frame:expandTemplate{title="tmbox", args={text=text}};

end

return p;