Difference between revisions of "hcalendar"
m (Changed protection level for "hCalendar 1.0" [edit=sysop:move=sysop])
Revision as of 01:02, 4 April 2013
hCalendar is a simple, open format for publishing events on the web, using a 1:1 representation of iCalendar (RFC2445) VEVENT properties and values in HTML. hCalendar is one of several open microformat standards suitable for embedding data in HTML/HTML5, and Atom/RSS/XHTML or other XML.
- 1 Example
- 2 Status
- 3 Introduction
- 4 Semantic XHTML Design Principles
- 5 Format
- 6 Examples
- 7 Examples in the wild
- 8 Implementations
- 9 Articles
- 10 Buttons
- 11 Copyright
- 12 Patents
- 13 References
- 14 Inspiration and Acknowledgments
- 15 Related Reading
- 16 Related Pages
- 17 Translations
Here is a simple prose event:
The microformats.org site was launched on 2005-06-20 at the Supernova Conference in San Francisco, CA, USA.
marked up with hCalendar
<span class="vevent"> <span class="summary">The microformats.org site was launched</span> on <span class="dtstart">2005-06-20</span> at the Supernova Conference in <span class="location">San Francisco, CA, USA</span>. </span>
Want to get started with writing an hCalendar event? Use the hCalendar creator to write up an event and publish it, or follow the hCalendar authoring tips to add hCalendar markup to your page of upcoming events or events you mention in blog posts, wikis, etc.
hCalendar 1.0 is a microformats.org specification. Public discussion on hCalendar takes place on hCalendar issues, the #microformats #microformats chat channel on irc.freenode.net, and microformats-discuss mailing list.
The English version of this specification is the only normative version. For translations of this document see the #translations section.
Errata and Updates
The hCalendar 1.0.1 update is currently under development and incorporates known errata corrections as well as the Value Class Pattern.
The iCalendar standard (RFC2445), has been broadly interoperably implemented (e.g. Apple's "iCal" application built into MacOSX).
In addition, bloggers often discuss events on their blogs -- upcoming events, writeups of past events, etc. With just a tad bit of structure, bloggers can discuss events in their blog(s) in such a way that spiders and other aggregators can retrieve such events, automatically convert them to iCalendar, and use them in any iCalendar application or service.
This specification introduces the hCalendar format, which is a 1:1 representation of the aforementioned iCalendar standard, in semantic HTML. Bloggers can both embed hCalendar events directly in their web pages, and style them with CSS to make them appear as desired. In addition, hCalendar enables applications to retrieve information about such events directly from web pages without having to reference a separate file.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Semantic XHTML Design Principles
Note: the Semantic XHTML Design Principles were written primarily within the context of developing hCard and hCalendar, thus it may be easier to understand these principles in the context of the hCard design methodology (i.e. read that first). Tantek
XHTML is built on XML, and thus XHTML based formats can be used not only for convenient display presentation, but also for general purpose data exchange. In many ways, XHTML based formats exemplify the best of both HTML and XML worlds. However, when building XHTML based formats, it helps to have a guiding set of principles.
- Reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported standards by reference. Avoid restating constraints expressed in the source standard. Informative mentions are ok.
- For types with multiple components, use nested elements with class names equivalent to the names of the components.
- Plural components are made singular, and thus multiple nested elements are used to represent multiple text values that are comma-delimited.
- Use the most accurately precise semantic XHTML building block for each object etc.
- Otherwise use a generic structural element (e.g.
<div>), or the appropriate contextual element (e.g. an
- Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters.
- Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use
<abbr>instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of
<abbr>: Human vs. ISO8601 dates problem solved
For practical implementations, it should be noted that Internet Explorer's support for styling
<abbr> elements is poor, and may require wrapper elements.
The iCalendar standard (RFC2445) forms the basis of hCalendar.
Note: the editor and authors of this specification are tracking the "iCal-Basic" effort and intend to base the core hCalendar profile on iCal-Basic. See references for a link to the current draft.
The basic format of hCalendar is to use iCalendar object/property names in lower-case for class names, and to map the nesting of iCalendar objects directly into nested XHTML elements.
Root Class Name
The root class name for hCalendar is "vcalendar". An element with a class name of "vcalendar" is itself called an hCalendar.
The root class name for events is "vevent". An element with a class name of "vevent" is itself called an hCalendar event.
For authoring convenience, both "vevent" and "vcalendar" are treated as root class names for parsing purposes. If a document contains elements with class name "vevent" but not "vcalendar", the entire document has an implied "vcalendar" context.
vevent should be considered required for each event listing.
Properties and Sub-properties
The properties of an hCalendar are represented by elements inside the hCalendar. Elements with class names of the listed properties represent the values of those properties. Some properties have sub-properties, and those are represented by elements inside the elements for properties.
hCalendar properties (sub-properties in parentheses like this)
- dtstart (ISO date)
- dtend (ISO date), duration (ISO date duration)
- rdate, rrule
- category, description
- geo (latitude, longitude)
- attendee (partstat, role), contact, organizer
- ... editor's note: this list is incomplete (an incomplete list is better than no list) and is being currently edited from RFC2445 to here. The above list of properties are those that are often used in hCalendar on the web.
The hCalendar XMDP profile is at http://microformats.org/profile/hcalendar
Content that uses hCalendar SHOULD reference this profile, e.g.
<link rel="profile" href="http://microformats.org/profile/hcalendar">
This content uses <a rel="profile" href="http://microformats.org/profile/hcalendar">hCalendar</a>.
Content may combine the above methods as well.
More Semantic Equivalents
For some properties there is a more semantic equivalent, and therefore they get special treatment, e.g.:
URLin iCalendar becomes
<a class="url" href="...">...</a>inside the element with
ORGANIZERin iCalendar MAY be represented by an hCard in hCalendar .
- A named
LOCATION(potentially with an address and/or geo) in iCalendar MAY be represented by a nested hCard in hCalendar. Similarly, an address
LOCATIONMAY be represented by an adr, and a geo (latitude and longitude)
LOCATIONmay be represented by a Geo.
UIDin iCalendar simply becomes another semantic applied to a specific URL for an hCalendar event.
ATTACHin iCalendar becomes an img or object element (where the value is stored ito / retrieved from the 'src' or 'data' attributes respectively). An
<a class="attach" href="...">...</a>may also be used, in which case the 'href' attribute is used for the property value.
Singular vs. Plural Properties
For properties which are singular (e.g. "N" and "FN" from vCard), the first descendant element with that class SHOULD take effect, any others being ignored.
For properties which can be plural (e.g. "TEL" from vCard), each class instance SHOULD create a instance of that property. Plural properties with subtypes (e.g. TEL with WORK, HOME, CELL from vCard) can be optimized to share a common element for the property itself, with each instance of subtype being an appropriately classed descendant of the property element.
Plural Properties Singularized
Since plural property names become their singular equivalents, even if the original plural property permitted only a single value with multiple components, those multiple components are represented each with their own singularly named property and the the property is effectively multivalued and subject to the above treatment of multivalued properties.
Human vs. Machine readable
<abbr> element is used for a property, then the '
title' attribute of the
<abbr> element is the value of the property, instead of the contents of the element, which instead provide a human presentable version of the value. This specification recommends that such
<abbr> elements be used for the following iCalendar properties:
- DTSTART, DTEND, DURATION, RDATE, RRULE
Here is a sample multiple-day event in an iCalendar:
BEGIN:VCALENDAR PRODID:-//XYZproduct//EN VERSION:2.0 BEGIN:VEVENT URL:http://conferences.oreillynet.com/pub/w/40/program.html DTSTART:20051005 DTEND:20051008 SUMMARY:Web 2.0 Conference LOCATION:Argent Hotel\, San Francisco\, CA END:VEVENT END:VCALENDAR
and an equivalent event in hCalendar format with various elements optimized appropriately. See hCalendar Example 1 Steps for the derivation.
<div class="vevent"> <a class="url" href="http://conferences.oreillynet.com/pub/w/40/program.html"> http://conferences.oreillynet.com/pub/w/40/program.html </a> <span class="summary">Web 2.0 Conference</span>: <abbr class="dtstart" title="2005-10-05">October 5</abbr>- <abbr class="dtend" title="2005-10-07">7</abbr>, at the <span class="location">Argent Hotel, San Francisco, CA</span> </div>
which could be displayed as:
http://conferences.oreillynet.com/pub/w/40/program.html Web 2.0 Conference: October 5- 7, at the Argent Hotel, San Francisco, CA
Note 1: that this is a live hCalendar microformat, which will be found on this page by parsers.
Note 2: This example used to have "2005-10-08" as the value of the dtend, but per the resolution to the dtend-issue, has been changed to "2005-10-07" in order to encourage publishers/implementers to update their markup/code immediately and test it.
Note 3: Note that the iCalendar in the first part of the example has the code
DTEND:20051008. That "8" is not a typo. iCalendar uses exclusive whole end dates (DTEND values) and thus requires that the DTEND value be set to a whole day after what content publishers visibly display as the ending date of an event. iCalendar's exclusive end dates convention has shown to be problematic and confusing for content authors and publishers. Thus per the resolution to the dtend-issue, in hCalendar, the end date is stated exactly as existing events publish visible end dates to humans, with an inclusive end date (dtend property value), in this example, 2005-10-07.
The following example specifies a scheduled meeting that begins at 8:30 AM EST on March 12, 1998 and ends at 9:30 AM EST on March 12, 1998.
BEGIN:VCALENDAR BEGIN:VEVENT UID:guid-1.host1.com DTSTAMP:19980309T231000Z DESCRIPTION:Project XYZ Review Meeting SUMMARY:XYZ Project Review DTSTART:19980312T133000Z DTEND:19980312T143000Z LOCATION:1CP Conference Room 4350 END:VEVENT END:VCALENDAR
The equivalent in hCalendar:
<div class="vevent"> <h3 class="summary">XYZ Project Review</h3> <p class="description">Project XYZ Review Meeting</p> <p>To be held on <span class="dtstart"> <abbr class="value" title="1998-03-12">the 12th of March</abbr> from <span class="value">8:30am</span> <abbr class="value" title="-0500">EST</abbr> </span> until <span class="dtend"> <span class="value">9:30am</span> <abbr class="value" title="-0500">EST</abbr> </span> </p> <p>Location: <span class="location">1CP Conference Room 4350</span></p> <small>Booked by: <span class="uid">guid-1.host1.com</span> on <span class="dtstamp"> <abbr class="value" title="1998-03-09">the 9th</abbr> at <span class="value">6:00pm</span> </span> </small> </div>
This could be displayed as:
XYZ Project Review
Project XYZ Review Meeting
To be held on until
Location: 1CP Conference Room 4350Booked by: guid-1.host1.com on
Note 1: The product information is not necessary since hCalendar is an interchange format. When transforming hCalendar back into iCalendar, the transforming engine should add its own product ID.
Note 2: A surrounding
<span class="vcalendar"> element is optional, and is left out as such. It is optional since the context of a vcalendar is implied when a vevent is encountered. The implied context/scope is that of the document. Authors may explicitly use elements with class="vcalendar" to wrap sets of vevents that all belong to the same calendar, e.g. when publishing multiple calendars on the same page.
Note 3: The version information is unnecessary in hCalendar markup directly since the version will be defined by the profile of hCalendar that is used/referred to in the 'profile' attribute of the <head> element.
Note 4: ISO8601 datetimes (required by iCalendar) are not very human friendly. In addition, the year is often understood implicitly by humans from the context. Thus the Value Class Pattern and
<abbr> elements are used to simultaneously provide human friendly dates and/or times in the visible contents of the element, while placing the respective machine parsable comprehensive ISO8601 dates and times in the 'title' attribute when necessary. Per the Value Class Pattern, separate dates and times SHOULD be used by authors rather than a full ISO8601 datetime, for better readability and listenability.
Note 5: Per the dtend-issue resolution, DTEND dates are provided as humans expecte them to be (consistent with what day an event ends on), rather than iCalendar's confusing definition (the day after). Thus hCalendar processors which produce iCalendar must make the transformation, which is to treat a whole hCalendar
dtend end date as *inclusive*, and convert it to an *exclusive DTEND* end date when producing iCalendar.
Note 6: The location in this example contains implicit structure (venue name, city, state) which could be marked up explicitly as an hCard. See hCalendar brainstorming: hCard locations for a informative explanation of how to do this.
See hCalendar examples for more examples, including examples from iCalendar RFC 2445 converted into hCalendar.
Examples in the wild
This section is informative. The number of hCalendar examples in the wild has expanded far beyond the capacity of being kept inline in this specification. They have been moved to a separate page.
This section is informative. The number of hCalendar implementations has also expanded beyond the capacity of keeping them inline. They have been moved to a separate page.
This section is informative.
See: hCalendar articles.
This section is informative. Don't forget that you can add one of our Microformats Buttons to the page, to indicate the presence of hCalendar microformats. For example: . If you can link it back to this page (or even page on your website, about your use of the microformat), so much the better!
Public Domain Contribution Requirement. Since the author(s) released this work into the public domain, in order to maintain this work's public domain status, all contributors to this page agree to release their contributions to this page to the public domain as well. Contributors may indicate their agreement by adding the public domain release template to their user page per the Voluntary Public Domain Declarations instructions. Unreleased contributions may be reverted/removed.
This section is informative.
- hCalendar term introduced and defined on the Web, 20040930
- FOO Camp 2004 HTML For Calendars presentation, 20040911
- FOO Camp 2004 Simple Semantic Formats presentation, 20040910
- iCal-Basic (latest) (draft 04)
- W3C Note on Date and Time Formats
- Internet Mail Consortium Personal Data Interchange vCard and vCalendar
- Contributed from http://developers.technorati.com/wiki/hCalendar
Specifications That Use hCalendar
Inspiration and Acknowledgments
- Adam Bosworth for leading the FOO Camp 2004 HTML For Calendars presentation which brought together a critical mass of interested parties.
This section is informative. Some further reading on the broader topic of calendars and calendaring formats.
- jwz - Hula (required reading)
- Groupware Bad by Jamie Zawinski crystalizes the reason for hCalendar (emphasis added):
Right now people can do that by publishing .ics files, but it's not trivial to do so, and it's work on the part of other people to look at them. If it's not HTML hanging off our friend's home page that can be viewed in any browser on a public terminal in a library, the bar to entry is too high and it's useless.
- hCalendar - specification
- hCalendar intro - plain English introduction
- hCalendar authoring - learn how to add hCalendar markup to your existing events.
- hCalendar creator (hCalendar creator feedback) - create your own hCalendar events.
- hCalendar cheatsheet - hCalendar properties
- hCalendar examples in the wild - an on-going list of websites which use hCalendars.
- hCalendar implementations - websites or tools which either generate or parse hCalendars
- hCalendar FAQ - If you have any questions about hCalendar, check here.
- hCalendar parsing - normative details of how to parse hCalendar.
- hCalendar profile - the XMDP profile for hCalendar
- hCalendar singular properties - an explanation of the list of singular properties in hCalendar.
- hCalendar tests - a wiki page with actual embedded hCalendar events to try parsing.
- hCalendar "to do" - jobs to do
- hCalendar advocacy - encourage others to use hCalendar.
- iCalendar implementations
This specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. These thoughts, issues, and questions are kept in separate pages.
- hCalendar Brainstorming - brainstorms and other explorations relating to hCalendar
- hCalendar issues - issues with the specification
- Wikipedia article on hCalendar
Read the hCalendar specification in additional languages: