<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AYear_in_various_calendars%2Fdoc</id>
	<title>Module:Year in various calendars/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AYear_in_various_calendars%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Module:Year_in_various_calendars/doc&amp;action=history"/>
	<updated>2026-04-04T05:57:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.2</generator>
	<entry>
		<id>https://moasspedia.org/w/index.php?title=Module:Year_in_various_calendars/doc&amp;diff=3805&amp;oldid=prev</id>
		<title>Wikipedia&gt;Gonnym: /* See also */</title>
		<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Module:Year_in_various_calendars/doc&amp;diff=3805&amp;oldid=prev"/>
		<updated>2021-12-26T20:45:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;See also&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{module rating|beta}}&lt;br /&gt;
{{#invoke:Year in various calendars|main}}&lt;br /&gt;
{{Year in various calendars/doc|type=module}}&lt;br /&gt;
=== Adding new calendars ===&lt;br /&gt;
&lt;br /&gt;
The module is set up to allow for easy addition of new calendars. Just scroll down to the &amp;quot;Build the box&amp;quot; section of the module code, and add your calendar as follows:&lt;br /&gt;
&lt;br /&gt;
To display one year:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow: auto;&amp;quot;&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    local myCalendar = calendar:new()&lt;br /&gt;
    myCalendar:setLink( &amp;#039;My calendar article&amp;#039; ) -- The name of the calendar&amp;#039;s Wikipedia article.&lt;br /&gt;
    myCalendar:setYear( year + 10 ) -- Lua code linking the Gregorian calendar year to your calendar&amp;#039;s year.&lt;br /&gt;
    box:addCalendar( myCalendar )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To display a year range:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow: auto;&amp;quot;&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
    local myCalendar = calendar:new()&lt;br /&gt;
    myCalendar:setLink( &amp;#039;My calendar article&amp;#039; ) -- The name of the calendar&amp;#039;s Wikipedia article.&lt;br /&gt;
    myCalendar:setYearRange( year + 10, year + 11 ) -- Lua code outputting the start year and the end year of the year range.&lt;br /&gt;
    box:addCalendar( myCalendar )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More complicated calendars can be passed as a string to &amp;lt;code&amp;gt;calendar:setYear()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Technical details ===&lt;br /&gt;
&lt;br /&gt;
The module defines three [[class (programming)|classes]] which do the work of setting up the sidebar and displaying the data provided by the calendar functions. These are the &amp;lt;code&amp;gt;calendarBox&amp;lt;/code&amp;gt; class, which defines the sidebar; the &amp;lt;code&amp;gt;calendar&amp;lt;/code&amp;gt; class, which holds the data for one calendar; and the &amp;lt;code&amp;gt;calendarGroup&amp;lt;/code&amp;gt; object, which defines a group of calendar objects with a heading.&lt;br /&gt;
&lt;br /&gt;
To load these classes from another module, use the following:&lt;br /&gt;
&amp;lt;div style=&amp;quot;overflow: auto;&amp;quot;&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local yearInOtherCalendars = require( &amp;#039;Module:Year in various calendars&amp;#039; )&lt;br /&gt;
local calendarBox = yearInOtherCalendars.calendarBox&lt;br /&gt;
local calendarGroup = yearInOtherCalendars.calendarGroup&lt;br /&gt;
local calendar = yearInOtherCalendars.calendar&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== calendarBox class ====&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;calendarBox&amp;lt;/code&amp;gt; object is initiated with:&lt;br /&gt;
&lt;br /&gt;
{{pre|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;local myCalendarBox = calendarBox:new{ year = &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;yyyy&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;, footnotes = &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;footnotes&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;, navbar = &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;page name&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt; }&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
* &amp;lt;code&amp;gt;year&amp;lt;/code&amp;gt; - sets the Gregorian year to base calendar calculations on. If not specified, the current year is used.&lt;br /&gt;
* &amp;lt;code&amp;gt;footnotes&amp;lt;/code&amp;gt; - sets text to be displayed in a footnotes section at the bottom of the sidebar.&lt;br /&gt;
* &amp;lt;code&amp;gt;navbar&amp;lt;/code&amp;gt; - sets the page name to be used by the [[Template:Navbar|navbar]].&lt;br /&gt;
&lt;br /&gt;
Calendar box objects have the following properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox.year&amp;lt;/code&amp;gt; - the Gregorian year number. This is negative for BC years; for example, for the year 100 BC the value of calendarBox.year is &amp;lt;code&amp;gt;-99&amp;lt;/code&amp;gt;. (BC years are calculated by &amp;quot;1 - n&amp;quot; rather than &amp;quot;0 - n&amp;quot;, as there is no year zero.)&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox.yearText&amp;lt;/code&amp;gt; - the Gregorian year text. This is a string value of the format &amp;quot;n&amp;quot; for AD years and &amp;quot;n BC&amp;quot; for BC years.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox.caption&amp;lt;/code&amp;gt; - the text of the box caption (the bold text that appears directly above the box). The default caption is the value of &amp;lt;code&amp;gt;calendarBox.yearText&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox.footnotes&amp;lt;/code&amp;gt; - the text of the box footnotes.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox.navbar&amp;lt;/code&amp;gt; - the page name used by the navbar.&lt;br /&gt;
&lt;br /&gt;
Calendar box objects have the following methods:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox:setCaption( &amp;#039;&amp;#039;caption&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - sets the box caption (the bold text that appears directly above the box). The default caption is the value of &amp;lt;code&amp;gt;calendarBox.yearText&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox:addCalendar( &amp;#039;&amp;#039;obj&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - adds a calendar object or a calendar group object to the calendar box.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox:addCalendarGroup( &amp;#039;&amp;#039;obj&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - an alias for &amp;lt;code&amp;gt;myCalendarBox:addCalendar()&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarBox:export()&amp;lt;/code&amp;gt; - converts the calendar box object to wikicode. This calls &amp;lt;code&amp;gt;calendar:export()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;calendarGroup:export()&amp;lt;/code&amp;gt; to export calendar objects and calendar group objects.&lt;br /&gt;
&lt;br /&gt;
==== calendar class ====&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;calendar&amp;lt;/code&amp;gt; object is initiated with:&lt;br /&gt;
&lt;br /&gt;
{{pre|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;local myCalendar = calendar:new()&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Calendar objects have the following properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar.link&amp;lt;/code&amp;gt; - the link name.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar.year&amp;lt;/code&amp;gt; - the year value. This is always a string value.&lt;br /&gt;
&lt;br /&gt;
Calendar objects have the following methods:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setLink( &amp;#039;&amp;#039;link&amp;#039;&amp;#039;, &amp;#039;&amp;#039;display&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - sets the link name for the calendar object. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;link&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is the name of Wikipedia&amp;#039;s article about the calendar, and &amp;lt;code&amp;gt;&amp;#039;&amp;#039;display&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is an optional display name for the article link.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setRawLink( &amp;#039;&amp;#039;wikitext&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - sets the calendar link as raw wikitext.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:getLink()&amp;lt;/code&amp;gt; - gets the link value.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setYear( &amp;#039;&amp;#039;year&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - sets the year value for the calendar. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;year&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; can be a number or a string.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setYearRange( &amp;#039;&amp;#039;startYear&amp;#039;&amp;#039;, &amp;#039;&amp;#039;endYear&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - sets the year value for the calendar as a year range. Both &amp;lt;code&amp;gt;&amp;#039;&amp;#039;startYear&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;#039;&amp;#039;endYear&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; must be number values.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:export()&amp;lt;/code&amp;gt; - exports the calendar to wikitext. If no link value was found, this returns &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt;. If a link was found but no year value was found, the calendar is output with a value of &amp;lt;code&amp;gt;&amp;#039;&amp;#039;N/A&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; for the year.&lt;br /&gt;
&lt;br /&gt;
==== calendarGroup class ====&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;calendarGroup&amp;lt;/code&amp;gt; object is initiated with:&lt;br /&gt;
&lt;br /&gt;
{{pre|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;local myCalendarGroup = calendarGroup:new{ heading = &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;heading&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt; }&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
* &amp;lt;code&amp;gt;heading&amp;lt;/code&amp;gt; - the wikitext heading for the calendar group (e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[Hindu calendar]]s&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Calendar group objects have one property:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarGroup.heading&amp;lt;/code&amp;gt; - the calendar group heading text.&lt;br /&gt;
&lt;br /&gt;
Calendar group objects have the following methods:&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarGroup:addCalendar( &amp;#039;&amp;#039;obj&amp;#039;&amp;#039; )&amp;lt;/code&amp;gt; - adds a calendar object to the calendar group.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendarGroup:export()&amp;lt;/code&amp;gt; - converts a calendar group to wikitext. Calls &amp;lt;code&amp;gt;calendar:export()&amp;lt;/code&amp;gt; to export individual calendar objects.&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
{{tl|Year in various calendars}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
[[Category:Time, date and calendar modules]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Gonnym</name></author>
	</entry>
</feed>