Template:Calendar/event: Difference between revisions

From OpenStreetMap Wiki
Jump to navigation Jump to search
(Switched from Template:Dm to Template:Event date for better performance and correct CJK formats)
(Delinked country names, which are redundant and expensive to conditionally link)
Line 33: Line 33:
}}
}}
}}{{#if: {{{country|<noinclude>British Antarctic Territory</noinclude>}}}
}}{{#if: {{{country|<noinclude>British Antarctic Territory</noinclude>}}}
| , {{#ifexist: {{{countrylink|{{{country<noinclude>|Antarctica</noinclude>}}}}}}
| , {{{country<noinclude>|Antarctica</noinclude>}}}
| [[{{{countrylink|{{{country<noinclude>|Antarctica</noinclude>}}}}}}|{{{country<noinclude>|Antarctica</noinclude>}}}]]
| {{{country<noinclude>|Antarctica</noinclude>}}}
}}
}}</span>
}}</span>
<noinclude>
<noinclude>
Line 135: Line 132:
"countrylink": {
"countrylink": {
"label": "Country page name",
"label": "Country page name",
"description": "Name of the host country’s WikiProject page, if it differs from the country’s name",
"description": "Name of the host country’s WikiProject page, if it differs from the country’s name (currently unused)",
"example": "WikiProject Georgia Abkhazia South-Ossetia",
"example": "WikiProject Georgia Abkhazia South-Ossetia",
"type": "wiki-page-name"
"type": "wiki-page-name"

Revision as of 10:07, 28 November 2019

Mapping party 27–30 Nov2024-11-272024-12-01
State of the Wiki
State of the Wiki [1], international wiki-fiddler convention, South Pole, British Antarctic Territory, Antarctica
[Edit] [Purge] Template-info.svg Template documentation

This template inserts a table row into {{Calendar}} containing basic information about an event.

Usage

Add this template to {{Calendar}}. Do not surround it with HTML or wikitext table syntax.

Basic usage:

{{Calendar/event
| type = <!-- see [[Template:Cal]] for valid values -->
| date = <!-- for single-day events; see [[w:mw:Help:Extension:ParserFunctions##time]] for valid formats -->
| name = 
| link = 
| url = 
| city = 
| region = 
| country = 
}}

Full usage including optional parameters:

{{Calendar/event
| type = <!-- see [[Template:Cal]] for valid values -->
| date = <!-- for single-day events; see [[w:mw:Help:Extension:ParserFunctions##time]] for valid formats -->
| start = <!-- for multiday events; see [[w:mw:Help:Extension:ParserFunctions##time]] for valid formats -->
| end = <!-- for multiday events; see [[w:mw:Help:Extension:ParserFunctions##time]] for valid formats -->
| major = <!-- yes -->
| name = 
| link = 
| url = 
| logo = 
| description = 
| city = 
| citylink = 
| region = 
| regionlink = 
| country = 
| countrylink = 
| countryemblem = 
}}

Notes:

  • Only |type = and |name = are required, but |country = and either |link = or |url = are recommended.
  • Multi-day events should be relatively short. {{Dm}} doesn't support events that last more than a year, and especially long events would monopolize the top of the calendar. For long events lasting more than a week, consider breaking it up into events for the opening and closing days.
  • Use the |major = and |logo = options sparingly. State of the Map and its spinoffs are examples of major conferences.
  • Avoid using link shorteners for the |url = parameter. The calendar may appear in e-mails; recipients may hesitate to click on a link that obscures its destination.
  • The template guesses wiki pages based on |city = and |region =. If a wiki page about a different place happens to match the specified city or region's name, use |citylink = or |regionlink = to disambiguate.
  • The template guesses a flag based on |country =. In the case of Georgia, add |countryemblem = Flag of Georgia (country) to get the flag of the country instead of the U.S. state.
  • Module:Flags/MasterData defines all the flag icons supported by {{Flags}}.

Examples

{{Calendar/event
| type = conference
| start = 2019-09-6
| end = 2019-09-8
| major = yes
| name = State Of The Map U.S. 2019
| link = State Of The Map U.S. 2019
| url = //2019.stateofthemap.us/
| city = Minneapolis
| citylink = Minneapolis, Minnesota
| region = Minnesota
| country = United States
}}
Conference 6–8 Sep2019-09-062019-09-09 State Of The Map U.S. 2019 [2], Minneapolis, Minnesota, United States
{{Calendar/event
| type = pizza
| date = 2019-02-07
| name = Civic Hack Night & Map Night
| link = 
| url = //www.meetup.com/Code-for-San-Jose/events/256761257/
| city = San José
| citylink = San José, California
| region = California
| country = United States
}}
Pizza 7 Feb2019-02-072019-02-08 Civic Hack Night & Map Night, San José, California, United States

Microformats

This template generates (invisible) microformats2 tags intended to be machine-readable and that should be parseable with external tools to generate custom calendar formats. These microformats are recognized in table rows tagged with class="h-event", not recognized elsewhere. Note that there's still no support for microformat profiles because MediaWiki does not permit inserting HTML <link> elements or rel="..." attributes (it only allows custom data-*="..." attributes), the profile is assumed to be as described in "http://microformats.org/wiki/h-event".

  • |type = generates a "p-category" property for the event.
  • |date = (or |start = and |end =) generates "dt-start" and "dt-end" properties.
  • |name =, |description =, |city =, etc. generate a <span class="p-name">...</span> element.

Implementation notes

The layout of this template is constrained by Template:Calendar as well as by the OSMBC Calendar Parser, which outputs the table included in each week's issue of weeklyOSM (preview).

OSMBC imposes a number constraints on the resulting HTML code (not on the wikitext or rendered webpage), including:

  • An event must be marked up with microformats.
  • An event's location must contain commas.
  • An event's location must appear no more than two lines below the event icon. This means there can be no more than one table cell between the type and description cells, because MediaWiki separates puts each <td> element on a separate line.
  • The line containing an event's location may not contain commas before the location. This means no image can precede the location in the same table cell, because MediaWiki includes commas in the srcset attribute of the <img> tag to supply multiple resolutions of the same image.
  • The specific categories accepted by {{Cal}} are hard-coded.
  • {{Cal|talk}} is not supported. Use {{Cal|speaking}} instead.

See also

Inserts a table row into the event calendar at Template:Calendar containing basic information about a single event.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Typetype

Nature of the event

Example
mapevent
Stringrequired
Datedate

Date of a single-day event

Example
2019-04-01
Datesuggested
Start datestart

First day of a multiday event

Example
2019-03-14
Dateoptional
End dateend

Last day of a multiday event

Example
2019-04-01
Dateoptional
Major eventmajor

Is it a major event, the highlight of everyone’s year?

Booleanoptional
Namename

Name of the event

Example
State of the Map 2019
Stringrequired
Wiki pagelink

Name of the wiki page describing the event

Example
State of the Map 2019
Page namesuggested
Official websiteurl

URL of the event’s official website

Example
https://2019.stateofthemap.org/
URLsuggested
Logologo

File name of the event’s logo; must be uploaded locally or to Wikimedia Commons

Example
SotM-2019-logo.svg
Fileoptional
Descriptiondescription

Very short description of the event; use sparingly, i.e., for major events

Example
international conference
Contentoptional
Citycity

Host city or nearest city; will be linked if an article exists by this name; displays a flag if known

Example
San Francisco
Stringsuggested
City page namecitylink

Name of the host city’s WikiProject page, if it differs from the city’s name (e.g., due to disambiguation)

Example
San Francisco, California
Page nameoptional
Regionregion

State, province, or other subnational region hosting the event, especially if the city and country are ambiguous on their own; displays a flag or shield if known

Example
Georgia
Stringoptional
Region page nameregionlink

Name of the state, province, or other subnational region’s WikiProject page, if it differs from the region’s name

Example
Georgia (U.S. state)
Page nameoptional
Countrycountry

Host country; displays a flag if known

Example
United States
Stringsuggested
Country page namecountrylink

Name of the host country’s WikiProject page, if it differs from the country’s name (currently unused)

Example
WikiProject Georgia Abkhazia South-Ossetia
Page nameoptional
Country emblemcountryemblem

Full, disambiguated name of the host country; if omitted, a flag based on the country’s name will be used if available; to disable, specify “-”

Example
Georgia (country)
Stringoptional