Fandom Developers Wiki
(Adding the stylesheet)
Tag: Source edit
(Importing the entire documentation from Wikipedia, while replacing some templates we don't have with literals and removing irrelevant parts like Wikipedia categorization. Hopefully I got everything correctly)
Line 4: Line 4:
 
| Type = invocable
 
| Type = invocable
 
}}
 
}}
This module shows a calendar, with the months and days of the year. It can display a monthly or a yearly calendar with various formatting options. For more informartion, see the [[Wikipedia:Module:Calendar widget|module documentation on Wikipedia]].
+
This module shows a calendar, with the months and days of the year. It can display a monthly or a yearly calendar with various formatting options.
   
 
== Installation ==
 
== Installation ==
Line 11: Line 11:
 
| stylesheet = 1
 
| stylesheet = 1
 
}}
 
}}
  +
  +
==Parameters==
  +
===Calendar parameters===
  +
*<code>{{!}}year{{=}}</code> – specifies the year to be used when creating a monthly or yearly calendar; Gregorian calendar only; minimum 1583 for yearly calendar; minimum October 1582 for stand-alone month calendar; when omitted or out of range, uses current year
  +
*<code>{{!}}month{{=}}</code> – specifies the month to be used when creating an stand-alone month calendar in the year specified by <code>{{!}}year{{=}}</code>; accepts a variety values:
  +
*:numbers <code>1</code> to <code>12</code> – defaults to current month when month number is out of range
  +
*:month names (<code>January</code>, <code>March</code>, etc) – defaults to current month when month name is not recognized
  +
*:keywords:
  +
*::<code>current</code> – display the current month
  +
*::<code>last</code> – display the month that occurs before the current month
  +
*::<code>next</code> – display the month that occurs after the current month
  +
*<code>{{!}}cols{{=}}</code> – yearly calendars only; number of columns <code><var>n</var></code> to be used for calendar rendering; default is <code>4</code>; values of <code><var>n</var></code> less than 1 or greater than 12 ignored
  +
*<code>{{!}}iso{{=}}</code> – accepts the single value <code>yes</code>; calendar renders in [[ISO week]] format (Monday through Sunday); not needed if <code>{{!}}iso_wk{{=}}</code> set
  +
*<code>{{!}}iso_wk{{=}}</code> – accepts the single value <code>yes</code>; calendar renders in [[ISO week]] format (Monday through Sunday) with ISO week number in the left column; setting <code>{{!}}iso_wk{{=}}yes</code> automatically sets <code>{{!}}iso{{=}}yes</code>
  +
  +
===Styling parameters===
  +
*<code>{{!}}float{{=}}</code> – position the rendered calendar; default position is at the left page margin:
  +
*:<code>center</code> – middle of the page
  +
*:<code>right</code> – at the right page margin
  +
*<code>{{!}}hide_year{{=}}</code> – accepts the single value <code>yes</code>; suppresses display of year in calendar headers; alias <code>{{!}}show_year{{=}}off</code>
  +
*<code>{{!}}show_today{{=}}</code> – accepts the single value <code>yes</code>; highlights the current date in the current-month calendar
  +
*<code>{{!}}today_color{{=}}</code> – set the highlight color used by <code>{{!}}show-today{{=}}</code>; alias: <code>{{!}}today_colour{{=}}</code>
  +
*<code>{{!}}title_color{{=}}</code> – set background color for the month title bar; overrides <code>{{!}}color{{=}}</code>; alias: <code>{{!}}title_colour{{=}}</code>
  +
*<code>{{!}}week_color{{=}}</code> – set background color for the day-abbreviations title bar; overrides <code>{{!}}color{{=}}</code>; alias: <code>{{!}}week_colour{{=}}</code>
  +
*<code>{{!}}color{{=}}</code> – shorthand for both <code>{{!}}title_color{{=}}</code> and <code>{{!}}week_color{{=}}</code>; <code>{{!}}color{{=}}</code> yields to <code>{{!}}title_color{{=}}</code> and <code>{{!}}week_color{{=}}</code>; alias: <code>{{!}}colour{{=}}</code>
  +
*<code>{{!}}wknum_color{{=}}</code> – set background color for ISO week numbers; alias: <code>{{!}}wknum_colour{{=}}</code>
  +
  +
===Linking parameters===
  +
*<code>{{!}}lk{{=}}</code> – various date component linking options:
  +
