hcalendar-ja

From Microformats Wiki
Jump to navigation Jump to search

hCalendar

microformat_hcalendar.png

hCalendarはiCalendar (RFC2445)を基とした、シンプルでオープンなカレンダー・イベント情報配信用のmicroformatです。(X)HTMLやAtom, RSS, 任意のXMLなど、広範囲に適用可能なフォーマットとなっています。

hCalendarでイベント情報を配信するにはいくつかの方法があります。手っ取り早いのは、「hCalendar クリエーター」ツールを使うこと。でももし、すでにイベントの情報を自分のブログやwikiなどに書いている場合は、hCalendarを書くコツを読み、hCalendarに沿うようマークアップをし直しましょう。

仕様

編者
Tantek Çelik (Technorati, Inc)
作者
Tantek Çelik, Technorati, Inc
Brian Suda

著作権

© 2004-2024 by the authors.

この仕様の著作権は、ページ編集に関わった人全てが保有しています。 しかし、著者はこの仕様をGMPGIETFW3Cなどの標準化団体に提出することを考えています。この仕様に貢献したい場合は、これらの団体が持つ著作権に対する方針やポリシー(例:GMPG Principles)を読み、ライセンスに関する規定(例:CC-by 1.0や後のバージョン)を理解した上でお願いします。

特許方針

この仕様はロイヤリティーフリーの特許方針に帰属するものです。特許方針に関してはW3C Patent PolicyRFC3667RFC3668をご覧下さい。

謝辞

以下の方に感謝します。

概要

iCalendar (RFC2445)はAppleのiCalなど、スケジュール管理用アプリケーションに広く採用され、また実装上の相互運用性も高いフォーマットになっています。

この広く使われているフォーマットを、ブログで言及されるイベント情報に応用できないでしょうか。今後行われるイベントや、これまでに参加したイベントについて自分のブログ上に記事を書くブロガーはたくさんいます。それらのイベント情報を少し構造化し、iCalendarとして出力可能にすれば、アプリケーションやWebサービスが自動的にその情報を利用できるようになります。

このhCalendarという仕様は、XHTMLによってiCalendarを表現する書式です。ブロガーはhCalendarを直接webページに埋め込んだり、またその情報をCSSでデザインすることが可能です。それだけではありません。アプリケーションはイベント情報を直接そのhCalendarから取ってくることができるようになります。イベントについて書かれたファイルを、webページと別に用意する必要はもうありません。

セマンティックXHTMLデザイン指針

注:セマンティック XHTML デザイン指針は、始め hCardhCalendar 開発の文脈で書かれました。そのため、この指針は hCard デザインの方法論の文脈において理解しやすくなるでしょう(つまり、そちらをまず読んでください)。Tantek

XHTML は XML に基づいて作られており、そのため XHTML に基づいたフォーマットは、表示に便利なだけでなく一般的なデータ交換目的にも使えます。XHTML に基づいたフォーマットは、多くの点で HTML と XML の世界双方の最もよい所を体現しています。とは言え、XHTML に基づいたフォーマットを作成する時、指針を集めたものがあると役立ちます。

  1. 可能な限り、言及している、既存の確立されてよくサポートされている標準からスキーマ(名前、オブジェクト、プロパティ、値、種類、階層、制約)を再利用する。元の標準で表現されている制約を再宣言することは避ける。参考情報のために言及するのはよい。
    1. 複数の構成要素からなる種類のものには、その構成要素の名前に相当する class 名を持った要素を入れ子にして使う。
    2. 複数の構成要素は一つずつにする。そのため、カンマ区切りの複数のテキスト値を表すには、複数の要素を埋め込んで使う。
  2. 各オブジェクトなどのブロックを構成するのに一番適した意味的な XHTML を使う。
  3. そういったものが無ければ、構造を作る一般的な要素(例えば <span><div>)か文脈に適した要素(例えば <ul><ol> 中の <li>)を使う。
  4. 元のスキーマのその部分を的確に表現する XHTML の構成ブロックが無ければ、元のスキーマ由来の名前に基づいた class 名を使う。元のスキーマ中の名前が大文字と小文字を区別しないならば、相当するものを全て小文字にして使う。構成要素の(明確に定義されたスキーマではなく)日常語風の暗黙的な名前も、使いやすさのために、相当するものを全て小文字にして使うべきである。構成要素名中のスペースはダッシュ '-' 文字になる。
  5. 最後に、元のスキーマに従ったデータの形式があまりに長かったり人間に馴染まない場合、構造を作る一般的な要素の代わりに <abbr> を使い、忠実に従ったデータを(表現を記述する属性である)'title' 属性の中へ、相当するより簡潔で人間に読みやすいものを要素自体の中へ置く。<abbr> のこの使い方に関する説明のより多くの情報:Human vs. ISO8601 dates problem solved(人間 vs ISO8601 日付問題の解決)

