<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/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://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AYear_in_various_calendars%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Year_in_various_calendars/doc&amp;action=history"/>
	<updated>2026-06-15T13:34:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Year_in_various_calendars/doc&amp;diff=480101&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Year_in_various_calendars/doc&amp;diff=480101&amp;oldid=prev"/>
		<updated>2021-07-16T08:01:57Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&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( 'My calendar article' ) -- The name of the calendar's Wikipedia article.&lt;br /&gt;
    myCalendar:setYear( year + 10 ) -- Lua code linking the Gregorian calendar year to your calendar'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( 'My calendar article' ) -- The name of the calendar'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( 'Module:Year in various calendars' )&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;''yyyy''&amp;lt;nowiki&amp;gt;, footnotes = &amp;lt;/nowiki&amp;gt;''footnotes''&amp;lt;nowiki&amp;gt;, navbar = &amp;lt;/nowiki&amp;gt;''page name''&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( ''caption'' )&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( ''obj'' )&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( ''obj'' )&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( ''link'', ''display'' )&amp;lt;/code&amp;gt; - sets the link name for the calendar object. &amp;lt;code&amp;gt;''link''&amp;lt;/code&amp;gt; is the name of Wikipedia's article about the calendar, and &amp;lt;code&amp;gt;''display''&amp;lt;/code&amp;gt; is an optional display name for the article link.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setRawLink( ''wikitext'' )&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( ''year'' )&amp;lt;/code&amp;gt; - sets the year value for the calendar. &amp;lt;code&amp;gt;''year''&amp;lt;/code&amp;gt; can be a number or a string.&lt;br /&gt;
* &amp;lt;code&amp;gt;calendar:setYearRange( ''startYear'', ''endYear'' )&amp;lt;/code&amp;gt; - sets the year value for the calendar as a year range. Both &amp;lt;code&amp;gt;''startYear''&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;''endYear''&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;''N/A''&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;''heading''&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( ''obj'' )&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;
&lt;br /&gt;
{{tl|Year in various calendars}}&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>