hcard-cheatsheet: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
m (Replace <entry-title> with {{DISPLAYTITLE:}})
 
(41 intermediate revisions by 13 users not shown)
Line 1: Line 1:
<h1>hCard cheetsheet</h1>
{{DISPLAYTITLE:hCard cheatsheet}}


==Properties==
[[hcard|hCard]] properties and how to use them.


*class="'''vcard'''" (1)
==Profile==
**class="''[[adr]]''" (4)
Place the following into the <nowiki><head></nowiki> of your document:
***class="type" [work|home|pref|postal|dom|intl] (3)
***class="post-office-box" (3)
***class="''street-address''" (4)
***class="extended-address" (3)
***class="region" (3)
***class="locality" (3)
***class="postal-code" (3)
***class="country-name" (3)
**class="''agent''" (4)
**class="[[hcard-singular-properties#bday|bday]]" ([[datetime-design-pattern |ISO date]])  (3)
**class="[[hcard-singular-properties#class|class]]" – confidentiality/access classification of the ''entire'' hCard  (3)
**class="''category''" (4)
**class="''email''" (4)
***class="type" (3)
***class="value" (3)
**class="'''[[hcard-singular-properties#fn|fn]]'''" (1)
**class="[[geo]]" (3)
***class="latitude" (3)
***class="longitude" (3)
**class="''key''" (4)
**class="''label''" (4)
**class="''logo''" (4)
**class="''mailer''" (4)
**class="[[hcard-singular-properties#n|n]]" (3)
***class="''honorific-prefix''" (4)
***class="''given-name''" (4)
***class="''additional-name''" (4)
***class="''family-name''" (4)
***class="''honorific-suffix''" (4)
**class="''nickname''" (4)
**class="''note''" (4)
**class="''org''" (4)
***class="organization-name" (3)
***class="''organization-unit''" (4)
**class="''photo''" (4)
**class="[[hcard-singular-properties#rev|rev]]" – datetime of the revision of the ''entire'' hCard (3)
**class="''role''" (4)
**class="[[hcard-singular-properties#sort-string|sort-string]]" (3)
**class="''sound''" (4)
**class="''title''" (4)
**class="''tel''" (Note [http://en.wikipedia.org/wiki/E.123 E.123] for formatting info.) (4)
***class="type" [home|work|pref|fax|cell|pager] (3)
***class="value" (3)
**class="[[hcard-singular-properties#tz|tz]]" – timezone of the person (3)
**class="[[hcard-singular-properties#uid|uid]]" – applies to the ''entire'' hCard (3)
**class="''url''" (4)


==Key==
<source lang=html4strict>
:1 - '''Single occurrence required'''
<link rel="profile" href="http://microformats.org/profile/hcard">
:2 - '''''One or more, required''''' (n/a)
</source>
:3 - single occurrence optional
See [[rel-profile]] for details.
:4 - ''zero or more occurrence''
:[square brackets] - common list of values
:(data format)


:pref = preferred
==Properties  (Class Names)==
:dom = domestic
:intl = international
:cell = mobile


==Notes==
*'''vcard''' {1}
* <code>URL</code> in vCard becomes  <code><a class="url" href="...">...</a></code> inside the element with <code>class="vcard"</code> in hCard.
**''[[adr]]''*
***type [work|home|pref|postal|dom|intl]?
***post-office-box?
***''street-address''*
***extended-address?
***region?
***locality?
***postal-code?
***country-name?
**''agent''*
**[[hcard-singular-properties#bday|bday]]? ''([[datetime-design-pattern |ISO date]])''
**[[hcard-singular-properties#class|class]]? ''confidentiality/access classification of the ''entire'' hCard''
**''category''*
**''email''*
***type?
***value?
**'''[[hcard-singular-properties#fn|fn]]''' {1}
**[[geo]]?
***latitude?
***longitude?
**''key''*
**''label''*
**''logo''*
**''mailer''*
**[[hcard-singular-properties#n|n]]?
***''honorific-prefix''*
***''given-name''*
***''additional-name''*
***''family-name''*
***''honorific-suffix''*
**''nickname''*
**''note''*
**''org''*
***organization-name?
***''organization-unit''*
**''photo''*
**[[hcard-singular-properties#rev|rev]]? ''datetime of the revision of the ''entire'' hCard''
**''role''*
**[[hcard-singular-properties#sort-string|sort-string]]?
**''sound''*
**''tel''* ''(Note [http://en.wikipedia.org/wiki/E.123 E.123] for formatting info.)''
***type [home|work|pref|fax|cell|pager]?
***value?
**''title''*
**[[hcard-singular-properties#tz|tz]]? ''timezone of the person''
**[[hcard-singular-properties#uid|uid]]?  ''applies to the ''entire'' hCard''
**''url''*
 
{{cheatsheet-key}}
{| border="1" cellpadding="2"
| pref || preferred
|-
| dom || domestic
|-
| intl || international
|-
| cell || mobile
|}
 
===Notes===
*{{rfc-2119-intro}}
* <code>URL</code> in vCard becomes  <code><a class="url" href=...>...</a></code> inside the element with class <code>vcard</code> in hCard.
* Similarly, <code>EMAIL</code> in vCard becomes <code><nowiki><a class="email" href="mailto:...">...</a></nowiki></code>
* Similarly, <code>EMAIL</code> in vCard becomes <code><nowiki><a class="email" href="mailto:...">...</a></nowiki></code>
* <code>PHOTO</code> in vCard becomes <code><img class="photo" src="..." alt="Photo of ..." /></code> or <code><object class="photo" data="..." type="...">Photo of ...</object></code>
* <code>FN</code> is an abbreviation of "'''formatted name'''".
* <code>PHOTO</code> in vCard becomes <code><img class="photo" src=... alt="Photo of ..." /></code> or <code><object class="photo" data=... type=...>Photo of ...</object></code>
* <code>UID</code> in vCard simply becomes another semantic applied to a specific URL (or EMAIL) for an hCard.
* <code>UID</code> in vCard simply becomes another semantic applied to a specific URL (or EMAIL) for an hCard.
* Compare <code>TITLE</code> of "Wing Commander" with <code>ROLE</code> of "pilot".
====Adr====
{{adr-note}}
====Geo====
{{geo-note}}
==Deprecated==
=== profile attribute===
Previously this cheatsheet advised adding a profile attribute to the <nowiki><head></nowiki> like this:
<source lang=html4strict>
<head profile="http://www.w3.org/2006/03/hcard" />
</source>


===Geo===
This technique is valid for HTML4.x and XHTML1.x, however [http://stackoverflow.com/questions/1585220/use-of-profile-attribute-in-html-head-tag this is invalid for HTML5], thus authors are advised to use <nowiki><link rel=profile ...></nowiki> instead as [[#Profile|described above]] See [[hcard#Profile| hCard:Profile]] for more information.
*If latitude is present, so MUST be longitude, and vice versa.
*If the secondary classes are omitted, the two values MUST be comma separated and latitude MUST be first:<code><nowiki><span class=geo">37.386013,-122.082932</span></nowiki></code>
*The same number of decimal places SHOULD be used in each value.


==Related pages==
==Related pages==
{{hcard-related-pages}}
{{hcard-related-pages}}
*[[rel-profile]]
*{{cheatsheets}}

Latest revision as of 16:25, 18 July 2020


hCard properties and how to use them.

Profile

Place the following into the <head> of your document:

<link rel="profile" href="http://microformats.org/profile/hcard">

See rel-profile for details.

Properties (Class Names)

  • vcard {1}
    • adr*
      • type [work|home|pref|postal|dom|intl]?
      • post-office-box?
      • street-address*
      • extended-address?
      • region?
      • locality?
      • postal-code?
      • country-name?
    • agent*
    • bday? (ISO date)
    • class? confidentiality/access classification of the entire hCard
    • category*
    • email*
      • type?
      • value?
    • fn {1}
    • geo?
      • latitude?
      • longitude?
    • key*
    • label*
    • logo*
    • mailer*
    • n?
      • honorific-prefix*
      • given-name*
      • additional-name*
      • family-name*
      • honorific-suffix*
    • nickname*
    • note*
    • org*
      • organization-name?
      • organization-unit*
    • photo*
    • rev? datetime of the revision of the entire hCard
    • role*
    • sort-string?
    • sound*
    • tel* (Note E.123 for formatting info.)
      • type [home|work|pref|fax|cell|pager]?
      • value?
    • title*
    • tz? timezone of the person
    • uid? applies to the entire hCard
    • url*

Key

Based on Perl's standard quantifiers:

bold {1} MUST be present exactly once
italic* OPTIONAL, and MAY occur more than once
+ MUST be present, and MAY occur more than once
? OPTIONAL, but MUST NOT occur more than once
[square brackets] list of common values
(parentheses) data format
# comment
! awaiting documentation
pref preferred
dom domestic
intl international
cell mobile

Notes

  • 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.
  • URL in vCard becomes <a class="url" href=...>...</a> inside the element with class vcard in hCard.
  • Similarly, EMAIL in vCard becomes <a class="email" href="mailto:...">...</a>
  • FN is an abbreviation of "formatted name".
  • PHOTO in vCard becomes <img class="photo" src=... alt="Photo of ..." /> or <object class="photo" data=... type=...>Photo of ...</object>
  • UID in vCard simply becomes another semantic applied to a specific URL (or EMAIL) for an hCard.
  • Compare TITLE of "Wing Commander" with ROLE of "pilot".

Adr

  • At least one child-property MUST be present in adr.
  • If an adr-child (e.g street-address) is present it will ONLY be considered part of the adr data IF it is inside an adr.
  • FAQ: "why 'adr'?"

Geo

  • Coordinates MUST use the datum of WGS84.
  • If latitude is present, so MUST be longitude, and vice versa.
  • Coordinates MAY be combined a single <abbr> element; then the latitude and longitude MUST be separated by a semicolon in the title attribute and latitude MUST be first:
<abbr class="geo" title="37.386013;-122.082932">home</abbr>

Deprecated

profile attribute

Previously this cheatsheet advised adding a profile attribute to the <head> like this:

<head profile="http://www.w3.org/2006/03/hcard" />

This technique is valid for HTML4.x and XHTML1.x, however this is invalid for HTML5, thus authors are advised to use <link rel=profile ...> instead as described above See hCard:Profile for more information.

Related pages

The hCard 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.