実用的な導入を考えた場合、Internet Explorerでは <abbr> 要素のCSSスタイリングがきちんとサポートされていないため、別の追加要素が必要になることがあるのを覚えておくと良いでしょう。

書式

通例

iCalendar 標準規約(RFC2445)がhCalendarのもととなっています。

注意:この仕様書の編集者および執筆者は、「iCal-Basic」の取り組みを追い、 hCalendarのコア・プロファイルを iCal-Basic に基づいたものにしようとしています。リンク先にある現在の草稿をご覧ください。

hCalendarの基本的な書式は、iCalendarのオブジェクトおよび変数名をclass名として小文字で書くようにしたものです。また、iCalendarの入れ子方式に配置されたオブジェクトを、そのまま入れ子方式のXHTMLにマッピングします。

ルート class 名

hCalendar のルート class 名は "vcalendar" です。"vcalendar" という class 名が指定された要素自体を hCalendar と呼びます。

イベントの class 名は "vevent" です。"vevent" という class 名が指定された要素自体を hCalendar イベントと呼びます。

hCalendar を書く便宜上、"vevent" と "vcalendar" は両方ともパースのためのルート class 名として扱います。文書上に "vevent" という class 名があって "vcalendar" が無い場合には、文書全体が "vcalendar" の文脈を持ちます。

vevent はイベント一覧のそれぞれに必要だと考えるべきです。

プロパティとサブプロパティ

ある hCalendar のプロパティはその hCalendar 内の要素で表現します。一覧に挙げたプロパティの class 名を持つ要素は、そのプロパティの値を表しています。プロパティがサブプロパティを持つこともあり、プロパティ用の要素の内側にある要素で表現します。

プロパティ一覧

hCalendar のプロパティ(サブプロパティはこのように括弧内に記述)

必須プロパティ

任意プロパティ

  • location
  • url
  • dtend(ISO date)、duration(ISO date duration)
  • rdate、rrule
  • category、description
  • uid
  • geo(latitude、longitude)
  • …… 編注:これは完全な一覧ではなく(完全でないことはまったく無いよりはよいのです)、今 RFC2445 からここへ持ってきて編集しました。上のプロパティ一覧は hCalendar で最も一般的に使われるものです。

More Semantic Equivalents

いくつかのプロパティについては意味的にもっとふさわしいものがあるので、特別な扱い方をします。例えばこうです。

  • iCalendar の URL は、hCalendar では class="vevent" を持つ要素内の <a class="url" href="...">...</a> になります。
  • iCalendar の ATTENDEECONTACTORGANIZER は、hCalendar では hCard で表現できます(MAY)。
  • iCalendar の名前の付いた LOCATION(住所や位置情報を伴っている可能性がある)は、hCalendar では hCard を埋め込んで表現できます(MAY)。同様に、住所による LOCATIONadr で、位置情報(緯度と経度)による LOCATIONgeo で表現できます(MAY)。
  • iCalendar の UID は単に別の意味、hCalendar のイベント用に使われる URL ということになります。

Singular vs. Plural Properties

単数のプロパティ(例えば vCard の "N" や "FN")としてはその class を持つ最初の子孫要素が効果を持ち、その他はすべて無視します。

