Module:Year in various calendars/doc
![]() | This is a documentation subpage for Module:Year in various calendars. It may contain usage information, categories and other content that is not part of the original module page. |
Script error: No such module "Year in other calendars".
This module produces the sidebar opposite displaying a given Gregorian year in various different calendars.
Syntax
Simple
{{#invoke:Year in various calendars|main}}
All parameters
{{#invoke:Year in various calendars|main |year=(n) |footnotes=(footnotes) |gregcal=(article name)}}
Parameters
- year
- Number specifying the year to be displayed. This can be negative and also can be in the format "n BC" to display BC dates or "AD n" as an alternative to a positive number. If not specified, the current year is used.
- footnotes
- Any footnotes to be placed at the bottom of the sidebar.
- gregcal
- Name of an article to be displayed for Gregorian and Julian years (e.g. "2000 BC"). Do not include square brackets.
Microformat
The HTML mark-up produced by this template includes an hCalendar microformat that makes event/date details readily parsable by computer programs. This aids tasks such as the cataloguing of articles and maintenance of databases. For more information about the use of microformats on Wikipedia, please visit the Microformat WikiProject.
- Classes used
The HTML classes of this microformat include:
- attendee
- description
- dtend
- dtstart
- location
- summary
- url
- vevent
nor collapse nested elements which use them.
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:
local myCalendar = calendar:new()
myCalendar:setLink( 'My calendar article' ) -- the name of the calendar's Wikipedia article
myCalendar:setYearFunction(
function( year )
-- Lua code linking the Gregorian calendar year to your calendar's year.
end
)
box:addCalendar( myCalendar )
If you want to display just one year, then the Lua code should return one number value. If you want to display a year range, then the Lua code should return two number values. More complicated calendars can be displayed as text.
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.
calendarBox class
The calendarBox
class is initiated with:
local myCalendarBox = calendarBox:new( init )
The init
parameter is a table which can have the following fields:
init.year
- sets the Gregorian year to base calendar calculations on. If not specified, the current year is used.init.footnotes
- sets text to be displayed in a footnotes section at the bottom of the sidebar.init.navbar
- sets the page name to be used by the navbar.