*:<code>d</code> – link days in calendar to calendar day of calendar month – <code><nowiki>[[</nowiki>{{CURRENTMONTHNAME}} {{CURRENTDAY}}]]</code>
  +
*:<code>m</code> – link month in calendar header to month article – <code><nowiki>[[</nowiki>{{CURRENTMONTHNAME}}]] 2019</code>
  +
*:<code>y</code> – link year in calendar header to year article – <code>{{CURRENTMONTHNAME}} <nowiki>[[</nowiki>{{CURRENTYEAR}}]]</code>
  +
*:<code>dm</code> – link to days and month
  +
*:<code>dy</code> – link to days and year
  +
*:<code>my</code> – link to month and year
  +
*:<code>yes</code> – individually link all date components
  +
*:<code>m&y</code> – stand-alone month calendars only; link month and year together as a single composite link – <code><nowiki>[[</nowiki>{{CURRENTMONTHNAME}} {{CURRENTYEAR}}]]</code>
  +
*:<code>dm&y</code> – stand-alone month calendars only; link to days and composite month/year
  +
  +
====Link prefixes and suffixes====
  +
These parameters require <code>{{!}}lk{{=}}</code>:
  +
*<code>{{!}}lk_pref{{=}}</code> – prefix for all day, month, and year links enabled by <code>{{!}}lk{{=}}</code>; yields to specific <code>{{!}}lk_pref_<var>x</var>{{=}}</code> parameters
  +
*<code>{{!}}lk_suff{{=}}</code> – suffix for all day, month, and year links enabled by <code>{{!}}lk{{=}}</code>; yields to specific <code>{{!}}lk_suff_<var>x</var>{{=}}</code> parameters
  +
These parameters automatically set <code>{{!}}lk{{=}}</code> to the appropriate value; override values assigned to <code>{{!}}lk_pref{{=}}</code> and <code>{{!}}lk_suff{{=}}</code>:
  +
*<code>{{!}}lk_pref_d{{=}}</code> – prefix for day links
  +
*<code>{{!}}lk_pref_m{{=}}</code> – prefix for month and composite month/year links
  +
*<code>{{!}}lk_pref_y{{=}}</code> – prefix for year links
  +
*<code>{{!}}lk_suff_d{{=}}</code> – suffix for day links
  +
*<code>{{!}}lk_suff_m{{=}}</code> – suffix for month links and composite month/year links
  +
*<code>{{!}}lk_suff_y{{=}}</code> – suffix for year links
  +
For stand-alone month calendars only, links to previous- and next-month targets:
  +
*<code>{{!}}prevnext{{=}}</code> – accepts the single value <code>yes</code>; adds generic << and >> links to month header linked to the preceding and next month articles; automatically set if any of the following parameters are set:
  +
**<code>{{!}}lk_pref_mprev{{=}}</code> – prefix for previous-month link
  +
**<code>{{!}}lk_suff_mprev{{=}}</code> – suffix for previous-month link
  +
**<code>{{!}}lk_pref_mnext{{=}}</code> – prefix for next-month link
  +
**<code>{{!}}lk_suff_mnext{{=}}</code> – suffix for next-month link
  +
  +
=====Examples=====
  +
