Module:Year in various calendars/doc

Adding new calendars
The module is set up to allow for easy addition of new calendars. Just scroll down to the "Build the box" section of the module code, and add your calendar as follows:

To display one year:

To display a year range:

More complicated calendars can be passed as a string to.

Technical details
The module defines three classes which do the work of setting up the sidebar and displaying the data provided by the calendar functions. These are the  class, which defines the sidebar; the   class, which holds the data for one calendar; and the   object, which defines a group of calendar objects with a heading.

To load these classes from another module, use the following:

calendarBox class
A  object is initiated with:


 * - sets the Gregorian year to base calendar calculations on. If not specified, the current year is used.
 * - sets text to be displayed in a footnotes section at the bottom of the sidebar.
 * - sets the page name to be used by the navbar.

Calendar box objects have the following properties:
 * - the Gregorian year number. This is negative for BC years; for example, for the year 100 BC the value of calendarBox.year is . (BC years are calculated by "1 - n" rather than "0 - n", as there is no year zero.)
 * - the Gregorian year text. This is a string value of the format "n" for AD years and "n BC" for BC years.
 * - the text of the box caption (the bold text that appears directly above the box). The default caption is the value of.
 * - the text of the box footnotes.
 * - the page name used by the navbar.

Calendar box objects have the following methods:
 * - sets the box caption (the bold text that appears directly above the box). The default caption is the value of.
 * - adds a calendar object or a calendar group object to the calendar box.
 * - an alias for.
 * - converts the calendar box object to wikicode. This calls  and   to export calendar objects and calendar group objects.

calendar class
A  object is initiated with:

Calendar objects have the following properties:
 * - the link name.
 * - the year value. This is always a string value.

Calendar objects have the following methods:
 * - sets the link name for the calendar object.  is the name of Wikipedia's article about the calendar, and   is an optional display name for the article link.
 * - sets the calendar link as raw wikitext.
 * - gets the link value.
 * - sets the year value for the calendar.  can be a number or a string.
 * - sets the year value for the calendar as a year range. Both  and   must be number values.
 * - exports the calendar to wikitext. If no link value was found, this returns . If a link was found but no year value was found, the calendar is output with a value of   for the year.

calendarGroup class
A  object is initiated with:


 * - the wikitext heading for the calendar group (e.g. ).

Calendar group objects have one property:
 * - the calendar group heading text.

Calendar group objects have the following methods:
 * - adds a calendar object to the calendar group.
 * - converts a calendar group to wikitext. Calls  to export individual calendar objects.