Module:Year in various calendars/doc explained
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:
local myCalendar = calendar:new myCalendar:setLink('My calendar article') -- The name of the calendar's Wikipedia article. myCalendar:setYear(year + 10) -- Lua code linking the Gregorian calendar year to your calendar's year. box:addCalendar(myCalendar)
To display a year range:
local myCalendar = calendar:new myCalendar:setLink('My calendar article') -- The name of the calendar's Wikipedia article. myCalendar:setYearRange(year + 10, year + 11) -- Lua code outputting the start year and the end year of the year range. box:addCalendar(myCalendar)
More complicated calendars can be passed as a string to calendar:setYear
.
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 calendarBox
class, which defines the sidebar; the calendar
class, which holds the data for one calendar; and the calendarGroup
object, which defines a group of calendar objects with a heading.
To load these classes from another module, use the following:
local yearInOtherCalendars = require('Module:Year in various calendars')local calendarBox = yearInOtherCalendars.calendarBoxlocal calendarGroup = yearInOtherCalendars.calendarGrouplocal calendar = yearInOtherCalendars.calendar
calendarBox class
A calendarBox
object is initiated with: