Extension:Calendar-Wikivoyage

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Calendar-Wikivoyage

Release status:Extension status stable

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Creates a table showing the monthly calendar.
Author(s)Template:Extension#username Roland Unger
Latest versionTemplate:Extension#version 1.1
MediaWikiTemplate:Extension#mediawiki unknown
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the Calendar-Wikivoyage extension if it is available at translatewiki.net

Check usage and version matrix.

Calendar is an extension that creates a Calendar in pages. This extension was originally from the old Wikivoyage project.

Download[edit]

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/Calendar/ directory of your MediaWiki installation.

If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Calendar.git Calendar

Installation[edit]

  • Download and place the file(s) in a directory called Calendar-Wikivoyage in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Calendar-Wikivoyage' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

The Calendar extension implements the following functions:

  • calendar: Creates a table showing the monthly calendar.
  • Example for application:
{{#calendar: 
 | title= Table header. Instead of a missing title the month and year are shown.
 | prevLink= Text or link with the meaning of "previous". The text can contain place-holders.
 | nextLink= Text or link with the meaning of "next". The text can contain place-holders.
 | month= month to show. Possible values are 1 through 12. A missing month is substituted by the current month.
 | year= year to show. A missing year is substituted by the current year.
         Possible values are between 1970 and 2038.
 | offset= offset to the given month/year in months.
 | lang= Language of days and months names. Supported language codes are 'user' (user language) or
         'content' (content language; default).
 | highlightedDays= Highlighted days in addition to the current day. Values are separated by spaces.
 | start= first day of week. Possible values are 0 (Sundays) and 1 (Mondays).
 | position= defines additional floating. Possible values are (nothing), left, right and center
         (case insensitive)
 | 1= to 31= For every day a link can be specified
 | titleLink= Link to the title. The link can contain place-holders. Do not use link parentheses.
 | generalLinks= Identical links to all days. The links can contain place-holders. Do not use link parentheses.
         generalLinks is overwritten by the options 1= to 31=
 | dayCharsCount= maximum numbers of characters for weekday names 
 | monthCharsCount= maximum numbers of characters for month names
 | tableWidth= width of the table. 'none' means no definition, 'default' the default width of 20em
         You can also specify other CSS values like 50%, 300px or 30em.
 | showToday= specify the highlightings of the today's day. 'true' is default.
         'false' prevents highlighting
}}
  • Place-holders for links:
$a - abbreviated weekday name
$A - full weekday name
$b - abbreviated month name
$B - full month name
$d - day of the month, range 01 to 31
$D - day of the month, range 1 to 31
$e - day of the month, range ' 1' to '31'
$m - month as a decimal number, range 01 to 12
$M - next month as a decimal number, range 01 to 12
$n - abbreviated month name of the next month
$N - full month name of the next month
$o - year of the next month as a decimal number without a century, range 00 to 99
$O - year of the next month as a decimal number including the century
$p - abbreviated month name of the previous month
$P - full month name of the previous month
$q - year of the previous month as a decimal number without a century, range 00 to 99
$Q - year of the previous month as a decimal number including the century
$R - previous month as a decimal number, range 01 to 12
$y - year as a decimal number without a century, range 00 to 99
$Y - year as a decimal number including the century
$% - Dollar sign (use it if necessary)

Used style classes[edit]

{{#calendar:|position=Right|start=1|lang=user|highlightedDays=1 9 17}} In the Calendar directory you will find the file Calendar.css. It can be overwritten in Common.css or Monobook.css.

  • class="calendar" -- for the table as a whole
  • class="calLeft" -- left floating
  • class="calRight" -- right floating
  • class="prevNext" -- for previous and next links
  • class="calTitle" -- for the table header
  • class="sundays" -- highlighting for sundays
  • class="today" -- highlighting for the date of today
  • class="highlighted" -- additional highlighted dates

Known Problems[edit]

It is not possible to convert non-ASCII characters in month names to upper case characters. ucfirst() works only with ASCII characters but not with other Unicode characters.