The "attendee", "contact" and "organizer" properties each describe a person. These elements may be treated as [[|hcard|hCards]] even when no class "vcard" is found on the element.

+

The "attendee", "contact" and "organizer" properties each describe a person. These elements may be treated as [[hcard|hCards]] even when no class "vcard" is found on the element.

<pre>

<pre>

Revision as of 21:33, 23 May 2008

(I am aware of the existence of hcalendar-brainstorming and htask. This is intended to be more of a formal-style document, representing a draft replacement for the current hcalendar spec, mostly aimed at filling in areas where the current spec is incomplete or ambiguous, rather than adding newly requested functionality.)

hCalendar 1.1

hCalendar is a simple, open, distributed calendaring and events format, based on the iCalendar standard (RFC2445), suitable for embedding in HTML or XHTML, Atom, RSS, and arbitrary XML. hCalendar is one of several open microformat standards.

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 mark-up to your page of upcoming events or events you mention in blog posts, wikis, etc.

Specification

Copyright

Per the public domain release on the authors' user pages (Tantek Çelik, Brian Suda) this specification is released into the public domain.

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.

Inspiration and Acknowledgments

Introduction

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, write-ups 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 representation of a subset of the aforementioned iCalendar standard, in semantic HTML. Bloggers can both embed hCalendar events and todo items 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.

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

For practical implementations, note that Internet Explorer's support for styling <abbr> elements is poor, and might require wrapper elements.

Format

In General

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.

The VJOURNAL and VTIMEZONE components of iCalendar are explicitly not supported as part of hCalendar. hCalendar authors SHOULD NOT use classes "vjournal" or "vtimezone" within an hCalendar context; parsers MUST NOT attempt to interpret them if conforming to this version of the specification. hAtomMAY be used as an alternative to VJOURNAL for those authors wishing to publish journal information. VTIMEZONE has no suggested direct replacement: authors SHOULD restrict themselves to publishing dates in W3CDTF format using only well-known timezones.

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. The root class name for todo items is "vtodo". An element with a class name of "vtodo" is itself called an hCalendar todo. The root class name for todo items is "valarm". The root class name for todo items is "vfreebusy". An element with a class name of "vfreebusy" is itself called an hCalendar freebusy.

For authoring convenience, "vevent", "vtodo" and "vfreebusy" are treated as root class names for parsing purposes. If a document contains elements with class names "vevent", "vtodo" or "vfreebusy", but not "vcalendar", the entire document has an implied "vcalendar" context.

An element with a class name of "valarm" is itself called an hCalendar alarm. This is not a root class name.

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.

Property List for hCalendars

vcalendar ?

vevent (hCalendar event)*

vtodo (hCalendar todo)*

vfreebusy (hCalendar freebusy)*

Although each component of an hCalendar is optional and MAY occur more than once, an hCalendar SHOULD contain at least one item.

Additionally an hCalendar event MAY contain zero or more links marked up as rel-tag corresponding to additional values for the CATEGORIES property from iCalendar; and zero or more links marked up as rel-enclosure corresponding to additional values for the ATTACH property.

Mapping of hAtom to hCalendar

The VJOURNAL component MUST NOT be used in hCalendar. hAtom entries MAY be used instead. Below is an informative mapping of iCalendar to hAtom.

Property List for hCalendar Todos

hCalendar todo items have the same properties as hCalendar events, except that they SHOULD NOT contain "transp" or "dtend" properties. The "dtstart" property is optional. The following additional properties are defined:

Case-Sensitivity of Pre-Defined Values

Certain properties have a list of possible values, defined in the iCalendar specification in ALL-CAPS. For example, the "transp" property has a value of either "OPAQUE" or "TRANSPARENT". hCalendar authors MAY use lower or mixed case for these values. hCalendar parsers MUST convert these to upper case if exporting as iCalendar.

Links

When a class is found indicating a property of type "link", then it SHOULD be parsed as follows:

If the element is an <a> element, the "href" attribute is used as the value;

Otherwise, if the element is an <img> element, the "src" attribute is used as the value;

Otherwise, if the element is an <object> element, the "data" attribute is used as the value;

If all else fails, the element is interpreted as if it were a non-link element, with the textual content of the element being treated as the value. If authors rely on this behaviour, absolute URLs SHOULD be specified.

UID

As a special case, the UID property is parsed as follows:

If the element with class "uid" has a fragment identifier (that is, if it has an "id" attribute or is <a name>), then the value of the UID property MUST be set to the absolute URL of that fragment;

Otherwise the element with class "uid" is parsed using the procedure described in the previous section on links in general.

If there is no element with class "uid", then the element bearing the root class name (e.g. "vevent" or "vtodo") is checked. If that element has a fragment identifier (that is, if it has an "id" attribute or is <a name>), then the value of the UID property MUST be set to the absolute URL of that fragment.

If all else fails, an hCalendar parser MAY choose to generate its own UID for the item. Reasonable care MUST be taken to ensure the uniqueness of this UID. Authors SHOULD NOT rely on this behaviour.

Otherwise, the item has no UID value.

Related-To Links

The value of the related-to property MUST be a link, and SHOULD link to another hCalendar event or todo item. If the element with the "related-to" class is <a> or <area>, then it MAY take a rel attribute with any of the following values:

vcalendar-parent

vcalendar-child

vcalendar-sibling