if the current page and section is <code><nowiki>[[An example page#May]]</nowiki></code> and there is a May calendar there, to offer links to the previous month (April) and next month (June) sections set:
  +
:<code>{{!}}k_pref_mprev{{=}}#</code> – creates link to <code><nowiki>[[An example page#April]]</nowiki></code>
  +
:<code>{{!}}k_pref_mnext{{=}}#</code> – creates link to <code><nowiki>[[An example page#June]]</nowiki></code>
  +
if the current page is a subpage <code><nowiki>[[An example page/May]]</nowiki></code> and there is a May calendar there, to offer links to the previous month and next month subpages set:
  +
:<code>{{!}}k_pref_mprev{{=}}../</code> – creates link to <code><nowiki>[[An example page/April]]</nowiki></code>
  +
:<code>{{!}}k_pref_mnext{{=}}../</code> – creates link to <code><nowiki>[[An example page/June]]</nowiki></code>
  +
::in <code>../</code>, <code>..</code> is the parent (<code><nowiki>[[An example page]]</nowiki></code>) and <code>/</code> is the required path separator; see [[Uniform Resource Identifier]]
  +
  +
== See also ==
  +
* [[Wikipedia:Module:Calendar widget|Original module documentation on Wikipedia]].

Revision as of 12:49, 16 January 2022

This module shows a calendar, with the months and days of the year. It can display a monthly or a yearly calendar with various formatting options.

Installation

Lua installation

CSS installation

Parameters

Calendar parameters

  • |year= – specifies the year to be used when creating a monthly or yearly calendar; Gregorian calendar only; minimum 1583 for yearly calendar; minimum October 1582 for stand-alone month calendar; when omitted or out of range, uses current year
  • |month= – specifies the month to be used when creating an stand-alone month calendar in the year specified by |year=; accepts a variety values:
    numbers 1 to 12 – defaults to current month when month number is out of range
    month names (January, March, etc) – defaults to current month when month name is not recognized
    keywords:
    current – display the current month
    last – display the month that occurs before the current month
    next – display the month that occurs after the current month
  • |cols= – yearly calendars only; number of columns n to be used for calendar rendering; default is 4; values of n less than 1 or greater than 12 ignored
  • |iso= – accepts the single value yes; calendar renders in ISO week format (Monday through Sunday); not needed if |iso_wk= set
  • |iso_wk= – accepts the single value yes; calendar renders in ISO week format (Monday through Sunday) with ISO week number in the left column; setting |iso_wk=yes automatically sets |iso=yes

Styling parameters

  • |float= – position the rendered calendar; default position is at the left page margin:
    center – middle of the page
    right – at the right page margin
  • |hide_year= – accepts the single value yes; suppresses display of year in calendar headers; alias |show_year=off
  • |show_today= – accepts the single value yes; highlights the current date in the current-month calendar
  • |today_color= – set the highlight color used by |show-today=; alias: |today_colour=
  • |title_color= – set background color for the month title bar; overrides |color=; alias: |title_colour=
  • |week_color= – set background color for the day-abbreviations title bar; overrides |color=; alias: |week_colour=
  • |color= – shorthand for both |title_color= and |week_color=; |color= yields to |title_color= and |week_color=; alias: |colour=
  • |wknum_color= – set background color for ISO week numbers; alias: |wknum_colour=

Linking parameters

  • |lk= – various date component linking options:
    d – link days in calendar to calendar day of calendar month – [[April 19]]
    m – link month in calendar header to month article – [[April]] 2019
    y – link year in calendar header to year article – April [[2024]]
    dm – link to days and month
    dy – link to days and year
    my – link to month and year
    yes – individually link all date components
    m&y – stand-alone month calendars only; link month and year together as a single composite link – [[April 2024]]
    dm&y – stand-alone month calendars only; link to days and composite month/year

Link prefixes and suffixes

These parameters require |lk=:

  • |lk_pref= – prefix for all day, month, and year links enabled by |lk=; yields to specific |lk_pref_x= parameters
  • |lk_suff= – suffix for all day, month, and year links enabled by |lk=; yields to specific |lk_suff_x= parameters

These parameters automatically set |lk= to the appropriate value; override values assigned to |lk_pref= and |lk_suff=:

  • |lk_pref_d= – prefix for day links
  • |lk_pref_m= – prefix for month and composite month/year links
  • |lk_pref_y= – prefix for year links
  • |lk_suff_d= – suffix for day links
  • |lk_suff_m= – suffix for month links and composite month/year links
  • |lk_suff_y= – suffix for year links

For stand-alone month calendars only, links to previous- and next-month targets:

  • |prevnext= – accepts the single value yes; adds generic << and >> links to month header linked to the preceding and next month articles; automatically set if any of the following parameters are set:
    • |lk_pref_mprev= – prefix for previous-month link
    • |lk_suff_mprev= – suffix for previous-month link
    • |lk_pref_mnext= – prefix for next-month link
    • |lk_suff_mnext= – suffix for next-month link
Examples

if the current page and section is [[An example page#May]] and there is a May calendar there, to offer links to the previous month (April) and next month (June) sections set:

|k_pref_mprev=# – creates link to [[An example page#April]]
|k_pref_mnext=# – creates link to [[An example page#June]]

if the current page is a subpage [[An example page/May]] and there is a May calendar there, to offer links to the previous month and next month subpages set:

|k_pref_mprev=../ – creates link to [[An example page/April]]
|k_pref_mnext=../ – creates link to [[An example page/June]]
in ../, .. is the parent ([[An example page]]) and / is the required path separator; see Uniform Resource Identifier

See also