<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AOne_page_calendar</id>
	<title>Module:One page calendar - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AOne_page_calendar"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:One_page_calendar&amp;action=history"/>
	<updated>2026-07-28T14:43:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:One_page_calendar&amp;diff=144176&amp;oldid=prev</id>
		<title>imported&gt;Pigsonthewing: Pigsonthewing moved page Module:Sandbox/trappist the monk/calendar to Module:One page calendar without leaving a redirect: Publish; many thanks to User:Trappist the monk</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:One_page_calendar&amp;diff=144176&amp;oldid=prev"/>
		<updated>2022-11-11T15:48:04Z</updated>

		<summary type="html">&lt;p&gt;Pigsonthewing moved page &lt;a href=&quot;/index.php?title=Module:Sandbox/trappist_the_monk/calendar&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Sandbox/trappist the monk/calendar (page does not exist)&quot;&gt;Module:Sandbox/trappist the monk/calendar&lt;/a&gt; to &lt;a href=&quot;/research/Module:One_page_calendar&quot; title=&quot;Module:One page calendar&quot;&gt;Module:One page calendar&lt;/a&gt; without leaving a redirect: Publish; many thanks to &lt;a href=&quot;/index.php?title=User:Trappist_the_monk&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Trappist the monk (page does not exist)&quot;&gt;User:Trappist the monk&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require (&amp;#039;strict&amp;#039;);&lt;br /&gt;
local getArgs = require (&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
&lt;br /&gt;
																				-- sequence to hold abbreviated month names where first-of-month is on day&lt;br /&gt;
local first_day_t = {															-- lang_object:formatDate (&amp;#039;L&amp;#039;, &amp;#039;YYYY-01-01&amp;#039;) + 1 returns 1 (Sunday) to 7 (Saturday)&lt;br /&gt;
	{},																			-- table of months that begin on sunday&lt;br /&gt;
	{},																			-- table of months that begin on monday&lt;br /&gt;
	{},																			-- tuesday&lt;br /&gt;
	{},																			-- wednesday&lt;br /&gt;
	{},																			-- thursday&lt;br /&gt;
	{},																			-- friday&lt;br /&gt;
	{},																			-- saturday&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local subheader_rows_t = {														-- will get abbreviated month names for each of the days of the week&lt;br /&gt;
	{},																			-- these are the first three &amp;#039;subheader&amp;#039; rows at the top of the wikitable; top&lt;br /&gt;
	{},																			-- middle&lt;br /&gt;
	{},																			-- bottom&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local week_day_names_t = {														-- for i18n though Help:Extension:ParserFunctions##time says day names rarely internationalized&lt;br /&gt;
	[&amp;#039;sun_t&amp;#039;] = {},																-- holds calculated weekday names: [1]=&amp;lt;abbreviated&amp;gt;, [2]=&amp;lt;long&amp;gt;, [3]=&amp;lt;abbr title=&amp;quot;&amp;lt;long&amp;gt;&amp;quot;&amp;gt;&amp;lt;addreviated&amp;gt;&amp;lt;/abbr&amp;gt;&lt;br /&gt;
	[&amp;#039;mon_t&amp;#039;] = {},																-- if your MediaWiki does not have weekday names for your language, these tables can be filled manually&lt;br /&gt;
	[&amp;#039;tue_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;wed_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;thu_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;fri_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;sat_t&amp;#039;] = {},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local row_format_str = &amp;#039;|| %s || %s || %s || %s || %s || %s || %s &amp;#039;;			-- format string for the three subheader rows&lt;br /&gt;
&lt;br /&gt;
local weekday_rows_fmt_t = {													-- format strings for weekday wikitable rows&lt;br /&gt;
	&amp;#039;| 1 ||  8 || 15 || 22 || 29 || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 2 ||  9 || 16 || 23 || 30 || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 3 || 10 || 17 || 24 || 31 || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 4 || 11 || 18 || 25 ||    || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 5 || 12 || 19 || 26 ||    || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 6 || 13 || 20 || 27 ||    || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	&amp;#039;| 7 || 14 || 21 || 28 ||    || %s || %s || %s || %s || %s || %s || %s&amp;#039;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local caption_fmt = &amp;#039;Calendar for year with 1 %s on a %s&amp;#039;;						-- first %s is &amp;#039;January&amp;#039; in local language; second %s is day name in local language&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A I N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
	{{#invoke:Sandbox/trappist the monk/calendar|main|year=}}&lt;br /&gt;
supported parameters are:&lt;br /&gt;
	|year=			the year for which this calendar is rendered; defaults to current year&lt;br /&gt;
	|lang-tag=		language in which this calendar is rendered;  defaults to wiki&amp;#039;s own language&lt;br /&gt;
	|table-style=	css style string suitable for use in an html style=&amp;quot;&amp;quot; attribute; no quotes; defaults to empty string&lt;br /&gt;
	|caption=		a caption that replaces the default caption&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function main (frame)&lt;br /&gt;
	local args_t = getArgs (frame);&lt;br /&gt;
	args_t[&amp;#039;table-style&amp;#039;] = (args_t[&amp;#039;table-style&amp;#039;] and &amp;#039; style=&amp;quot;&amp;#039; .. args_t[&amp;#039;table-style&amp;#039;] .. &amp;#039;&amp;quot;&amp;#039;) or &amp;#039;&amp;#039;;	-- if not set, empty string for concatenation; applies to whole table&lt;br /&gt;
&lt;br /&gt;
	local lang_object;&lt;br /&gt;
	&lt;br /&gt;
	if args_t[&amp;#039;lang-tag&amp;#039;] then&lt;br /&gt;
		lang_object = mw.language.new (args_t[&amp;#039;lang-tag&amp;#039;]);						-- get a language object for the language specified by |lang-tag=&lt;br /&gt;
	else&lt;br /&gt;
		lang_object = mw.language.getContentLanguage();							-- get a language object for the local wiki language&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if not week_day_names_t.sun_t[1] then										-- if empty auto fill; otherwise assume that tables have been filled manually at a local wiki&lt;br /&gt;
		for i, day in ipairs ({&amp;#039;sun_t&amp;#039;, &amp;#039;mon_t&amp;#039;, &amp;#039;tue_t&amp;#039;, &amp;#039;wed_t&amp;#039;, &amp;#039;thu_t&amp;#039;, &amp;#039;fri_t&amp;#039;, &amp;#039;sat_t&amp;#039;}) do	-- sequence values are used as indexes into week_day_names_t&lt;br /&gt;
			local long = lang_object:formatDate (&amp;#039;l&amp;#039;, &amp;#039;2022-05-0&amp;#039; .. i);		-- 2022-05-01 is known to be a Sunday; calculate day names for the rest of the week&lt;br /&gt;
			local abbreviated = lang_object:formatDate (&amp;#039;D&amp;#039;, &amp;#039;2022-05-0&amp;#039; .. i);	-- 2022-05-01 is known to be a Sun; calculate abbreviated day names for the rest of the week&lt;br /&gt;
		&lt;br /&gt;
			week_day_names_t[day][1] = abbreviated;								-- abbreviated day names: Sun, Mon, etc in local wiki language&lt;br /&gt;
			week_day_names_t[day][2] = long;									-- full day names: Sunday, Monday, etc in local wiki language&lt;br /&gt;
			week_day_names_t[day][3] = table.concat ({&amp;#039;&amp;lt;abbr title=&amp;quot;&amp;#039;, long, &amp;#039;&amp;quot;&amp;gt;&amp;#039;, abbreviated, &amp;#039;&amp;lt;/abbr&amp;gt;&amp;#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local year = (args_t.year and args_t.year) or lang_object:formatDate (&amp;#039;Y&amp;#039;);	-- get year from |year=; current year else	TODO: get year from article title?&lt;br /&gt;
	local jan_1_day = lang_object:formatDate (&amp;#039;l&amp;#039;, year .. &amp;#039;-01-01&amp;#039;);			-- get day name for day on which 1 January &amp;lt;year&amp;gt; occurs; for day name in table caption&lt;br /&gt;
	local jan_1_mon = lang_object:formatDate (&amp;#039;F&amp;#039;, year .. &amp;#039;-01-01&amp;#039;);			-- i18n: get month name for &amp;lt;year&amp;gt;-01-01; for month name in table caption&lt;br /&gt;
&lt;br /&gt;
	for m=1, 12 do&lt;br /&gt;
		local month_abbr = lang_object:formatDate (&amp;#039;M&amp;#039;, year .. &amp;#039;-&amp;#039; .. m);		-- get abbreviated month name&lt;br /&gt;
		local day_number = lang_object:formatDate (&amp;#039;w&amp;#039;, year .. &amp;#039;-&amp;#039; .. m .. &amp;#039;-01&amp;#039;) + 1;	-- returns a value 0-6; +1 offset makes 1-7 to index into first_day_t lua sequence&lt;br /&gt;
		table.insert (first_day_t[day_number], month_abbr);						-- add abbreviated month name to appropriate day number sequence&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for row=1, 3 do																-- for each of the three &amp;#039;month&amp;#039; subheader rows&lt;br /&gt;
		for day=1, 7 do															-- and for each day of the week in that row&lt;br /&gt;
			if first_day_t[day][row] then										-- if first of the month occurs on &amp;lt;day&amp;gt;&lt;br /&gt;
				table.insert (subheader_rows_t[row], first_day_t[day][row]);	-- insert abreviated month name&lt;br /&gt;
			else&lt;br /&gt;
				table.insert (subheader_rows_t[row], &amp;#039;&amp;#039;);						-- insert empty string else&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local out_t = {};															-- components of the output go here&lt;br /&gt;
&lt;br /&gt;
	local caption = (args_t.caption and args_t.caption) or string.format (caption_fmt, jan_1_mon, jan_1_day);&lt;br /&gt;
	table.insert (out_t, &amp;#039;{| class=&amp;quot;wikitable&amp;quot;&amp;#039; .. args_t[&amp;#039;table-style&amp;#039;] .. &amp;#039;\n|+ &amp;#039; .. caption);	-- open wikitable&lt;br /&gt;
	table.insert (out_t, table.concat ({&amp;#039;! colspan=&amp;quot;12&amp;quot; | &amp;#039;, year}));			-- common column header holds year value from |year= or current year&lt;br /&gt;
&lt;br /&gt;
	for i, row_t in ipairs (subheader_rows_t) do								-- for each of the three &amp;#039;month&amp;#039; subheader rows&lt;br /&gt;
		if 1 == i then															-- first of these rows has rowspan and colspan styling&lt;br /&gt;
			table.insert (out_t, string.format (&amp;#039;| colspan=&amp;quot;5&amp;quot; rowspan=&amp;quot;3&amp;quot; |Date &amp;#039; .. row_format_str, row_t[1], row_t[2], row_t[3], row_t[4], row_t[5], row_t[6], row_t[7]));&lt;br /&gt;
		else																	-- the others have no styling&lt;br /&gt;
			table.insert (out_t, string.format (row_format_str, row_t[1], row_t[2], row_t[3], row_t[4], row_t[5], row_t[6], row_t[7]));&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- append static day numbers and weekday rows&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[1],&lt;br /&gt;
		week_day_names_t.sun_t[3], week_day_names_t.mon_t[3], week_day_names_t.tue_t[3], week_day_names_t.wed_t[3], week_day_names_t.thu_t[3], week_day_names_t.fri_t[3], week_day_names_t.sat_t[3]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[2],&lt;br /&gt;
		week_day_names_t.mon_t[3], week_day_names_t.tue_t[1], week_day_names_t.wed_t[1], week_day_names_t.thu_t[1], week_day_names_t.fri_t[1], week_day_names_t.sat_t[1], week_day_names_t.sun_t[1]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[3],&lt;br /&gt;
		week_day_names_t.tue_t[3], week_day_names_t.wed_t[1], week_day_names_t.thu_t[1], week_day_names_t.fri_t[1], week_day_names_t.sat_t[1], week_day_names_t.sun_t[1], week_day_names_t.mon_t[1]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[4],&lt;br /&gt;
		week_day_names_t.wed_t[3], week_day_names_t.thu_t[1], week_day_names_t.fri_t[1], week_day_names_t.sat_t[1], week_day_names_t.sun_t[1], week_day_names_t.mon_t[1], week_day_names_t.tue_t[1]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[5],&lt;br /&gt;
		week_day_names_t.thu_t[3], week_day_names_t.fri_t[1], week_day_names_t.sat_t[1], week_day_names_t.sun_t[1], week_day_names_t.mon_t[1], week_day_names_t.tue_t[1], week_day_names_t.wed_t[1]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[6],&lt;br /&gt;
		week_day_names_t.fri_t[3], week_day_names_t.sat_t[1], week_day_names_t.sun_t[1], week_day_names_t.mon_t[1], week_day_names_t.tue_t[1], week_day_names_t.wed_t[1], week_day_names_t.thu_t[1]));&lt;br /&gt;
	table.insert (out_t, string.format (weekday_rows_fmt_t[7],&lt;br /&gt;
		week_day_names_t.sat_t[3], week_day_names_t.sun_t[1], week_day_names_t.mon_t[1], week_day_names_t.tue_t[1], week_day_names_t.wed_t[1], week_day_names_t.thu_t[1], week_day_names_t.fri_t[1]));&lt;br /&gt;
&lt;br /&gt;
	table.insert (out_t, &amp;#039;|}&amp;#039;);													-- close wikitable&lt;br /&gt;
	&lt;br /&gt;
	return table.concat (out_t, &amp;#039;\n|-\n&amp;#039;);										-- make a big string and done&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T S &amp;gt;----------------------------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return	{&lt;br /&gt;
	main = main&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>imported&gt;Pigsonthewing</name></author>
	</entry>
</feed>