Module:discussion
Appearance
- The following documentation is located at Module:discussion/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module implements the template {{discussion recent months}}
.
local export = {}
function export.recent_months(frame)
local date = os.date("*t")
date.month = date.month - 1
if date.month == 0 then
date.year = date.year - 1
date.month = 12
end
local last_month = os.time{year = date.year, month = date.month, day = 1}
local content = tostring(mw.html.create("div")
:tag("h1")
:wikitext("[[" .. os.date("/%Y/%B", last_month) .. "|" .. os.date("%B %Y", last_month) .. "]]")
:done()
:wikitext("{{" .. os.date("/%Y/%B", last_month) .. "}}")
:tag("h1")
:wikitext("[[" .. os.date("/%Y/%B") .. "|" .. os.date("%B %Y") .. "]]")
:done()
:wikitext("{{" .. os.date("/%Y/%B") .. "}}"))
return frame:preprocess(content)
end
return export