- 1 hCalendar
- 2 Draft Specification
- 3 Abstract
- 4 Introduction
- 5 Semantic XHTML Design Principles
- 6 Format
- 7 Example
- 8 Examples in the wild
- 9 Implementations
- 10 References
- 11 Discussions
Inspiration and Acknowledgments
- Adam Bosworth for leading the FOO Camp 2004 HTML For Calendars presentation which brought together a critical mass of interested parties.
hCalendar is a 1:1 representation of iCalendar in XHTML. hCalendar is one of several MicroFormats.
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 XHTML. 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.
Semantic XHTML Design 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. <span> or <div>), or the appropriate contextual element (e.g. an <li> inside a <ul> or <ol>).
- 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
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.
More Semantic Equivalents
However, for some properties there is a more semantic equivalent, and therefore they get special treatment, e.g.:
- URL in iCalendar becomes <a class="url" href="...">...</a> inside the element with class="vevent" in hCalendar.
- ATTENDEE in iCalendar may in hCalendar be represented by an hCard.
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.
Human vs. Machine readable
If an element is used for a property, then the 'title' attribute of the 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 elements be used for the following iCalendar properties:
- DTSTART, DTEND, DURATION, RDATE, RRULE
Here is a sample event in an iCalendar:
BEGIN:VCALENDAR PRODID:-//XYZproduct//EN VERSION:2.0 BEGIN:VEVENT URL:http://www.web2con.com/ DTSTART:20051005 DTEND:20051007 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 hCalendarExample1Steps for the derivation.
<a class="url" href="http://www.web2con.com/"> Web 2.0 Conference: October 5- 7, at the Argent Hotel, San Francisco, CA </a>
which could be displayed as:
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 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 dates (required by iCalendar) are not very human friendly. In addition, the year is often understood implicitly by humans from the context. Thus elements are used to simultaneously provide a human friendly date and/or time in the visible contents of the element, while placing the respective machine parsable comprehensive ISO8601 datetime in the 'title' attribute.
Examples in the wild
This section is informative.
The following sites have implemented hCalendar, and thus are a great place to start for anyone looking for examples "in the wild" to try parsing, indexing, organizing etc. If events on your pages are marked up with hCalendar, feel free to add it to the top of this list. Once the list grows too big, we'll make a separate wiki page.
- EVDB, the Events and Venues database, publishes all events with hCalendar.
- Upcoming.org publishes all events and lists of events with hCalendar.
- The Laughing Squid Calendar events, e.g. this party, now supports hCalendar.
- Paul Schreiber's Sunnyvale House Concerts site publishes hCalendar event information for upcoming concerts. In addition the Past Shows page contains hCalendar events for all past concerts.
- Complex Spiral Consulting, both in the "Events" box on left side, and the separate Events page.
- Tantek's Thoughts, specifically the "Events" roll in the right-most column.
- Lesser Known Holidays, a list of holidays on suda.co.uk that can be imported via iCal and hCal so you can compare actual transformation versus intended.
This section is informative.
The following implementations have been developed which either generate or parse hCalendars. If you have an hCalendar implementation, feel free to add it to the top of this list. Once the list grows too big, we'll make a separate wiki page.
- X2V parses hCalendar and produces a .ics (iCalendar) stream. Note: needs to be updated to track changes in the specification as they occur.
- 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 draft 02
- IETF-calsify archives
- jwz - Hula (required reading)
- Groupware Bad by Jamie Zawinski crystalizes the reason for hCalendar (emphasis added):
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.
This specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. There is a separate document where we are keeping our brainstorms and other explorations relating to hCalendar:
- If you have any questions about hCalendar, check the hCalendarFAQ, and if you don't find answers, add your questions!
- Please add any issues with the specification to the separate hCalendarIssues document.