<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.agency/index.php?action=history&amp;feed=atom&amp;title=Module%3ACalendar</id>
		<title>Module:Calendar - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.agency/index.php?action=history&amp;feed=atom&amp;title=Module%3ACalendar"/>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Calendar&amp;action=history"/>
		<updated>2026-05-02T19:45:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.1</generator>

	<entry>
		<id>https://wiki.agency/index.php?title=Module:Calendar&amp;diff=3639&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Calendar&amp;diff=3639&amp;oldid=prev"/>
				<updated>2018-11-02T15:16:27Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:16, 2 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>https://wiki.agency/index.php?title=Module:Calendar&amp;diff=3638&amp;oldid=prev</id>
		<title>Mr. Stradivarius: copy from Module:Current events calendar</title>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Calendar&amp;diff=3638&amp;oldid=prev"/>
				<updated>2017-08-31T11:50:47Z</updated>
		
		<summary type="html">&lt;p&gt;copy from &lt;a href=&quot;/Module:Current_events_calendar&quot; title=&quot;Module:Current events calendar&quot;&gt;Module:Current events calendar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module renders the calendar seen on [[Portal:Current events]].&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function makeWikilink(link, display)&lt;br /&gt;
	if display then&lt;br /&gt;
		return string.format(&amp;#039;[[%s|%s]]&amp;#039;, link, display)&lt;br /&gt;
	else&lt;br /&gt;
		return string.format(&amp;#039;[[%s]]&amp;#039;, link)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main()&lt;br /&gt;
	local dateStuff = p.getDateStuff()&lt;br /&gt;
	local dayStrings = p.makeDayStrings(dateStuff)&lt;br /&gt;
	return p.export(dayStrings, dateStuff)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getDateStuff()&lt;br /&gt;
	-- Gets date data.&lt;br /&gt;
	local dateStuff = {}&lt;br /&gt;
	local lang = mw.language.getContentLanguage()&lt;br /&gt;
	--Year&lt;br /&gt;
	local year = lang:formatDate(&amp;#039;Y&amp;#039;)&lt;br /&gt;
	year = tonumber(year)&lt;br /&gt;
	dateStuff.year = year&lt;br /&gt;
	-- Month&lt;br /&gt;
	local month = lang:formatDate(&amp;#039;F&amp;#039;)&lt;br /&gt;
	dateStuff.month = month&lt;br /&gt;
	-- Month and year&lt;br /&gt;
	local monthAndYear = lang:formatDate(&amp;#039;F Y&amp;#039;)&lt;br /&gt;
	local firstOfMonth = lang:formatDate(&amp;#039;01-m-Y&amp;#039;)&lt;br /&gt;
	dateStuff.monthAndYear = monthAndYear&lt;br /&gt;
	-- Previous month and year&lt;br /&gt;
	dateStuff.previousMonthAndYear = lang:formatDate(&amp;#039;F Y&amp;#039;, firstOfMonth .. &amp;#039; -1 month&amp;#039;)&lt;br /&gt;
	-- Next month and year&lt;br /&gt;
	dateStuff.nextMonthAndYear = lang:formatDate(&amp;#039;F Y&amp;#039;, firstOfMonth .. &amp;#039; +1 month&amp;#039;)&lt;br /&gt;
	-- Day&lt;br /&gt;
	local day = lang:formatDate(&amp;#039;j&amp;#039;)&lt;br /&gt;
	day = tonumber(day)&lt;br /&gt;
	dateStuff.day = day&lt;br /&gt;
	-- Days in month&lt;br /&gt;
	local daysInMonth = lang:formatDate(&amp;#039;j&amp;#039;, firstOfMonth .. &amp;#039; +1 month -1 day&amp;#039;)&lt;br /&gt;
	daysInMonth = tonumber(daysInMonth)&lt;br /&gt;
	dateStuff.daysInMonth = daysInMonth&lt;br /&gt;
	-- Weekday of the first day of the month&lt;br /&gt;
	local firstWeekday = lang:formatDate(&amp;#039;w&amp;#039;, firstOfMonth) -- Sunday = 0, Saturday = 6&lt;br /&gt;
	firstWeekday = tonumber(firstWeekday)&lt;br /&gt;
	firstWeekday = firstWeekday + 1 -- Make compatible with Lua tables. Sunday = 1, Saturday = 7.&lt;br /&gt;
	dateStuff.firstWeekday = firstWeekday&lt;br /&gt;
	return dateStuff&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.makeDayStrings(dateStuff)&lt;br /&gt;
	local calStrings = {}&lt;br /&gt;
	local currentDay = dateStuff.day&lt;br /&gt;
	local isLinkworthy = p.isLinkworthy&lt;br /&gt;
	local currentMonth = dateStuff.month&lt;br /&gt;
	local currentYear = dateStuff.year&lt;br /&gt;
	local makeDayLink = p.makeDayLink&lt;br /&gt;
	for day = 1, dateStuff.daysInMonth do&lt;br /&gt;
		if isLinkworthy(day, currentDay) then&lt;br /&gt;
			calStrings[#calStrings + 1] = makeDayLink(day, currentMonth, currentYear)&lt;br /&gt;
		else&lt;br /&gt;
			calStrings[#calStrings + 1] = tostring(day)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return calStrings&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.isLinkworthy(day, currentDay)&lt;br /&gt;
	-- Returns true if the calendar day should be linked, and false if not.&lt;br /&gt;
	-- Days should be linked if they are the current day or if they are within the six&lt;br /&gt;
	-- preceding days, as that is the number of items on the current events page.&lt;br /&gt;
	if currentDay - 6 &amp;lt;= day and day &amp;lt;= currentDay then&lt;br /&gt;
		return true&lt;br /&gt;
	else&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.makeDayLink(day, month, year)&lt;br /&gt;
	return string.format(&amp;quot;&amp;#039;&amp;#039;&amp;#039;[[#%d %s %d|&amp;amp;nbsp;&amp;amp;nbsp;%d&amp;amp;nbsp;&amp;amp;nbsp;]]&amp;#039;&amp;#039;&amp;#039;&amp;quot;, year, month, day, day)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.export(dayStrings, dateStuff)&lt;br /&gt;
	-- Generates the calendar HTML.&lt;br /&gt;
	local monthAndYear = dateStuff.monthAndYear&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	root&lt;br /&gt;
		:addClass(&amp;#039;infobox&amp;#039;)&lt;br /&gt;
		:css{&lt;br /&gt;
			display = &amp;#039;table&amp;#039;,&lt;br /&gt;
			width = &amp;#039;100%&amp;#039;,&lt;br /&gt;
			float = &amp;#039;initial&amp;#039;, &lt;br /&gt;
			[&amp;#039;max-width&amp;#039;] = &amp;#039;350px&amp;#039;,&lt;br /&gt;
			margin = &amp;#039;auto !important&amp;#039;,&lt;br /&gt;
			[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;,&lt;br /&gt;
			[&amp;#039;background-color&amp;#039;] = &amp;#039;#f5faff&amp;#039;,&lt;br /&gt;
			border = &amp;#039;1px solid #cedff2&amp;#039;&lt;br /&gt;
		}&lt;br /&gt;
		-- Headings&lt;br /&gt;
		:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;background-color&amp;#039;, &amp;#039;#cedff2&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css{[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
				:wikitext(makeWikilink(&amp;#039;Portal:Current events/&amp;#039; .. dateStuff.previousMonthAndYear, &amp;#039;◀&amp;#039;))&lt;br /&gt;
				:done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, &amp;#039;5&amp;#039;)&lt;br /&gt;
				:css{[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
				:wikitext(makeWikilink(&amp;#039;Portal:Current events/&amp;#039; .. monthAndYear, monthAndYear))&lt;br /&gt;
				:done()&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css{[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
				:wikitext(makeWikilink(&amp;#039;Portal:Current events/&amp;#039; .. dateStuff.nextMonthAndYear, &amp;#039;▶&amp;#039;))&lt;br /&gt;
&lt;br /&gt;
	-- Day of week headings&lt;br /&gt;
	local dayHeadingRow = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	local weekdays = {&amp;#039;S&amp;#039;, &amp;#039;M&amp;#039;, &amp;#039;T&amp;#039;, &amp;#039;W&amp;#039;, &amp;#039;T&amp;#039;, &amp;#039;F&amp;#039;, &amp;#039;S&amp;#039;}&lt;br /&gt;
	for i, weekday in ipairs(weekdays) do&lt;br /&gt;
		dayHeadingRow:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:css{[&amp;#039;width&amp;#039;] = &amp;#039;14%&amp;#039;, [&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
			:wikitext(weekday)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Days&lt;br /&gt;
	local colspan = dateStuff.firstWeekday - 1&lt;br /&gt;
	local cellCount = 0 -- Tracks the number of day cells.&lt;br /&gt;
	local firstDayRow = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	if colspan &amp;gt; 1 then&lt;br /&gt;
		firstDayRow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, tostring(colspan))&lt;br /&gt;
	elseif colspan == 1 then&lt;br /&gt;
		firstDayRow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	for i = colspan + 1, 7 do -- Finish the first row&lt;br /&gt;
		cellCount = cellCount + 1&lt;br /&gt;
		firstDayRow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:css{[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
			:wikitext(dayStrings[cellCount])&lt;br /&gt;
	end&lt;br /&gt;
	while cellCount &amp;lt; #dayStrings do -- Second day row onwards&lt;br /&gt;
		local otherDayRow = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		for i = 1, 7 do&lt;br /&gt;
			cellCount = cellCount + 1&lt;br /&gt;
			local dayString = dayStrings[cellCount]&lt;br /&gt;
			if not dayString then&lt;br /&gt;
				dayString = &amp;quot; &amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
			otherDayRow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:css{[&amp;#039;text-align&amp;#039;] = &amp;#039;center&amp;#039;}&lt;br /&gt;
				:wikitext(dayString)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Footer&lt;br /&gt;
	root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, &amp;#039;7&amp;#039;)&lt;br /&gt;
			:css{[&amp;#039;padding-top&amp;#039;] = &amp;#039;3px&amp;#039;, [&amp;#039;padding-bottom&amp;#039;] = &amp;#039;5px&amp;#039;, [&amp;#039;font-size&amp;#039;] = &amp;#039;78%&amp;#039;, [&amp;#039;text-align&amp;#039;] = &amp;#039;right&amp;#039;}&lt;br /&gt;
			:wikitext(&amp;#039;&amp;amp;nbsp;&amp;amp;nbsp; &amp;#039; .. makeWikilink(&amp;#039;Portal:Current events/&amp;#039; .. monthAndYear, &amp;#039;More &amp;#039; .. monthAndYear .. &amp;#039; events... &amp;amp;nbsp;&amp;amp;nbsp;&amp;#039;))&lt;br /&gt;
	&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Mr. Stradivarius</name></author>	</entry>

	</feed>