These correspond to the PARENT, CHILD and SIBLING values of the RELTYPE sub-property.

Recurrence

In RFC 2445, recurrence (RDATE) and exclusion dates (EXDATE) may be a comma-separated list of ISO dates. In hCalendar, each "rdate" and "exdate" class MUST each be a single date. Each of these can occur zero or more times within todo items and events.

Recurrence rules (RRULE) and exclusion rules (EXRULE) are complex. hCalendar parsers are not required to support them, and MAY choose to ignore the entire contents of "rrule" and "exrule" properties. But if "rrule" and "exrule" are supported, then they MUST be parsed according to the guidelines in this section of the specification.

That is, parsers MUST aim to implement "rrule" and "exrule" entirely, or not at all.

A Worked Example

This represents an event which occurs every Sunday in January at 08:30 and 09:30, starting on 5 January 1997 and only occurring on odd-numbered years. Here is an example of how that might be translated into HTML:

<p>Our organisation has been offering a series of summer lectures since
<abbr class="dtstart" title="19970105T083000">January 1997</abbr>. They
are
<span class="rrule">
held <span class="freq">yearly</span>,
every <span class="interval">2</span>nd year (1999, 2001, etc),
every <span class="byday">Sunday</span>
in January <abbr class="bymonth" title="1" style="display:none"></abbr>
at <span class="byhour">8</span>:<span class="byminute">30</span> and
repeated at <span class="byhour">9</span>:30.
</span>
</p>

This might be rendered as:

Our organisation has been offering a series of summer lectures since
January 1997. They
are
held yearly,
every 2nd year (1999, 2001, etc),
every Sunday
in January
at 8:30 and
repeated at 9:30.

Notes

The examples above show only the DTSTART and RRULE properties and do not represent an entire VEVENT (which would require an element with class "vevent", and one with class "summary").

For further information and allowed values, see section 4.3.10 of RFC 2445.

Although iCalendar doesn't allow the "BY*" properties to be repeated (BYHOUR=8;BYHOUR=9) it does allow a single "BY*" property to contain a comma-separated list of numbers (BYHOUR=8,9). When an hCalendar recurrence rule specifies a repeated "BY*" property, parsers MUST interpret this as being equivalent to a comma-separated list in iCalendar.

hCalendar recurrence rules MAY use tokens longer than two characters to identify the day. Parsers MUST trim the token down to its first two non-whitespace characters and upper-case them if wishing to convert them to iCalendar BYDAY tokens.

hCalendar recurrence rules SHOULD NOT include multiple occurrences of "until" or "count" sub-properties, and SHOULD NOT specify both an "until" and a "count" sub-property for the same rule. If a rule violates this requirement, parsers MUST use only the first "until" or "count" sub-property and MUST ignore subsequent uses of "until" or "count".

Simplified Notation

In the notation above, an element with class "freq" is a required child element of "rrule" and "exrule". When a parser encounters a recurrence rule with no "freq" specified, then the entire contents of the "rrule" or "exrule" element MUST be treated as a literal iCalendar RRULE or EXRULE. For example:

<p>Our organisation has been offering a series of summer lectures since
<abbr class="dtstart" title="19970105T083000">January 1997</abbr>. They
are held every second year (1999, 2001, etc), every Sunday in January at
8:30 and repeated at 9:30.
<abbr title="FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30"
class="rrule" style="display:none"></abbr>
</p>

This allows authors to express complicated rules in more natural language without having to worry about how to map their language onto the various recurrance rule sub-properties.

The events and todos are to be parsed as independent items, with properties from the children not being applied to the parent, nor vice versa. The only thing a parser MAY infer from the nesting is the RELATED-TO property. However, if the items explicitly specify a "related-to" class, the explicit relation MUST override any implied relation.

Nested hCards

The "attendee", "contact" and "organizer" properties each describe a person. These elements may be treated as hCards even when no class "vcard" is found on the element.

Organizer

the first hCard "email" of the first hCard "agent" maps to the iCalendar "SENT-BY" parameter

the first hCard "email" maps to the iCalendar "ORGANIZER" property itself

Categories and Attachments

RFC 2445 specifies that a VEVENT or VTODO MAY have a single CATEGORIES property, which takes a comma-separated list of categories applicable to the item. For example:

CATEGORIES:BUSINESS,HUMAN RESOURCES

This specification allows the "categories" property to occur multiple times, and also allows categories to be specified using rel-tag. An hCalendar-to-iCalendar converter MUST coalesce multiple hCalendar categories into a single iCalendar CATEGORIES string. It MAY convert these to upper-case. As an example, the following hCalendar and iCalendar events are considered equivalent:

hCalendar components (except freebusy) MAY include one or more attachments -- documents related to the component. For example, an hCalendar event describing a meeting might have the agenda attached. In RFC 2445, binary attachments are allowed; in hCalendar, all attachments must be given as URLs (though they may be "data:" URLs). This specification allows two equivalent syntaxes for attaching files to a component:

An HTML class of "attach" may be set on an element, in which case it should be parsed according to the general rules for links.

When class "vtodo" is found on an element with class "xoxo", then each list item corresponds to a todo item. For each item, if no summary is found in, then the entire contents of the item are taken to be the summary. Nested lists correspond to the RELATED property of VTODO with RELTYPE of PARENT/CHILD. An example iCalendar translation of the above XOXO list might be:

Further Reading

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.