複数が許されるプロパティ(例えば vCard 由来の "TEL")としては、各 class のインスタンスがそのプロパティのインスタンスを作るべきです。サブタイプを持つ複数のプロパティ(例えば vCard の WORK、HOME、CELL を持った TEL)は、そのプロパティ用の共通要素を共有して最適化できます。サブタイプの各インスタンスは、プロパティの要素の子孫要素に適切に分類されるのです。

Plural Properties Singularized

複数形のプロパティ名は相当する単数形になるため、元の複数形のプロパティで複数の構成要素を持つ一つだけの値が許される場合でも、その複数の構成要素はそれぞれ名前が単数形のプロパティ名で表現し、そのプロパティは値が複数でも有効で、上記の複数値プロパティの扱いの対象となります。

Human vs. Machine readable

あるプロパティ用に <abbr> を使った場合、要素内容ではなく、その <abbr> 要素の 'title' 属性がプロパティの値になります。この仕様では次の iCalendar プロパティに対してそういった <abbr> の仕様を推奨します。

  • DTSTART、DTEND、DURATION、RDATE、RRULE

以下は、iCalendarの例です。

BEGIN:VCALENDAR
PRODID:-//XYZproduct//EN
VERSION:2.0
BEGIN:VEVENT
URL:http://www.web2con.com/
DTSTART:20071005
DTEND:20071020
SUMMARY:Web 2.0 カンファレンス
LOCATION:アージェントホテル\, サンフランシスコ\, カリフォルニア州
END:VEVENT
END:VCALENDAR

hCalendar書式で同様のイベントを表示する場合、各種要素が最適化され、以下のようになります。元になった内容については、hcalendar-example1-stepsをご覧ください。

<div class="vevent">
 <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
  <span class="summary">Web 2.0 カンファレンス </span>:
  <abbr class="dtstart" title="2007-10-05">10月5日</abbr>〜
  <abbr class="dtend" title="2007-10-20">19日</abbr>、
  <span class="location">アージェントホテル(カリフォルニア州サンフランシスコ)</span>にて。
 </div>

これは、以下のように表示されます。

http://www.web2con.com/  Web 2.0 カンファレンス 10月5日 19日 アージェントホテル(カリフォルニア州サンフランシスコ)にて。

これは、'本物の'hCalendarマイクロフォーマットであり、パーサーがこのページ内から検出できることに注意してください。

Example 2

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 held on <abbr class="dtstart" title="1998-03-12T08:30:00-05:00">12 March 1998 from 8:30am EST</abbr> 
until <abbr class="dtend" title="1998-03-12T09:30:00-05:00">9:30am EST</abbr></p>
<p>Location: <span class="location">1CP Conference Room 4350</span></p>
<small>Booked by: <span class="uid">guid-1.host1.com</span> on 
<abbr class="dtstamp" title="19980309T231000Z">9 Mar 1998 6:00pm</abbr></small>
</div>

This could be displayed as:


XYZ Project Review

Project XYZ Review Meeting

To held on 12 March 1998 from 8:30am EST until 9:30am EST

Location: 1CP Conference Room 4350

Booked by: guid-1.host1.com on

9 Mar 1998 6:00pm

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 dates (required by iCalendar) are not very human friendly. In addition, the year is often understood implicitly by humans from the context. Thus <abbr> 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. The notation YYYY-MM-DDThh:mm:ss should be used for better readability, following the format of RFC 3339.

Note 5: The difference between the DTEND ISO8601 date (2005-10-08) and the human readable date (7) is NOT a mistake. DTEND is exclusive, meaning, that the event ends just before the DTEND. Thus for events which start on one day and end on another day, the DTEND date must be specified as the day after the day that a human would say is the last day of the event.

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.

Buttons

Don't forget that you can add one of our buttons to the page, to indicate the presence of hCalendar microformats. For example: microformat_hcalendar.png. 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!

More Examples

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.

See hCalendar Examples in the wild.

Implementations

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.

See hCalendar Implementations.

References

Normative References

Informative References

Specifications That Use hCalendar

Similar Work

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.

Related Pages

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.